Solved

Debugger not stopping at breakpoints in Delphi 7

Posted on 2014-11-21
9
267 Views
Last Modified: 2014-12-02
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.
0
Comment
Question by:shawn857
  • 4
  • 3
  • 2
9 Comments
 

Author Comment

by:shawn857
ID: 40461549
... can anyone help?

Thanks!
   Shawn
0
 
LVL 24

Expert Comment

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

For that particular uncomplicated project.
0
 
LVL 24

Expert Comment

by:jimyX
ID: 40461949
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.
0
 
LVL 25

Expert Comment

by:Sinisa Vuk
ID: 40463052
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.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:shawn857
ID: 40463829
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
0
 
LVL 25

Expert Comment

by:Sinisa Vuk
ID: 40463915
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?
0
 

Author Comment

by:shawn857
ID: 40466181
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
0
 
LVL 25

Accepted Solution

by:
Sinisa Vuk earned 500 total points
ID: 40467631
Try to check Use debug DCUs in compiler settings and do full build. Your app may break or exit because of some internal exception to another place than you expect.
0
 

Author Comment

by:shawn857
ID: 40469907
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
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now