Skip to content

Output the current call stack programmatically.

Peter W. Draper requested to merge backtrace-fun into master

Adds a function that will show some information about the current call stack. Useful to see where the code you are interested in is being called from without opening up a debugger Not as good as line numbers are not available.

Sample output:

[0000] [00000.9] print_backtrace: threadpool_map
[0000] [00000.9] print_backtrace: eagle_6.yml(print_backtrace+0x67) [0x557d7e749ae7]
[0000] [00000.9] print_backtrace: eagle_6.yml(threadpool_map+0x136) [0x557d7e6b51a6]
[0000] [00000.9] print_backtrace: eagle_6.yml(space_free_cells+0x48) [0x557d7e625a68]
[0000] [00000.9] print_backtrace: eagle_6.yml(space_regrid+0x1396) [0x557d7e614ac6]
[0000] [00000.9] print_backtrace: eagle_6.yml(space_rebuild+0x5a) [0x557d7e60f00a]
[0000] [00000.9] print_backtrace: eagle_6.yml(engine_rebuild+0x8f) [0x557d7e63578f]
[0000] [00000.9] print_backtrace: eagle_6.yml(engine_init_particles+0x97) [0x557d7e639527]
[0000] [00000.9] print_backtrace: eagle_6.yml(main+0x4245) [0x557d7e5ff1c5]
[0000] [00000.8] print_backtrace: eagle_6.yml(print_backtrace+0x67) [0x557d7e749ae7]
[0000] [00000.8] print_backtrace: eagle_6.yml(threadpool_map+0x136) [0x557d7e6b51a6]
[0000] [00000.8] print_backtrace: eagle_6.yml(engine_redistribute+0xfb0) [0x557d7e65e250]
[0000] [00000.8] print_backtrace: eagle_6.yml(engine_split+0x78) [0x557d7e637588]
[0000] [00000.8] print_backtrace: eagle_6.yml(main+0x4231) [0x557d7e5ff1b1]
[0000] [00000.8] print_backtrace: /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x14a6a6644d90]
[0000] [00000.8] print_backtrace: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x14a6a6644e40]

So not sure why the program is shown as the parameter file, but the basics are clear.

Uses glibc call so also configured as needed.

Edited by Peter W. Draper

Merge request reports