Attaching to Process Issue
In VS 2010, I attached my source code to a process开发者_运维技巧 for debugging purposes. I set a breakpoint to a line that my log4net log said was failing.
When I set the breakpoint, started and attached to the process, the breakpoint showed up as clear. When I hovered over the breakpoint, a warning said that my breakpoint wouldn't get hit because that particular symbol wasn't loaded.
I don't understand how I could've chosen the wrong source file to set a breakpoint. I got it directly from the log, which gave an absolute path of the file and line where my code failed.
Please advise me.
Thx
clear bp means that the source code you're looking at is not being executed. we know this for a fact.
so a) you attached the wrong source code b) your source code is out of date or otherwise doesn't precisely match the binary c) if you have a prebuilt binary that you're linking against (a dll or a .lib) probably you need to download official "debug symbols" -- because a "release" binary does not include enough information to correlate it with source code. if these aren't provided you may need to rebuild the 3rd party library from source code yourself so you can make a debug build.
haven't done visual studio in a while, so this might be a bit off.
I don't understand how I could've chosen the wrong source file to set a breakpoint. I got it directly from the log, which gave an absolute path of the file and line where my code failed
You haven't chosen the wrong source file (most likely). The problem is Visual Studio needs more than that to hit the breakpoint you've set - it needs the pdb files that were hopefully created when you compiled the application you are debugging - Do you have these files? Did you compile in Debug or Release mode?
Bring up the modules windows (Debug -> Windows -> Modules) and look for your dll/exe. Right click on that and choose 'Symbol Load Information'. Whats that say?
精彩评论