How to: Launch the Debugger Automatically
发布日期:2021-06-30 22:01:38 浏览次数:2 分类:技术文章

本文共 2525 字,大约阅读时间需要 8 分钟。

How to: Launch the Debugger Automatically

Visual Studio 2008

Sometimes, you may need to debug the startup code for an application that is launched by another process. Examples include services and custom setup actions. In these scenarios, you can have the debugger launch and automatically attach when your application starts.

To setup an application to launch the debugger automatically

  1. Start the Registry Editor (regedit).

  2. In the Registry Editor, open the HKEY_LOCAL_MACHINE folder.

  3. Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\currentversion\image file execution options.

  4. In the Image File Execution Options folder, locate the name of the application you want to debug, such as myapp.exe. If you cannot find the application you want to debug:

    1. Right-click the Image File Execution Options folder, and on the shortcut menu, click New Key.

    2. Right-click the new key, and on the shortcut menu, click Rename.

    3. Edit the key name to the name of your application; myapp.exe, in this example.

  5. Right-click the myapp.exe folder, and on the shortcut menu, click New String Value.

  6. Right-click the new string value, and on the shortcut menu, click Rename.

  7. Change the name to debugger.

  8. Right-click the new string value, and on the shortcut menu, click Modify.

    The Edit String dialog box appears.

  9. In the Value data box, type vsjitdebugger.exe.

  10. Click OK.

  11. From the Registry menu, click Exit.

  12. The directory containing vsjitdebugger.exe must be in your system path. To add it to the system path, follow these steps:

    1. Open the Control Panel in Classic view, and double-click System.

    2. Click Advanced System Settings.

    3. In System Properties, click the Advanced tab.

    4. On the Advanced tab, click Environment Variables.

    5. In the Environment Variables dialog box, under System variables, select Path, then click the Edit button.

    6. In the Edit System Variable dialog box, add the directory to the Variable value text box. Use a semicolon to separate it from other entries in the list.

    7. Click OK to close the Edit System Variable dialog box.

    8. Click OK to close the Environment Variables dialog box.

    9. Click OK to close the System Properties dialog box.

    Now, use any method to start your application. Visual Studio will start and load the application.

    注册表例子

    Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\showcmd999.exe]"Debugger"="\"D:\\OllyICE_1.10_byPediy_GoodOnWin7X64\\OllyICE.exe\""

    作用

    当我们打开(双击或CreateProcess) showcmd999.exe时, OllyICE.exe会接住程序, 附加并调试.

转载地址:https://lostspeed.blog.csdn.net/article/details/10110423 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Nodejs服务端js的调试
下一篇:debug : 调试主进程启动的子进程

发表评论

最新留言

路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年04月30日 01时49分58秒