简体   繁体   中英

How to make gdb shows modules names in backtrace

If all debug symblos are loaded - gdb backtrace shows something like:

#0  m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8) at builtin.c:993
#1  0x6e38 in expand_macro (sym=0x2b600) at macro.c:242
#2  0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08) at macro.c:71

But I need something like:

#0  m4_traceon (obs=0x24eb0, argc=1, argv=0x2b8c8) at builtin.c:993 from Lib1.so
#1  0x6e38 in expand_macro (sym=0x2b600) at macro.c:242 from Lib2.so
#2  0x6840 in expand_token (obs=0x0, t=177664, td=0xf7fffb08) at macro.c:71 from MyApp

Is it possible?

There is no built-in way to do this. I think there is a bug in gdb bugzilla that you can track if you are interested.

However, if you really need this, you can rewrite bt in Python, and customize it to do whatever you like.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM