Reputation: 9479
How do I step through the source code of a DLL that is loaded on the fly? I have a SLN that was automatically created by loading a BIN file into Visual Studio 2008. It uses a command line interface feature and on this command line, I can give a command to load a DLL. The DLL I load has been built from source code. So I should be able to step through this source code.
Do I need to somehow load mdb or somehow tell the Integrated Development Environment how to handle the source code? Currently, I cannot put any breakpoints in the source code.
Upvotes: 3
Views: 5606
Reputation: 177406
If a DLL is loaded dynamically (via LoadLibrary in C++, for example), the symbols aren't loaded until the DLL is loaded. Break after the call that loads the DLL, then load up the DLL source and set breakpoints in it. You will see a message in the Output pane of Visual Studio when the symbols for the DLL are loaded.
You can also debug the DLL solution by specifying the EXE that will load the DLL in the debugger options. Then Visual Studio will know that the EXE is likely to load the DLL and load the symbols in advance.
Upvotes: 2
Reputation: 1346
If you build this dll, then you should be able to build debugging symbols, and point the debugger to these files
You have to make sure that the pdb files are built against the exact same binary that is loaded, otherwise the symbols won't be found as they don't match.
Upvotes: 6
Reputation: 41374
You probably need to tell MSVC where to find the PDB files for those DLLs. The PDBs are what allows the debugger to look up which line of source code goes with which byte of assembly.
Look under Tools->Options->Debugging->Symbols, and try adding the directory in which your PDBs are located to the dialog there.
Upvotes: 1
Reputation: 1989
If the DLL is already in the GAC, then your breakpoint may not work. You might have to remove the remove the reference from GAC and try.
did you check this? http://msdn.microsoft.com/en-us/library/c91k1xcf%28v=vs.80%29.aspx
Upvotes: 0