How do I debug an external program with Visual Studio?


  • Thanks to VisualD not being properly maintained and seriously lacking features, I had to change move to VSCode, but thanks to D's native debugger's command line being so barebones it's only capable of printing out the backtrace, I'm mostly left without a proper debugger.

    I found out that VS's debugger can be used with external apps, however attaching to already running apps are clunky and cannot be used if the bug happens immediately.

    How can I debug apps with it from the beginning? Opening the exe file doesn't give me the option for running with debugging.

    Sunday, October 21, 2018 4:57 AM

All replies

  • 1. If Visual Studio -Just-in-Time debugger is configured, you can start from command-line with app-name - e.g. notepad breaks at WinMainCRTStartup:

    2. You can add an executable file as an 'Existing Project' to a solution:
    File->Add->Existing Project...

    3. If looking for a great (native) standalone debugger would try 'WinDbg Preview'

    With kind regards

    Sunday, October 21, 2018 9:43 AM
  • 3. If looking for a great (native) standalone debugger would try 'WinDbg Preview'

    In the event that the OP is not interested in using the WinDbg Preview or isn't debugging on Windows 10 then it should be noted that WinDbg.exe can be installed through the various versions of the Windows SDK by selecting the Debugging Tools component.
    Sunday, October 21, 2018 10:25 AM