By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,881 Members | 1,427 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,881 IT Pros & Developers. It's quick & easy.

Can't debug DLL

P: n/a
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
Nov 7 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Dave Cullen wrote:
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.
The usual problem is the existence of more than one DLL you built. Make
sure that what you build is either explicitly copied along with the PDB
file to the directory where you start your EXE, and do it every time you
rebuild, or, which is a bit easier IMO, tell the application/system
where to find your DLL by putting the path with the DLL you build in the
system 'PATH' variable.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Nov 7 '08 #2

P: n/a
"Dave Cullen" wrote:
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
Nov 8 '08 #3

P: n/a
"Dave Cullen" <no****@mail.comkirjutas:
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.
This shows that the source you edited does no longer match to the DLL the
process is loading. Either the build failed (e.g. the existing DLL could
not be replaced because it was in use by the previously running process),
or the process is loading another out-dated DLL from somewhere else.

Rebuild the DLL, ensure this succeeds, and ensure that this is actually the
one what gets loaded (there is a Modules window available in the VStudio).

hth
Paavo

Nov 8 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.