<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><span id="zwchr" data-marker="__DIVIDER__">----- On Jul 13, 2015, at 4:37 PM, Dilong Zheng <Dilong.Zheng@mitel.com> wrote:<br></span></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><style style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style><div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif"><p>Hi,</p><p><br></p><p>I have instrumented a C++ application with user space tracepoints. When I run the application and do a: "lttng list -u" command, I am able to see all my available tracepoints for the application. However when I enable those user space tracepoints and then
 start the trace, a core gets dumped and examining the core file in gdb I see the following error:</p><p><br></p><p><span style="font-size: 10pt; color: rgb(255, 0, 0);"><span style="font-family: "Courier New",monospace; color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">Program terminated with signal SIGSEGV, Segmentation fault.</span></span><br style="font-family: "Courier New",monospace; color: rgb(255, 0, 0);">
<span style="font-family: "Courier New",monospace; color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">#0  0x00000000 in ?? ()</span></span></span></p><p>...</p><p><span style="font-family:"Courier New",monospace; font-size:10pt">(gdb) bt</span><br style="font-family:"Courier New",monospace; font-size:10pt"><span style="font-family: "Courier New",monospace; font-size: 10pt; color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">#0  0x00000000 in ?? ()</span></span><br style="font-family: "Courier New",monospace; font-size: 10pt; color: rgb(255, 0, 0);"><span style="font-family: "Courier New",monospace; font-size: 10pt; color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">#1  0x08dd1088 in __event_probe__mike___sem_wait_entry (__tp_data=0xef92d818)</span></span><br style="font-family: "Courier New",monospace; font-size: 10pt; color: rgb(255, 0, 0);"><span style="font-family: "Courier New",monospace; font-size: 10pt; color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">    at /localhome/zhengd/override_mcd/System/SS_Inc/./sem_wrapper.h:67</span></span><br style="font-family: "Courier New",monospace; font-size: 10pt; color: rgb(255, 0, 0);"><span style="font-family: "Courier New",monospace; font-size: 10pt; color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">#2  0x08dd44d9 in __tracepoint_cb_mike___sem_wait_entry () at /localhome/zhengd/override_mc
 /System/SS_Inc/sem_wrapper.h:67</span></span><br style="font-family: "Courier New",monospace; font-size: 10pt; color: rgb(255, 0, 0);"><span style="font-family: "Courier New",monospace; font-size: 10pt; color: rgb(255, 0, 0);"><span style="color: rgb(255, 0, 0);">#3  __wrap_sem_wait (sem=0xf43014c8) at /localhome/zhengd/override_mcd/System/System_Services/SysServices_Linux/SystemLinux.cpp:1877</span></span></p><p><br></p><p><b>Contextual Information:</b> I would like to trace all calls to <span style="font-size:10pt; font-family:"Courier New",monospace">
<span style="font-family:"Courier New",monospace">sem_wait()</span></span> in my application. I am simply using a wrapper sem_wait function where I can place
<span style="font-family: "Courier New",monospace; font-size: 10pt;">tracepoint()</span> calls. Here's what the sem_wait wrapper looks like:</p><p><br></p><div><div dir="ltr"><div id="x_divtagdefaultwrapper" style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"><p><span style="font-size: 10pt; font-family: "Courier New",monospace;"><span style="font-family: "Courier New",monospace;">extern "C" int __real_sem_wait(sem_t*);</span></span></p><p><span style="font-size: 10pt; font-family: "Courier New",monospace;"><span style="font-family: "Courier New",monospace;">extern "C" int __wrap_sem_wait(sem_t* sem) </span></span></p><p><span style="font-size: 10pt; font-family: "Courier New",monospace;"><span style="font-family: "Courier New",monospace;">{</span></span></p><p><span style="font-size: 10pt; font-family: "Courier New",monospace;"><span style="font-family: "Courier New",monospace;">    tracepoint(mike,
 sem_wait_entry);  </span></span></p><p><span style="font-size: 10pt; font-family: "Courier New",monospace;"><span style="font-family: "Courier New",monospace;">    int ret =
 __real_sem_wait(sem);</span></span></p><p><span style="font-size: 10pt; font-family: "Courier New",monospace;"><span style="font-family: "Courier New",monospace;">    tracepoint(mike,
 sem_wait_exit, ret);</span></span></p><p><span style="font-size: 10pt; font-family: "Courier New",monospace;"><br style="font-family: "Courier New",monospace;">
</span></p><p><span style="font-size: 10pt; font-family: "Courier New",monospace;"><span style="font-family: "Courier New",monospace;">    return ret; </span></span></p><p><span style="font-size: 10pt; font-family: "Courier New",monospace;"><span style="font-family: "Courier New",monospace;">}</span></span></p></div></div></div><p><br></p><p>Here is the TRACEPOINT_EVENT macro found in my tracepoint provider header file (which was generated using lttng-gen-tp command line utility):</p><p><br></p><p><span style="font-family: "Courier New",monospace; font-size: 10pt;">TRACEPOINT_EVENT(mike,
</span></p><p><span style="font-family: "Courier New",monospace; font-size: 10pt;">    sem_wait_entry,</span></p><p><span style="font-family: "Courier New",monospace; font-size: 10pt;">    TP_ARGS(),</span></p><p><span style="font-family: "Courier New",monospace; font-size: 10pt;">    TP_FIELDS()</span></p><p><span style="font-family: "Courier New",monospace; font-size: 10pt;">)</span><br></p><p><br></p><p>And I am statically linking by using an existing CPP file (file with the __wrap_sem_wait() function) to create probes. I would just like to know any possible reasons why this error may be happening given the above mentioned circumstances and what I may be
 able to try in order to fix this.</p></div></blockquote><div>Which UST version do you use ? Make sure you upgrade to latest,<br></div><div>since we have fixed a similar segfault issue with probes compiled in<br data-mce-bogus="1"></div><div>C++ not so long ago.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Thanks,<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Mathieu<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif"><p><br></p><p>Thanks,</p><p><br></p><p>Dilong <br></p></div><br>_______________________________________________<br>lttng-dev mailing list<br>lttng-dev@lists.lttng.org<br>http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev<br></blockquote></div><div><br></div><div data-marker="__SIG_POST__">-- <br></div><div>Mathieu Desnoyers<br>EfficiOS Inc.<br>http://www.efficios.com</div></div></body></html>