From: "Liu, Changcheng via lttng-dev" <lttng-dev@lists.lttng.org> To: lttng-dev@lists.lttng.org Cc: changcheng.liu@intel.com Subject: get function names with lttng-ust-cyg-profile Date: Tue, 23 Jun 2020 22:37:58 +0800 [thread overview] Message-ID: <20200623143758.GB4160129@jerryopenix> (raw) Hi all, I'm trying to use lttng-ust-cyg-profile to trace program. Does anyone know how to get function names and offset through lttng-ust-cyg-profile? In below example, the babeltrace could only get the function entry/exit value. 1. Source program: instrument.c 1 #include <stdio.h> 2 3 int add3(int val) { 4 return val + 3; 5 } 6 7 int main(int argc, char **argv) { 8 int x = 4; 9 10 puts("Press Enter to continue..."); 11 getchar(); 12 13 x = add3(x); 14 15 return 0; 16 } 2. build source code: $ gcc -g -finstrument-functions instrument.c -o instrument 3. run program: $ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/liblttng-ust-cyg-profile.so ./instrument 4. start trace process: trace@trace:~/cc$ sudo lttng create instrument Session instrument created. Traces will be output to /root/lttng-traces/instrument-20200623-222917 trace@trace:~/cc$ sudo lttng enable-channel user_func_trace --userspace UST channel user_func_trace enabled for session instrument trace@trace:~/cc$ sudo lttng enable-event --userspace lttng_ust_cyg_profile:func_entry --channel user_func_trace UST event lttng_ust_cyg_profile:func_entry created in channel user_func_trace trace@trace:~/cc$ sudo lttng enable-event --userspace lttng_ust_cyg_profile:func_exit --channel user_func_trace UST event lttng_ust_cyg_profile:func_exit created in channel user_func_trace trace@trace:~/cc$ sudo lttng start Tracing started for session instrument trace@trace:~/cc$ sudo lttng destroy Destroying session instrument.. Session instrument destroyed trace@trace:~/cc$ sudo babeltrace /root/lttng-traces/instrument-20200623-222917 [22:29:55.388607059] (+?.?????????) trace lttng_ust_cyg_profile:func_entry: { cpu_id = 2 }, { addr = 0x5625C88B01A9, call_site = 0x5625C88B0237 } [22:29:55.388612293] (+0.000005234) trace lttng_ust_cyg_profile:func_exit: { cpu_id = 2 }, { addr = 0x5625C88B01A9, call_site = 0x5625C88B0237 } [22:29:55.388613215] (+0.000000922) trace lttng_ust_cyg_profile:func_exit: { cpu_id = 2 }, { addr = 0x5625C88B01EE, call_site = 0x7FE40BD5C0B3 } B.R. Changcheng
WARNING: multiple messages have this Message-ID (diff)
From: "Liu, Changcheng via lttng-dev" <lttng-dev@lists.lttng.org> To: lttng-dev@lists.lttng.org Cc: changcheng.liu@intel.com Subject: [lttng-dev] get function names with lttng-ust-cyg-profile Date: Tue, 23 Jun 2020 22:37:58 +0800 [thread overview] Message-ID: <20200623143758.GB4160129@jerryopenix> (raw) Message-ID: <20200623143758.NfZwEUuD127q5XnnxOIW9w33Sp6vuPNCMgKA8TiOoeU@z> (raw) Hi all, I'm trying to use lttng-ust-cyg-profile to trace program. Does anyone know how to get function names and offset through lttng-ust-cyg-profile? In below example, the babeltrace could only get the function entry/exit value. 1. Source program: instrument.c 1 #include <stdio.h> 2 3 int add3(int val) { 4 return val + 3; 5 } 6 7 int main(int argc, char **argv) { 8 int x = 4; 9 10 puts("Press Enter to continue..."); 11 getchar(); 12 13 x = add3(x); 14 15 return 0; 16 } 2. build source code: $ gcc -g -finstrument-functions instrument.c -o instrument 3. run program: $ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/liblttng-ust-cyg-profile.so ./instrument 4. start trace process: trace@trace:~/cc$ sudo lttng create instrument Session instrument created. Traces will be output to /root/lttng-traces/instrument-20200623-222917 trace@trace:~/cc$ sudo lttng enable-channel user_func_trace --userspace UST channel user_func_trace enabled for session instrument trace@trace:~/cc$ sudo lttng enable-event --userspace lttng_ust_cyg_profile:func_entry --channel user_func_trace UST event lttng_ust_cyg_profile:func_entry created in channel user_func_trace trace@trace:~/cc$ sudo lttng enable-event --userspace lttng_ust_cyg_profile:func_exit --channel user_func_trace UST event lttng_ust_cyg_profile:func_exit created in channel user_func_trace trace@trace:~/cc$ sudo lttng start Tracing started for session instrument trace@trace:~/cc$ sudo lttng destroy Destroying session instrument.. Session instrument destroyed trace@trace:~/cc$ sudo babeltrace /root/lttng-traces/instrument-20200623-222917 [22:29:55.388607059] (+?.?????????) trace lttng_ust_cyg_profile:func_entry: { cpu_id = 2 }, { addr = 0x5625C88B01A9, call_site = 0x5625C88B0237 } [22:29:55.388612293] (+0.000005234) trace lttng_ust_cyg_profile:func_exit: { cpu_id = 2 }, { addr = 0x5625C88B01A9, call_site = 0x5625C88B0237 } [22:29:55.388613215] (+0.000000922) trace lttng_ust_cyg_profile:func_exit: { cpu_id = 2 }, { addr = 0x5625C88B01EE, call_site = 0x7FE40BD5C0B3 } B.R. Changcheng _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
next reply other threads:[~2020-06-23 14:41 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-23 14:37 Liu, Changcheng via lttng-dev [this message] 2020-06-23 14:37 ` [lttng-dev] get function names with lttng-ust-cyg-profile Liu, Changcheng via lttng-dev 2020-06-23 15:12 ` Matthew Khouzam via lttng-dev 2020-06-23 15:12 ` [lttng-dev] " Matthew Khouzam via lttng-dev 2020-06-23 16:52 ` Christophe Bédard via lttng-dev 2020-06-23 16:52 ` [lttng-dev] " Christophe Bédard via lttng-dev 2020-06-24 1:10 ` Liu, Changcheng via lttng-dev 2020-06-24 1:10 ` [lttng-dev] " Liu, Changcheng via lttng-dev 2020-06-24 1:41 ` Liu, Changcheng via lttng-dev 2020-06-24 1:41 ` [lttng-dev] " Liu, Changcheng via lttng-dev 2020-06-26 14:19 ` Christophe Bédard via lttng-dev 2020-06-26 14:19 ` [lttng-dev] " Christophe Bédard via lttng-dev 2020-06-26 14:22 ` Liu, Changcheng via lttng-dev 2020-06-26 14:22 ` [lttng-dev] " Liu, Changcheng via lttng-dev 2020-06-27 2:38 ` Liu, Changcheng via lttng-dev 2020-06-27 2:38 ` [lttng-dev] " Liu, Changcheng via lttng-dev
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200623143758.GB4160129@jerryopenix \ --to=lttng-dev@lists.lttng.org \ --cc=changcheng.liu@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).