可以在不停止调试的情况下给gdb命令吗? [英] Is it possible to give commands to gdb without stopping the debuggee?

查看:456
本文介绍了可以在不停止调试的情况下给gdb命令吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Gameconqueror可以在不停止跟踪​​的程序的情况下更新连续发现的变量。但是据我所知,你必须使用ptrace()来访问指定的程序,当你这样做时,它会自动停止调试。但是不知何故,Gameconqueror设法做到这一点,而不会中断调试器(并且每半秒更新一次)。

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).

我认为如果Gameconqueror可以做到,gdb应该是能做到这一点继续调试后,我尝试输入一些命令,gdb不会发出任何错误,但也不显示任何内容。我很困惑。

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.

推荐答案

您需要在 gdb 。这里记载的是:
https:// sourceware。 org / gdb / onlinedocs / gdb / Background-Execution.html#背景执行

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

例如:

(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.

如果要停止程序,则需要使用中断命令,作为通常 Ctrl + c 将无法正常工作。

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

这篇关于可以在不停止调试的情况下给gdb命令吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆