开发者

How do I debug an existing C++ executable with pdb but without source code

I work in already compiled (in debug mode) C++ project. I have its exe file and pdb file. I can run the exe from command line.

How can I debug the project? (I so not have its .sln file.)

I work in Visual Studio, but I also have a cygwin in the s开发者_开发百科ystem.


Open the executable from Visual Studio, in the same way as you would open a project or a solution. That will allow you to debug it.

(It creates an empty place-holder solution around your exe, which you can use to change environment variables or command-line arguments when you run the exe to debug it.)


Start a Visual Studio command prompt, and run the following command:

devenv /debugexe yourapp.exe

It must be equivalent to opening the executable file in Visual Studio as Macke suggested in his answer.

You can then press e.g. F10 for the debugger to stop in the beginning of app execution, or set a breakpoint as usual, etc.


You can use WinDbg for debugging.
You can point Windbg to the sources or stick to the disassembly but the PDB files will at least contain the name of the invoked methods and you can see a readable stack trace.


You can debug an already running process too. Just start the program from command line, and then use visual Studio to Attach to it (Tools -> Attach to process).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜