[lttng-dev] Tracepoint not compiling with many string event fields

Suchakrapani Datt Sharma suchakrapani.sharma at polymtl.ca
Wed Feb 18 16:53:34 EST 2015

Hi all,

I was doing a small test on filtering traces at runtime based on event  
fields. There may be an elegant ways to define event arguments and  
fields (ctf_sequence_text?) for my usecase for a tracepoint, but I was  
just trying to do something like following, but for more than just 2  
char* arguments:

TRACEPOINT_EVENT(retlif_tp, tpfilt,

             char*, str0,

             char*, str1,

             int, life

         ctf_string(var0, str0)

         ctf_string(var1, str1)

         ctf_integer(int, lyf, life)

Here [1] is what I did. This is generated by a script I wrote so that  
I can run my tests by varying the number of fields my filter needs to  
run upon. I get this error [2] when the arguments are increased to  
more than 10. It is related to macro expansion. Here is a snippet from  
a healthy expanded macro:


  6722 extern struct lttng_ust_tracepoint __tracepoint_retlif_tp___tpfilt;
  6723 static inline __attribute__ ((always_inline, unused))
  6724   __attribute__ ((no_instrument_function))
  6725      void __tracepoint_cb_retlif_tp___tpfilt (char *str0, char *str1,
  6726                           char *str2, char *str3,
  6727                           char *str4, int life);
  6728      static void __tracepoint_cb_retlif_tp___tpfilt (char  
*str0, char *str1,
  6729                              char *str2, char *str3,
  6730                              char *str4, int life)


And here is a snippet from an unhealthy macro:


  6732 extern struct lttng_ust_tracepoint __tracepoint_retlif_tp___tpfilt;
  6733     static inline __attribute__ ((always_inline, unused))
  6734 __attribute__ ((no_instrument_function))
  6735     void
  6736     __tracepoint_cb_retlif_tp___tpfilt (_TP_EXPROTOint
  6737             (char *, str0, char *, str1,
  6738              char *, str2, char *, str3,
  6739              char *, str4, char *, str5,
  6740              char *, str6, char *, str7,
  6741              char *, str8, char *, str9, int,
  6742              life));
  6743 static void
  6744     __tracepoint_cb_retlif_tp___tpfilt (_TP_EXPROTOint
  6745             (char *, str0, char *, str1,
  6746              char *, str2, char *, str3,
  6747              char *, str4, char *, str5,
  6748              char *, str6, char *, str7,
  6749              char *, str8, char *, str9, int,
  6750              life))


Note strings like "(_TP_EXPROTOint" being added at wrong location in  
code. If someone can confirm its a bug, I can file a report and will  
fix it. If its a known limitation, there needs to be error checks added.

[1] Tracepoint : http://ur1.ca/jr6gc
[2] Error : http://ur1.ca/jr6gm

Have a nice evening!


More information about the lttng-dev mailing list