process - 将 WinDbg 附加到进程

标签 process windbg

我有以下问题:假设您有一个从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/

    相关文章:

    asp.net - 遍历 !DumpHeap 输出以读取内存偏移量处的值

    windows - 如何在 Windows 8 中使用 cmd 按进程名称终止程序?

    linux - perl 在退出时挂起(关闭文件句柄后)

    c# - 我如何分析 C# prodump 崩溃转储文件,异常来自 CLR?

    .net - 如何确定对象被固定的原因

    heap-memory - !heap –s 显示 “Lock contention”

    c++ - 从内存地址到源代码行

    java - 如何在另一个java程序中编译&运行java程序?

    c - 如何在 SIGINT 上仅终止前台子进程?

    python - multiprocessing.Process导致: OSError: [Errno 12] Cannot allocate memory even when I run only 1 process