[lttng-dev] get function names with lttng-ust-cyg-profile
Christophe Bédard
bedard.christophe at gmail.com
Tue Jun 23 12:52:38 EDT 2020
Hi,
Babeltrace is doing exactly what it should as far as I know.
>
yes, but babeltrace *can* provide the information if:
* ip and vpid contexts are enabled (for userspace), e.g.
$ lttng add-context --userspace --type=ip --type=vpid
* LTTng state dump events are enabled, e.g.
$ lttng enable-event --userspace 'lttng_ust_statedump:*'
see this (from bt2 but it also applies to bt1):
https://babeltrace.org/docs/v2.0/man7/babeltrace2-filter.lttng-utils.debug-info.7/#doc-lttng-prereq
Note that the Python bindings for babeltrace don't provide/expose this
debug info.
Christophe
On Tue, 23 Jun 2020 at 11:12, Matthew Khouzam via lttng-dev <
lttng-dev at lists.lttng.org> wrote:
> Hi,
>
> You have the pointers that are traced. Babeltrace is doing exactly what it
> should as far as I know.
>
> 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.
>
> Hope that helps.
> Matthew
> ------------------------------
> *From:* lttng-dev <lttng-dev-bounces at lists.lttng.org> on behalf of Liu,
> Changcheng via lttng-dev <lttng-dev at lists.lttng.org>
> *Sent:* Tuesday, June 23, 2020 10:37 AM
> *To:* lttng-dev at lists.lttng.org <lttng-dev at lists.lttng.org>
> *Cc:* changcheng.liu at intel.com <changcheng.liu at intel.com>
> *Subject:* [lttng-dev] get function names with lttng-ust-cyg-profile
>
> 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 at trace:~/cc$ sudo lttng create instrument
> Session instrument created.
> Traces will be output to
> /root/lttng-traces/instrument-20200623-222917
>
> trace at trace:~/cc$ sudo lttng enable-channel user_func_trace
> --userspace
> UST channel user_func_trace enabled for session instrument
>
> trace at 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 at 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 at trace:~/cc$ sudo lttng start
> Tracing started for session instrument
>
> trace at trace:~/cc$ sudo lttng destroy
> Destroying session instrument..
> Session instrument destroyed
>
> trace at 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 at lists.lttng.org
>
> 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
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20200623/c88ac7cb/attachment.htm>
More information about the lttng-dev
mailing list