简体   繁体   English

自动附加gdb并在进程启动时继续

[英]Automatically attach gdb and continue when a process launches

I am trying to setup a way to debug several C applications on windows. 我试图建立一种在Windows上调试几个C应用程序的方法。 The problem I am running into is that the design of these applications is such where the first application (starter.exe) runs another application (launch.exe) using a call to system("launch.exe"). 我遇到的问题是这些应用程序的设计使得第一个应用程序(starter.exe)使用对system(“ launch.exe”)的调用运行另一个应用程序(launch.exe)。 This launch.exe application may then run other applications using calls to CreateProcess(). 然后,此launch.exe应用程序可以使用对CreateProcess()的调用来运行其他应用程序。

Some of these applications may run only briefly, or possibly crash quickly, which results in me being unable to manually attach gdb to the process in time. 这些应用程序中的某些可能仅短暂运行,或者可能很快崩溃,这导致我无法及时将gdb手动附加到进程。 I am also only looking to use gdb for the subset of applications compiled with gcc (starter.exe, some of the applications created by launch.exe), the rest are compiled within VS2012. 我也只想将gdb用于使用gcc编译的应用程序的子集(starter.exe,一些由launch.exe创建的应用程序),其余的都在VS2012中编译。 Preferably gdb would have the default behavior of running "continue" instantly so as not to disrupt the control flow. 最好gdb具有立即运行“继续”的默认行为,以免破坏控制流。

Is there any reasonable way to accomplish this within Windows? 是否有任何合理的方法可以在Windows中完成此操作? If possible I would like to avoid changing the applications. 如果可能的话,我想避免更改应用程序。

In searching, I have come across the --waitfor command for gdb, but unfortunately this doesn't seem to be supported for my platform. 在搜索中,我遇到了gdb的--waitfor命令,但不幸的是,我的平台似乎不支持此命令。

Yes. 是。 You're looking for the Image File Execution Options registry key. 您正在寻找“ 图像文件执行选项”注册表项。

You want to set the " Debugger " value to be your gdb command line for the process. 您想要将“ Debugger ”值设置为该进程的gdb命令行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM