How to print every executed line in GDB automatically until a given breakpoint is reached?

后端 未结 4 1652
猫巷女王i
猫巷女王i 2020-11-27 03:51

I would like to be able to set a breakpoint in GDB, and have it run to that point - and in the process, print out lines it has \"stepped through\".

Here is an exampl

4条回答
  •  一向
    一向 (楼主)
    2020-11-27 04:17

    Based on the link in @sdaau's answer (http://www.mail-archive.com/gdb@gnu.org/msg00031.html), I created my own script to simply keep sending 's' and reading the output of gdb continuously, while printing output to textfile and terminal, of course, my script can be modified to fit anyone else's needs, however, I hope that the modification I made should fit most people needs.

    http://www.codeground.net/coding/gdb-step-into-all-lines-to-get-full-application-flow/

    wget http://www.codeground.net/downloads/gdbwalkthrough.c
    gcc gdbwalkthrough.c -o gdbwalkthrough
    ./gdbwalkthrough  [application arguments]
    

提交回复
热议问题