Automatically adding Enter/Exit Function Logs to a Project

后端 未结 5 913
攒了一身酷
攒了一身酷 2020-11-29 04:42

I have a 3rd party source code that I have to investigate. I want to see in what order the functions are called but I don\'t want to waste my time typing:

pr         


        
5条回答
  •  孤独总比滥情好
    2020-11-29 05:23

    If you're using gcc, the magic compiler flag is -g. Compile with debugging symbols, run the program under gdb, and generate stack traces. You could also use ptrace, but it's probably a lot easier to just use gdb.

提交回复
热议问题