在没有信号的情况下停止 GDB 中的劣等进程?
有没有办法在不使用 Ctrl+C (或从另一个进程发送的等效信号)的情况下停止下级?我正在使用 Windows 平台并从另一个进程管理 GDB,所以没有信号的概念,似乎有当程序在没有任何断点的情况下自由运行时,这不是中断程序执行的好方法。
编辑清楚:
这里涉及 2 个过程。 有进程 A,它是 GDB 的父进程。 GDB 正在管理一个进程,但它位于远程主机上,我们将该进程称为 C。
当我告诉 GDB“运行”时,它会启动远程主机上的进程 C,并阻塞直到命中断点,进程 C遇到错误或致命信号,或者GDB本身收到中断信号。 如果以交互方式工作,您只需在 GDB 命令控制台上按 CTRL+C,GDB 将其解释为 SIGINT(以某种方式),触发 GDB 停止进程 C。因为我实际上正在使用进程 A 管理 GDB(而不是处理它) (在 shell 中交互)我不能很好地按 Ctrl+C,并且由于 Windows 没有像 UNIX 中那样的“信号”本机概念,所以我不知道当 GDB 阻塞等待进程 C 时如何中断 GDB中断或命中断点。
Is there a way to stop the inferior without using Ctrl+C (or an equivalent signal sent from another process?) I'm using a windows platform and am managing GDB from another process, so with no notion of signals, it seems that there isn't a good way to break execution of my program when it's free running without any breakpoints.
EDIT FOR CLARITY:
There are 2 processes involved here. There's process A, which is the parent of GDB. GDB is managing a process, but it's on a remote host, and we'll call that process C.
When I tell GDB to "run" it kicks off process C on the remote host and blocks either until a breakpoint is hit, process C encounters an error or a fatal signal, or GDB itself receives an interrupt signal. If working interactively, you would simply press CTRL+C at the GDB command console, which GDB interprets as a SIGINT (somehow), triggering GDB to halt process C. Since I'm actually managing GDB with process A (and not dealing with it interactively at the shell) I can't very well press Ctrl+C, and since windows has no native notion of "Signals" like you have in UNIX, I can't figure out how to interrupt GDB when it's blocking waiting for process C to interrupt or hit a breakpoint.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试查看远程控制协议? 例如,EMACS 使用MI 来控制 GDB,你应该检查他们如何/是否提供这样的
ctrl-C
机制,以及他们如何实现它。编辑:它似乎是
-exec-interrupt
中断执行。Did you try to take a look at the remote control protocols? for instance, EMACS uses MI to control GDB, you should check how/if they offer such a
ctrl-C
mechanism, and how they implement it.EDIT: it seems to be
-exec-interrupt
which interrupts the execution.