From: Philippe Proulx Date: Mon, 4 Jul 2016 21:48:42 +0000 (-0400) Subject: Add support for UST's autoincrementing enum entries X-Git-Tag: v2.9.0-rc1~103 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=e85e37239d682b8127005c3f63f72999193214c1;p=lttng-tools.git Add support for UST's autoincrementing enum entries Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/lttng-ust-abi.h b/src/bin/lttng-sessiond/lttng-ust-abi.h index 7bec0c961..0487320b8 100644 --- a/src/bin/lttng-sessiond/lttng-ust-abi.h +++ b/src/bin/lttng-sessiond/lttng-ust-abi.h @@ -44,7 +44,7 @@ #define LTTNG_UST_COMM_MAGIC 0xC57C57C5 /* Version for ABI between liblttng-ust, sessiond, consumerd */ -#define LTTNG_UST_ABI_MAJOR_VERSION 6 +#define LTTNG_UST_ABI_MAJOR_VERSION 7 #define LTTNG_UST_ABI_MINOR_VERSION 1 enum lttng_ust_instrumentation { diff --git a/src/bin/lttng-sessiond/lttng-ust-ctl.h b/src/bin/lttng-sessiond/lttng-ust-ctl.h index b8cf775e3..c0723d095 100644 --- a/src/bin/lttng-sessiond/lttng-ust-ctl.h +++ b/src/bin/lttng-sessiond/lttng-ust-ctl.h @@ -297,7 +297,12 @@ struct ustctl_enum_value { struct ustctl_enum_entry { struct ustctl_enum_value start, end; /* start and end are inclusive */ char string[LTTNG_UST_SYM_NAME_LEN]; - char padding[USTCTL_UST_ENUM_ENTRY_PADDING]; + union { + struct { + uint8_t is_auto; + } LTTNG_PACKED options; + char padding[USTCTL_UST_ENUM_ENTRY_PADDING]; + } u; } LTTNG_PACKED; #define USTCTL_UST_BASIC_TYPE_PADDING 296 diff --git a/src/bin/lttng-sessiond/ust-metadata.c b/src/bin/lttng-sessiond/ust-metadata.c index c97013f43..328d6ea4c 100644 --- a/src/bin/lttng-sessiond/ust-metadata.c +++ b/src/bin/lttng-sessiond/ust-metadata.c @@ -300,38 +300,52 @@ int ust_metadata_enum_statedump(struct ust_registry_session *session, goto end; } } - ret = lttng_metadata_printf(session, - "\" = "); + ret = lttng_metadata_printf(session, "\""); if (ret) { goto end; } - if (entry->start.signedness) { - ret = lttng_metadata_printf(session, - "%lld", (long long) entry->start.value); + if (entry->u.options.is_auto) { + ret = lttng_metadata_printf(session, ",\n"); + if (ret) { + goto end; + } } else { ret = lttng_metadata_printf(session, - "%llu", entry->start.value); - } - if (ret) { - goto end; - } + " = "); + if (ret) { + goto end; + } - if (entry->start.signedness == entry->end.signedness && - entry->start.value == entry->end.value) { - ret = lttng_metadata_printf(session, - ",\n"); - } else { - if (entry->end.signedness) { + if (entry->start.signedness) { ret = lttng_metadata_printf(session, - " ... %lld,\n", (long long) entry->end.value); + "%lld", (long long) entry->start.value); } else { ret = lttng_metadata_printf(session, - " ... %llu,\n", entry->end.value); + "%llu", entry->start.value); + } + if (ret) { + goto end; + } + + if (entry->start.signedness == entry->end.signedness && + entry->start.value == + entry->end.value) { + ret = lttng_metadata_printf(session, ",\n"); + } else { + if (entry->end.signedness) { + ret = lttng_metadata_printf(session, + " ... %lld,\n", + (long long) entry->end.value); + } else { + ret = lttng_metadata_printf(session, + " ... %llu,\n", + entry->end.value); + } + } + if (ret) { + goto end; } - } - if (ret) { - goto end; } } nesting--;