<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<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="color: rgb(255, 0, 0);"></span><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="color: rgb(255, 0, 0);"></span><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="color: rgb(255, 0, 0);"></span><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="color: rgb(255, 0, 0);"></span><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="color: rgb(255, 0, 0);"></span><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 class="x_Apple-tab-span" style="white-space: pre; font-size: 10pt; font-family: "Courier New",monospace;"></span></p>
<p><span style="font-size: 10pt; font-family: "Courier New",monospace;"><span class="x_Apple-tab-span" style="white-space: pre; font-size: 10pt; font-family: "Courier New",monospace;"></span><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 class="x_Apple-tab-span" style="white-space: pre; font-size: 10pt; font-family: "Courier New",monospace;"></span><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 class="x_Apple-tab-span" style="white-space: pre; font-size: 10pt; font-family: "Courier New",monospace;"></span><span style="font-family: "Courier New",monospace;">    tracepoint(mike,
 sem_wait_exit, ret);</span></span></p>
<p><span class="x_Apple-tab-span" style="white-space: pre; font-size: 10pt; font-family: "Courier New",monospace;"></span></p>
<p><span style="font-size: 10pt; font-family: "Courier New",monospace;"><span class="x_Apple-tab-span" style="white-space: pre; font-size: 10pt; font-family: "Courier New",monospace;"></span><span style="font-family: "Courier New",monospace;"></span><br style="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 class="x_Apple-tab-span" style="white-space: pre; font-size: 10pt; font-family: "Courier New",monospace;"></span><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></p>
<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>
<p><br>
</p>
<p>Thanks,</p>
<p><br>
</p>
<p>Dilong <br>
</p>
</div>
</body>
</html>