我有以下问题:假设您有一个从cmd.exe启动的可执行文件(program.exe)。所以,我们有
C:> start program.exe
是否可以将WinDbg附加到正在运行的进程program.exe?如果是的话,我怎样才能实现这一目标?是否可以 ? 注意:当我让program.exe启动时,另一个命令行窗口打开和关闭得非常快。 WinDbg 能捕获它吗? 我尝试使用 Immunity Debugger 捕获它,但没有机会。
最佳答案
通常,您可以使用 F6 附加到 WinDbg 中的进程或使用 -pn
命令行开关。如果进程终止得太快,有几种选择:
- 在调试器下运行程序。使用 Ctrl+E 并输入程序的名称、参数和启动目录。或者,将可执行文件和参数指定为 WinDbg 的最后一个参数:
executable
Specifies the command line of an executable process. This is used to launch a new process and debug it. This has to be the final item on the command line. All text after the executable name is passed to the executable as its argument string.
创建注册表项
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\your.exe
作为described on MSDN和一个 REGSZ调试器
,其中包含程序启动时自动启动该程序的调试器的路径如果该程序在您的控制之下,请插入 DebugBreak()在开头调用或类似的(
Sleep()
、getline()
)。
关于process - 将 WinDbg 附加到进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36947442/