NO

Author Topic: Debugger won't stop at breakpoint  (Read 4296 times)

docmccarthy

  • Guest
Debugger won't stop at breakpoint
« on: October 23, 2012, 10:39:32 PM »
Hi,
    I set a breakpoint and also have set the Full in Compiler and CodeView and COFF in the Linker.  Then I clicked on the Go Debug and it races through the entire program without stopping at any of the breakpoints.  Thanks in advance for your help.
« Last Edit: October 24, 2012, 01:45:39 AM by docmccarthy »

CommonTater

  • Guest
Re: Debugger won't stop at breakpoint
« Reply #1 on: October 24, 2012, 01:53:12 AM »
Is this a 32 or a 64 bit project?

For 32 bit ... Full in Compiler, Codeview and Coff in linker.
for 64 bit ... Full in Compiler, Codeview in linker.

It's not manditory... but when switching to debug, I always do a rebuild first Project -> Rebuild <project name> just to be sure it compiles and links cleanly.

Also watch your message area when the program is starting.  You may get a message something like "Unable to set breakpoint...".  When you return to the source the breakpoint will no longer be a ball; it will be a circle.  In that case adjust your breakpoint up or down a couple of lines. 
« Last Edit: October 24, 2012, 01:55:37 AM by CommonTater »

docmccarthy

  • Guest
Re: Debugger won't stop at breakpoint
« Reply #2 on: October 24, 2012, 03:01:11 AM »
It's 32 bit and set to Codeview and COFF in the linker, Full in the compiler.  The little red ball is solid.  I built it first the usual way and then noticed I could not set breakpoints with the straight build.  So, I clicked on the Go/Debug and it allowed the breakpoints to be set.  Then, clicking on Go/Debug again, it flew through the program without stoping at the breakpoints.  I also put a number of breakpoints in but that did not wake up the debugger.  Thanks again for your help.

docmccarthy

  • Guest
Re: Debugger won't stop at breakpoint
« Reply #3 on: October 24, 2012, 05:33:15 AM »
If I build a perfectly running program (no errors), without the debugging routine turned on, I get a dialogue box that says I need to turn on the debugger by putting Full in Compile and CodeView and COFF in the Linker.  Then, when I click on the Go/Debug it turns main pink.  I can set a breakpoint and it will stop there.  But, if I put an error in the program, say by just eliminating a semi-colon, it won't stop at the breakpoint - just runs through the Go/Bug from beginning to end.  So, it seems like the debugger only works when the program is working perfectly!  Has anyone run into this and what is the work around.  I have read everything and found nothing that addresses this.  Thanks.

CommonTater

  • Guest
Re: Debugger won't stop at breakpoint
« Reply #4 on: October 24, 2012, 06:06:55 AM »
Yep ... that's correct.  You can't debug a program that won't compile. 
 
Most blatent errors are caught by the compiler and linker.  The debugger is for that wonderful case where you are proving that: "Compiles" does not mean "Works".  Most misbehaviour is obvious, you see a wrong result and fix your source then recompile ... The debugger is for tracking down elusive problems in mostly functional code.  It's of no value in code that won't compile and link correctly.
 
In your project options set your warning level to 2 and treat each warning as an error to be fixed. Then once you have an error free build with as few warnings as possible, you can try the debugger...
 
Also you are not setting your breakpoints in the best manner...
 
In the IDE click Source -> View Line Numbers (you probably want that on anyway)
 
Make your projects with File -> New -> Project (i.e. "the usual way") and add your sources to the project with CTRL-N.
 
Then before running the program, set your breakpoints by clicking on the line numbers. Clicking toggles them on and off.  That way they will persist between runs.
 
Then set the debugging options as I explained ... and click Go-Debug.
 
 
 
« Last Edit: October 24, 2012, 07:41:45 AM by CommonTater »

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: Debugger won't stop at breakpoint
« Reply #5 on: October 24, 2012, 07:53:47 AM »
Also, in danger of stating the obvious, you need to make sure that you set the breakpoint at a code line that is for sure being passed.
Happened to me more than once that I had a logical flow error in a program and I just didn't pass at a breakpoint to begin with.

And if case your program consists of multiple source (and hence object files), make sure you rebuild the whole project with full debugging info...

Ralf

docmccarthy

  • Guest
Re: Debugger won't stop at breakpoint
« Reply #6 on: October 24, 2012, 08:09:27 PM »
Thank a lot.  I really appreciate it.  It's been a long time since I have programmed and had forgotten this important detail.

Offline Bitbeisser

  • Global Moderator
  • Member
  • *****
  • Posts: 772
Re: Debugger won't stop at breakpoint
« Reply #7 on: October 25, 2012, 01:19:24 AM »
Thank a lot.  I really appreciate it.  It's been a long time since I have programmed and had forgotten this important detail.
And what detail would that have been? it might help others in the same situation, so they know what to look out for...

Ralf