Can't debug DLL

  • Thread starter Thread starter Dave Cullen
  • Start date Start date
D

Dave Cullen

It seems I have fallen victim to some strange behavior in VS2005 where it
refuses to allow breakpoints to be hit during debug in my dll project. The
breakpoint ball says, "breakpoint will not currently be hit. no symbols have
been loaded for this document". The modules window says symbols for the dll
aren't loaded and when I try to load them I get an error that says the
module and pdb file don't match.

The strangest part is that the debug worked the first time I tried it. I set
a breakpoint in the source, invoked Run with F5, chose the .exe that calls
the dll, and the breakpoint was hit. I then did an edit and build on the dll
and the next run showed that the breakpoint would no longer be hit.

Searching the web reveals thousands of hits on the subject, and the forums
list various "solutions" that I've tried to no avail. Does anybody actually
know why this happens, and if there's a real fix for it? Not being able to
set breakpoints is a real drag.

Thanks
 
Dave Cullen said:
Does anybody actually know why this happens, and if there's a
real fix for it? Not being able to set breakpoints is a real
drag.

It happens because the debugger decides that PDB doesn't match
corresponding DLL/EXE. Sometimes the following helps:

Go to Tools -> Options -> Debugging category -> General and there
uncheck the "Require source files to exactly match the original
version" check box.

Sometimes I set a breakpoint in the disassembly window and get to
the breakpoint, then suddenly debugger can match the sources.

I'm not 100% sure what to be blamed for this. I suspect that there
may be little discrepancy between PDB date and DLL/EXE date that
confuses the debugger. Also, having two DLL modules available to
EXE can be a cause, as Victor already said. Try do disable
antivirus software to see what happens. Some antiviruses can slow
down disk I/O, so file times can get out of sync.

HTH
Alex
 
Back
Top