Increase tracepoint provider:name len limit to 255, add compile-time warning
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 3 Dec 2011 22:50:23 +0000 (17:50 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 3 Dec 2011 22:50:23 +0000 (17:50 -0500)
The compiler will now complain with a warning if a tracepoint
provider:name exceeds the 255 char limit (+ \0).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/ust-abi.h
include/lttng/ust-tracepoint-event.h

index 2567ceb8a7e179e89e0673a5b6565478956511f9..8b8197731b10714543ca2948e386187f2bf36e70 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <stdint.h>
 
-#define LTTNG_UST_SYM_NAME_LEN 128
+#define LTTNG_UST_SYM_NAME_LEN 256
 
 #define LTTNG_UST_COMM_VERSION_MAJOR           0
 #define LTTNG_UST_COMM_VERSION_MINOR           1
index 5066b4b6ad3b814aab3c6f777922e89cae33aee2..58c46d80b90974652ce3eecfc3128b00da418cd8 100644 (file)
@@ -117,6 +117,25 @@ void _TP_COMBINE_TOKENS(__tracepoint_provider_check_, TRACEPOINT_PROVIDER)(void)
 #include TRACEPOINT_INCLUDE
 }
 
+/*
+ * Stage 0.1 of tracepoint event generation.
+ *
+ * Check that each TRACEPOINT_EVENT provider:name does not exceed the
+ * tracepoint name length limit.
+ */
+
+/* Reset all macros within TRACEPOINT_EVENT */
+#include <lttng/ust-tracepoint-event-reset.h>
+
+#undef TRACEPOINT_EVENT_INSTANCE
+#define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args)  \
+static const char                                                      \
+       __tp_name_len_check##_provider##___##_name[LTTNG_UST_SYM_NAME_LEN] \
+       __attribute__((unused)) =                                       \
+               #_provider ":" #_name;
+
+#include TRACEPOINT_INCLUDE
+
 /*
  * Stage 1 of tracepoint event generation.
  *
This page took 0.029617 seconds and 4 git commands to generate.