Know Debugger more and more

Demand:
There is an application app.exe. We want to debug it. The resources we have include:
1. app.pdb
2. all source code of it (.h/cpp) but without VS project setting files. It maybe build with Jam

How to debug it?

Solution:
1. Create an empty project: windows console application(exe).
2. Project setting: debugging -> command : X:\..\app.exe
3. Include some source files into the project, but instantly excluding them from compile by setting those files' property
4. Set some definitely touchable breakpoints
5. Compile and run the empty console application.

These breakpoints can be touched by debugger! Now we can debug it!

Thought:
Easy to know the internal principle. We build an empty console application is only to attach the debugger to our app.exe. Then with breakpoints and pdb, once reaching a breakpoint, debugger will use pdb to position the code line, and bring the source code to us for debugging! Cool!
One note: exclude files from project compile is useful in this case.

原文地址:https://www.cnblogs.com/taoxu0903/p/1127262.html