Make GDB print control flow of functions as they are called

前端 未结 5 716
广开言路
广开言路 2020-12-14 03:09

How do I make gdb print functions of interest as they are called, indented according to how deep in the stack they are?

I want to be able to say something like (made

5条回答
  •  佛祖请我去吃肉
    2020-12-14 03:31

    Did you see litb's excellent anwser to a similar post here ?

    He uses readelf to get interesting symbols, gdb commands to get the trace, and awk to glue all that.

    Basically what you have to change is to modify his gdb command script to remove the 1 depth from backtrace to see the stack and filter specific functions, and reformat the output with an awk/python/(...) script to present it as a tree. (I admit I'm too lazy to do it now...)

提交回复
热议问题