Can't use breakpoints in my application

Started by
7 comments, last by m4gnus 18 years, 9 months ago
Hi I'm trying to debug my application because after adding new code it doesn't start properly (the window frame appears but it doesn't react). I thought i could just add some breakpoints to look where the application crashes but when i add one and press debug there's just a question mark inside my breakpoint and my app still crashes. I tried putting the breakpoint directly at the start of winmain but that didn't change anything... I'm using Visual C++ 2003. My debugger worked until now. How can i solve this problem? regards, m4gnus
"There are 10 types of people in the world... those who understand binary and those who don't."
Advertisement
Hi,
try to add the compiler flag -g, this could work....
If there is a question mark on the breakpoint, it means the compiler can't find the associated code for the line you are attempting to break on. Either there is no code, or the compiler can't work out what the associated code is (you're missing your debugging database for that program probably).

Check:
- You're actually breaking on code - try breaking on lines around where you are setting breakpoints
- You're compiling in Debug mode, and not in Release mode.
- You are generating a PDB file when you compile (it should be in with your exe file).
Quote:Original post by m4gnus
My debugger worked until now.


In that case, I think it could be borked in some way. Does it do this with every program, or just the one you're working on just now?

I'd say that reinstallation of VC++, although possibly a last resort, could be the way forward here.

it works with my maya exporter(a dll) and i reinstalled Vc++ last week on a completly new windows so i don't want to install again. I compile in debug mode and there are 2 pdb files(vc60.pdb, vc70.pdb).

hmm i never added compiler directions by hand...i don't even know where.

regards,
m4gnus
"There are 10 types of people in the world... those who understand binary and those who don't."
Quote:Original post by Andrew Russell
If there is a question mark on the breakpoint, it means the compiler can't find the associated code for the line you are attempting to break on. Either there is no code, or the compiler can't work out what the associated code is (you're missing your debugging database for that program probably).

Check:
- You're actually breaking on code - try breaking on lines around where you are setting breakpoints
- You're compiling in Debug mode, and not in Release mode.
- You are generating a PDB file when you compile (it should be in with your exe file).


I would agree with these suggestions. Additionally, you might want to do a clean and rebuild all and failing that, try exiting and restarting visual studio or even rebooting. I've had it get stuck before like that. When I get the ?'s, it's usually because I'm in release mode. However, I've also tried setting breakpoints in code that is not compiled due to some #ifdef that isn't set. That will give you a nice ? as well.
This also happens if you put a breakpoint in a file that isn't part of the project. e.g. if you duplicate the project but open the files from the other copy in the IDE and put breakpoints in them. It will give you a red circled question mark.
Close all the files and open them via the solution pane, not by dragging them into the main window. That way you can be sure the breakpoint is in the correct file.

This happens all the time for the debugging I do, as that code is often in a dynamically loaded dll and when it loads that dll, the breakpoint goes to a solid circle.
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms
Quote:Original post by Andrew Russell
...
Check:
- You're actually breaking on code - try breaking on lines around where you are setting breakpoints
- You're compiling in Debug mode, and not in Release mode.
- You are generating a PDB file when you compile (it should be in with your exe file).


1.I'm breaking on the first line of code in the winMain function.
2. Yes i'm compiling...at least the text box at the top of the VC++ windows says debug...
3.Yeah there are 2 pdb files: vc60.pdb (i compiled the project with VC++ 6.0 before i switched to VC++ .net 2003 i think this pdb is created by VC++ 6.0)
and vc70.pdb (this is the pdb file from VC++ .net 2003, right?)

So what can i do now? Where can i enter that -g flag? that would be the last suggestion made in this thread that i didn't try...or did i miss something?

Edit: btw i forgot to mention: with other projects it also didn't work properly...in my maya exporter i can set breakpoints but i can't look at the values of variable watches...it always said something like "<Variable>" not found though it is defined in the same code block.



regards,
m4gnus

[Edited by - m4gnus on July 15, 2005 12:16:11 PM]
"There are 10 types of people in the world... those who understand binary and those who don't."
hmm i added the -g flag at additional options but the compiler doesn't know that flag...
ps:edited my last post...


Edit: Problem solved i needed to turn debugging on somwhere in the options...dunno why it has been turned off.


regards,
m4gnus
"There are 10 types of people in the world... those who understand binary and those who don't."

This topic is closed to new replies.

Advertisement