Is it possible to give commands to gdb without stopping the debuggee?

牧云@^-^@ 提交于 2019-12-24 21:45:28

问题


Gameconqueror can update the variables it found continuously without stopping the program it's tracing. But as I know you have to use ptrace() to gain access of the specified program and when you do that it automatically stops the debuggee. But somehow Gameconqueror manages to do it's job without interrupting the debuggee(and it updates itself like every half second).

I think if Gameconqueror can do it, also gdb should be able to do it. I tried to enter some commands after continuing the debuggee, gdb doesn't give any error but also doesn't display anything. I'm very confused.


回答1:


You need to make use of asynchronous mode within gdb. This is documented here: https://sourceware.org/gdb/onlinedocs/gdb/Background-Execution.html#Background-Execution

For example:

(gdb) continue &

Will continue your program and then immediately return to the command prompt, allowing you to issue further commands while your program is still running.

If you want to stop your program you need to use the interrupt command, as the usual Ctrl+c will not work.



来源:https://stackoverflow.com/questions/35255448/is-it-possible-to-give-commands-to-gdb-without-stopping-the-debuggee

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!