While this is hardly a hidden setting, I found myself spending too much time to find it twice already – the msdn page describing it appears low on search results, since it uses very different terminology. So, if only for self reference, there goes:
You can easily debug executables without source (or even symbols) in VS – just attach to the running process. You can then step through instructions and watch memory and registers as you would in regular debugging. However, I had some process-launch issues, with a process I didn’t have the source to – so I had no running process to attach to..
Apparently you cannot launch a source-less process from within VS. The way to go is to modify a registry setting that would cause windows to launch a chosen debugger (VS for me) whenever you try and execute your destination process.
The registry key is –
HKLM\Software\Microsoft\Windows NT\currentversion\image file execution options
Add a subkey with the name of the executable to debug (e.g., notepad.exe), and give it a string value with name ‘Debugger’ and either of the values –
(1) ‘vsjitdebugger.exe’ if you want the JIT debugger-selection dialog,
(2) ‘devenv /debugexe’ if you know you’d want a new VS instance,
(3) Other debuggers of your choice – windbg, ntsd, kd, etc. Personally, I’ve yet to encounter a situation where they’re necessary, but these do exist.
The ‘image file execution options’ key contains some more goodies, that Junfeng Zhang took the time to look up and semi-document.
Edit (2): Turns out there’s a much, much easier and less destructive way – vsjitdebugger.exe can accept a process as a command line argument!
It sits at the WINDOWS/system32 folder, and running ‘vsjitdebugger.exe notepad.exe’ will do the trick.
You can create a shortcut to vsjitdebugger with your executable as an argument for extra-convenience.
Type ‘vsjitdebugger.exe -?’ for a bit more stuff (executable arguments and attaching to a running process).