c - How do I store symbol names from the stack trace in GDB Script variables? -
supposed stack trace:
#0 f1 () @ foo.c:n #1 f2 () @ foo.c:n #2 f3 () @ foo.c:n #3 f4 () @ foo.c:n i want able in gdb script:
printf "function %s called function %s\n", $f1_name, $f2_name is possible? there struct somewhere kind of metadata?
the simplest way use python api.
there more horrible way, too: use "set logging" redirect file. then, "bt" or whatever else like. then, undo logging. use "shell" command rewrite file gdb script sets convenience variables. finally, "source" script.
i suggest sticking python approach though. can write convenience function in python expose quite easily.
Comments
Post a Comment