2
votes

I have a project (newly started) where C++ Builder is not stopping at any of the breakpoints. I have ensured that I am in Debug mode (not release), Linker->Full Debug Information = True, C++ Compiler->Debug Configuration, C++ Compiler->Debugging->Debug Information = true, Debug Line Number Information = true, Expand Inline Functions = true.

I haven't messed with any compiler / linker settings for this project. And I've tried it with two different versions of the compiler but in both cases, the breakpoints don't break. I did try adding:
{ _asm { int 3 } } and when the program started, it hit it a few times so I know the code is being executed. (Besides, I placed a bunch of breakpoints all over the place and they don't work either.

Any ideas?

2
@UncaAlby: That is not the case with C++Builder, where the debugger is integrated into the IDE. - Ken White
Do you see a blue mark in the gutter (left side) of the code editor on the lines where you're setting the breakpoint? If not, it indicates code that will not be executed. - Ken White
@KenWhite in that case, disregard my comment. - UncaAlby
@KenWhite, there aren't any blue marks in the gutter. Only the line numbers and the line number hash marks. The breakpoint dots are red. - pollarda
There should be blue dots in the gutter for lines that do not have bookmarks set. If they're not there, then the compiler does not see them as lines where a breakpoint can be set. Have you tried doing a complete build of your project after making sure everything is configured for debugging? (Not just a compile, but a Project->Build?) - Ken White

2 Answers

0
votes

there are 2 reasons for this (beware the blue dots are visible only when your program is running!):

  1. Your code does not execute

    if you put breakpoint on stuff never executed it will never stop. Also some lines tend to be optimized out so sometimes help to disable optimizations while debugging.

  2. Your project file is messed up

    this happens time to time. What usually helps is:

    1. delete all temp files *.tds,*.map,*.obj*.exe in your project

    2. move the #pragma hdrstop line in infected file to different location

      usually you need to try more locations until it works ... mostly going down few lines even after all the includes.

    3. save all files and then compile & run

    If Blue dots appear on the left side of the code your project is repaired and you can move the #pragma hdrstopto its original location.

However sometimes nothing helps. In such case create a new project. That mimics your old (Form number and names) and then just copy the *.bdsproj file into your old one.

Its a good idea to backup your working project file as IDE tend to break it occasionally (its rare but it happens)

In case you got different compiler version use your file extentions (they changed them slightly)

0
votes

You forgot to mention which version you are using, but I'll guess it is an older one and your project is 64 bit. I have experienced this bug myself. They fixed it since, but the 64 bit C++ Builder debugger is still pretty much useless for larger projects (i.e. breakpoints work again, but the debugger crashes past the first breakpoint). Upgrade to 10.4 Update 1, just don't expect too much unless you work with small single thread projects.