<div dir="ltr"><div dir="ltr">Hi,<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">Babeltrace is doing exactly what it should as far as I know.</span><br></blockquote><div><br></div><div>yes, but babeltrace <i>can</i> provide the information if:</div><div><br></div><div>* ip and vpid contexts are enabled (for userspace), e.g.</div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div dir="ltr"><div>$ lttng add-context --userspace --type=ip --type=vpid</div></div></blockquote><div dir="ltr"><div>* LTTng state dump events are enabled, e.g.</div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div dir="ltr"><div>$ lttng enable-event --userspace 'lttng_ust_statedump:*'</div></div></blockquote><div dir="ltr"><div><br></div><div>see this (from bt2 but it also applies to bt1): <a href="https://babeltrace.org/docs/v2.0/man7/babeltrace2-filter.lttng-utils.debug-info.7/#doc-lttng-prereq">https://babeltrace.org/docs/v2.0/man7/babeltrace2-filter.lttng-utils.debug-info.7/#doc-lttng-prereq</a></div><div><br></div><div>Note that the Python bindings for babeltrace don't provide/expose this debug info.</div><div><br></div><div><br></div><div>Christophe</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 23 Jun 2020 at 11:12, Matthew Khouzam via lttng-dev <<a href="mailto:lttng-dev@lists.lttng.org">lttng-dev@lists.lttng.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
You have the pointers that are traced. Babeltrace is doing exactly what it should as far as I know.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
You could use the command 'nm' to get your symbols and look them up. I am sure Babeltrace can do this from a python level. You could also use a GUI based trace viewer to get the information. </div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hope that helps.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Matthew<br>
</div>
<div id="gmail-m_-3967757338877835848appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-3967757338877835848divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> lttng-dev <<a href="mailto:lttng-dev-bounces@lists.lttng.org" target="_blank">lttng-dev-bounces@lists.lttng.org</a>> on behalf of Liu, Changcheng via lttng-dev <<a href="mailto:lttng-dev@lists.lttng.org" target="_blank">lttng-dev@lists.lttng.org</a>><br>
<b>Sent:</b> Tuesday, June 23, 2020 10:37 AM<br>
<b>To:</b> <a href="mailto:lttng-dev@lists.lttng.org" target="_blank">lttng-dev@lists.lttng.org</a> <<a href="mailto:lttng-dev@lists.lttng.org" target="_blank">lttng-dev@lists.lttng.org</a>><br>
<b>Cc:</b> <a href="mailto:changcheng.liu@intel.com" target="_blank">changcheng.liu@intel.com</a> <<a href="mailto:changcheng.liu@intel.com" target="_blank">changcheng.liu@intel.com</a>><br>
<b>Subject:</b> [lttng-dev] get function names with lttng-ust-cyg-profile</font>
<div> </div>
</div>
<div><font size="2"><span style="font-size:11pt">
<div>Hi all,<br>
I'm trying to use lttng-ust-cyg-profile to trace program.<br>
Does anyone know how to get function names and offset through lttng-ust-cyg-profile?<br>
<br>
In below example, the babeltrace could only get the function entry/exit value.<br>
1. Source program: instrument.c<br>
1 #include <stdio.h><br>
2 <br>
3 int add3(int val) {<br>
4 return val + 3;<br>
5 }<br>
6 <br>
7 int main(int argc, char **argv) {<br>
8 int x = 4;<br>
9 <br>
10 puts("Press Enter to continue...");<br>
11 getchar();<br>
12 <br>
13 x = add3(x);<br>
14 <br>
15 return 0;<br>
16 }<br>
<br>
2. build source code:<br>
$ gcc -g -finstrument-functions instrument.c -o instrument<br>
<br>
3. run program:<br>
$ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/liblttng-ust-cyg-profile.so ./instrument<br>
<br>
4. start trace process:<br>
trace@trace:~/cc$ sudo lttng create instrument<br>
Session instrument created.<br>
Traces will be output to /root/lttng-traces/instrument-20200623-222917<br>
<br>
trace@trace:~/cc$ sudo lttng enable-channel user_func_trace --userspace<br>
UST channel user_func_trace enabled for session instrument<br>
<br>
trace@trace:~/cc$ sudo lttng enable-event --userspace lttng_ust_cyg_profile:func_entry --channel user_func_trace<br>
UST event lttng_ust_cyg_profile:func_entry created in channel user_func_trace<br>
trace@trace:~/cc$ sudo lttng enable-event --userspace lttng_ust_cyg_profile:func_exit --channel user_func_trace<br>
UST event lttng_ust_cyg_profile:func_exit created in channel user_func_trace<br>
<br>
trace@trace:~/cc$ sudo lttng start<br>
Tracing started for session instrument<br>
<br>
trace@trace:~/cc$ sudo lttng destroy<br>
Destroying session instrument..<br>
Session instrument destroyed<br>
<br>
trace@trace:~/cc$ sudo babeltrace /root/lttng-traces/instrument-20200623-222917<br>
[22:29:55.388607059] (+?.?????????) trace lttng_ust_cyg_profile:func_entry: { cpu_id = 2 }, { addr = 0x5625C88B01A9, call_site = 0x5625C88B0237 }<br>
[22:29:55.388612293] (+0.000005234) trace lttng_ust_cyg_profile:func_exit: { cpu_id = 2 }, { addr = 0x5625C88B01A9, call_site = 0x5625C88B0237 }<br>
[22:29:55.388613215] (+0.000000922) trace lttng_ust_cyg_profile:func_exit: { cpu_id = 2 }, { addr = 0x5625C88B01EE, call_site = 0x7FE40BD5C0B3 }<br>
<br>
B.R.<br>
Changcheng<br>
_______________________________________________<br>
lttng-dev mailing list<br>
<a href="mailto:lttng-dev@lists.lttng.org" target="_blank">lttng-dev@lists.lttng.org</a><br>
<a href="https://protect2.fireeye.com/v1/url?k=98478753-c6e73d3d-9847c7c8-869a14f4b08c-41638b2508ab85dd&q=1&e=703483a0-63a9-4269-ac8e-c1fc5a57edad&u=https%3A%2F%2Flists.lttng.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Flttng-dev" target="_blank">https://protect2.fireeye.com/v1/url?k=98478753-c6e73d3d-9847c7c8-869a14f4b08c-41638b2508ab85dd&q=1&e=703483a0-63a9-4269-ac8e-c1fc5a57edad&u=https%3A%2F%2Flists.lttng.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Flttng-dev</a><br>
</div>
</span></font></div>
</div>
_______________________________________________<br>
lttng-dev mailing list<br>
<a href="mailto:lttng-dev@lists.lttng.org" target="_blank">lttng-dev@lists.lttng.org</a><br>
<a href="https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev" rel="noreferrer" target="_blank">https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev</a><br>
</blockquote></div></div>