Avatar of shawn857
shawn857

asked on 

Debugger not stopping at breakpoints in Delphi 7

Hi, I'm working on a fairly small and uncomplicated project and when I try to debug and step through some code, some of the clear breakpoints I set get ignored. It's strange - *some* breakpoints I set get obeyed fine, but some other just don't. All the little dots are there next to each executable line, and they all seem to be in synch right down to the final "End." statement at the bottom.. but yet some breakpoints work and some don't... it's really maddening. Anyone ever wrestled with something like that before?

Thanks
    Shawn

P.S: It does this just for this particular project. When I work on my other projects, there's no problem with debugging.
Delphi

Avatar of undefined
Last Comment
shawn857
Avatar of shawn857
shawn857

ASKER

... can anyone help?

Thanks!
   Shawn
Avatar of jimyX
jimyX

What settings are you enabling/disabling under:
Project -> Options -> Compiler Tab -> Debugging Box?

For that particular uncomplicated project.
Avatar of jimyX
jimyX

Also note, sometime you need to Build your project "Project -> Build" in order to clear the old DCU's that were set for the debugger to use.
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

agree - always do build before get real debuging. Make sure that you're in debug mode as jimyX points, and make sure that optimization is disabled too.
Avatar of shawn857
shawn857

ASKER

Thanks for the replies guys.

Jimy - I've attached screenshots of my Project|Options settings for both the Compiler tab and the Linker tab. Yes, I always use Project | Build.

Sinisa - I usually have Optimization checked, and debug has always worked fine in my other projects. I disabled it for now to try it, but still no difference.

I don't know if this would affect the debugger, but I do have these compiler switches set at the top of my main unit:

  {$F+} { Force FAR calls }
  {$P-} { Turn open parameters OFF }
  {$V-} { Turn OFF strict string parameter checking }


... then further down in the Implementation section, these:

{$R *.DFM}
{ $X+ }

Thanks!
   Shawn
Compiler-settings.JPG
Linker-settings.JPG
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

none of them is a problem - maybe another switch somewhere else.
Look at this document and see for another hint we miss.

more on switches: Delphi_Compiler_Directives

how about another (newly created) project - can you debug it?
Avatar of shawn857
shawn857

ASKER

Thanks Sinisa, I'll have a look at that document you mentioned in more detail soon, I've been very busy.

Looked at my project more closely tonight and noticed that in the main unit (3697 lines), debugging of all routines is successful up to line 1737. Then from line 1738 and onwards, debugging does not work anywhere. Isn't that strange?
   Also, right at that Line 1737 "border", a procedure from the non-debuggable side calls a procedure in the debuggable side... debug works when stepping through the procedure in the debuggable side.
   A basic outline:

procedure a;   // debug works in 1st line of procedure
begin
.
.
.
end; // a

procedure b;   // debug works in 1st line of procedure
begin
.
.
.
end; // b

procedure c;   // debug works in 1st line of procedure
begin
.
.
.
end; // c


procedure d;   // debug DOESN'T work in 1st line of procedure
begin
.
<calls procedure c from here, debug in procedure c works!>
.
end; // d


// nothing from this point downward in debuggable


What do you think guys? Maybe there are some hidden control chars or something messing up my unit half-way through or something??

Thanks!
   Shawn
ASKER CERTIFIED SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of shawn857
shawn857

ASKER

Well, I solved this stumper. Stupidest problem I have ever had, and still don't know why it did this. What I did was cut out and pasted ALL my code from where the 1st procedure stopped working in debug (ie. "procedure d" in my example in my last post), saved that in a notepad file, commented out all declarations and references to any of this code I removed, then re-built. Then I re-introduced a few procedures at a time to my unit and uncommented out their declarations - always inserting them at the top of my unit and not the bottom. I'd test these additions in debug, then add a few more and repeat. Took some time, but finally I got the whole thing working. Very very stupid and unexplainable error! Please note that I didn't change my Project|Options settings in any way.

Thanks to all who tried to help!

Shawn
Delphi
Delphi

Delphi is the most powerful Object Pascal IDE and component library for cross-platform Native App Development with flexible Cloud services and broad IoT connectivity. It provides powerful VCL controls for Windows 10 and enables FMX development for Windows, Mac and Mobile. Delphi is your choice for ultrafast Enterprise Strong Development™. Look for increased memory for large projects, extended multi-monitor support, improved Object Inspector and much more. Delphi is 5x faster for development and deployment across multiple desktop, mobile, cloud and database platforms including 32-bit and 64-bit Windows 10.

60K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo