C++ Builder not stopping on breakpoints

Viewed 529

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?

4 Answers

I get the same error or something very similar. To detail what happens for me, I start my project in debug mode, the program seems to stop at the breakpoint but it's a crash of the app (independently of breakpoint position). During the execution of the program, I have no blue dots in any line of my code. I'm working with C++ builder 10.4 and using Windows 64 bits.

The solution that I used is to compile again my whole project. I'm not able to reproduce the error so I can't say if it's a solution or just a lucky shot.

Another point, before this bug my project has already been started successfully in debug mode. The bug appears at times and seems random. I can get this error without changing any line or project option.

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)

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.

Have you chosen the debug config in the project manager as it is shown in the picture attached?

enter image description here

Related