1

I am aware of this question, but I don't understand the only answer given.

How do I tell OllyDbg where the source code is when I have no PDB file (debug symbols) available?

  • 2
    i just commented in the linked Q before seeing this question so to reiterate you cant tell any debugger to use source without having debug symbol information with sourceline information included (pdb for windows compilers and dwarf for gcc compilers) – blabb Jul 26 '18 at 20:54
  • Ah, I think I see. So, I would somehow have to convince Vectorcast, which creates the .EXE to do so and also generate a .PDB? Feel free to post that as an answer, and I will accept it (and, possibly, open another question elsewhere asking how to do so). Thanks – Mawg Jul 26 '18 at 21:04
3

You cannot tell Ollydbg or for that matter any debugger where source code is without having Debug Information.

The Source Line information is available only in the Debug Information File.

  • with msvc compiler chain it is Program Database File aka PDB
  • with gcc compiler chains it is called dwarf

As far as I know gcc when built with -g option embeds the Debug Information inside the Executable itself (you may need strip to strip the debug info from the binary).

But msvc with /Zi switch always creates a separate pdb file. You can use the binplace or pdbcopy utility to selectively strip Debug Information from this pdb file.

I googled vectorcast and it seems to be a software testing suite and its site says it is compatible with MSVC tool chain up to Visual Studio 2013.

Debuggers Supported by Vectorcast

  • Thanks for that. Vectorcast comes with some MinGW binaries, including gdb, and allows us to invoke the command line version of gdb. But, when I start Ollydbg and load an .exe, I dont see any source :-( – Mawg Jul 28 '18 at 7:44
  • You can try the cv2pdb tool to extract a PDF from a mingw executable with symbols. – mrexodia Jul 30 '18 at 23:48
  • I don't see either *.pdb or *.dwarf :-( Maybe I ought to ask a question about that? (not necessarily here) – Mawg Jul 31 '18 at 12:44
0

OllDbg is a Windows tool and thus using a windows library dbghelp.dll to do the debugging work. You can tell that by listing Olly's dlls:

enter image description here

And dbghelp.dll uses symbol files to link the binary information with the source code.

Thus you tell OllyDbg where the source code is by using the PDB file. PDB is what links your binary file with your source code.

The following excerpt still holds - Specify symbol (.pdb) and source files in the Visual Studio debugger:

A program database (.pdb) file, also called a symbol file, maps the identifiers that you create in source code for classes, methods, and other code to the identifiers that are used in the compiled executables of your project. The .pdb file also maps the statements in the source code to the execution instructions in the executables. The debugger uses this information to determine two key pieces of information:

  • Name of the source file and line number to be displayed in the Visual Studio IDE
  • Location in the executable to stop at when you set a breakpoint

A symbol file also contains the original location of the source files, and optionally, the location of a source server where the source files can be retrieved from.

  • 2
    @downvoters: If you find this answer lacking or inaccurate (as it appears some people do, seeing the downvotes) please take the time to mention or describe the issues identified. This will help this answerer and future answers be more accurate and useful. – NirIzr Jul 27 '18 at 1:13
  • 1
    updated to include info why PDB is the answer here – Paweł Łukasik Jul 27 '18 at 5:30
  • I don't see a *.pdb :-( – Mawg Jul 31 '18 at 12:45
  • @Mawg pdb should be provided with the exe – Paweł Łukasik Jul 31 '18 at 14:11
  • 1
    @Mawg I’m pretty sure in case of gdb symbols are in the binary – Paweł Łukasik Jul 31 '18 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.