Solved

Debug doesn't want to stop at a breakpoint

Posted on 1997-06-19
5
589 Views
Last Modified: 2010-05-18
I am working with delphi 2.0 for sometime now, and for no reason(as it appears to me) the debugger does not seem to function properly anymore!

Whenever I run my program in the delphi environment, it will only stop at the first breakpoint it encounters. Pressing F7 or F8 (step into or step over) gives the same result as F9 (run). The next time it passes the same breakpoint it won't stop.(I put one in the oncreate of a mdi child, and only at the first mdi I created the program stops, on all other created mdi childs, the program won't stop, as if the break (all the breaks by the way) has disappeared!) So debugging gets irritating.

If I load an other project (a demo one for instance) the debugger works fine.(it stop at every break I put into it) So I expect I did something wrong during the programming I did (which is just forms, dialogs, and straight forward programming, no low level things).

Has anyone encountered this as well, and if you did, how did you solve this problem?
0
Comment
Question by:ottokb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:StevenB
ID: 1337207
 Delphi does not generate executable code for every single line of code that you write. If you put a breakpoint on a line that is not converted into executable by the compiler, then the debugger will not stop at that line. When you place the breakpoint on such a line then it shows the same as other breakpoints, however when you compile it changes its appearance to indicate that it is not a valid breakpoint. In Delphi 3 there is an indicator in the left panel which shows which of your code lines are actually converted by the compiler, this eliminates the 'Guesswork' in breakpoint placement.
  If I'm correct and this is whats causing your problem then the best solution is to learn which lines always generate executable code and always put your breakpoints on these sort of lines. The best example of a line which always generates code is an assign statement such as : a := 12; or conditionals: if {..} then {..}. Lines to avoid are comments, begins and ends.

  Steven.
0
 

Author Comment

by:ottokb
ID: 1337208
Edited text of question
0
 

Author Comment

by:ottokb
ID: 1337209
Appearently the question led to a miscommunication, so I extended the question a bit.
0
 
LVL 12

Accepted Solution

by:
andrewjb earned 200 total points
ID: 1337210
First, the silly answers ...

Check that you haven't got optimisation on - it can confuse debugging.
Also, just make sure that you haven't got conditions set on your breakpoint to only stop the first time ...
Try deleting all the .DCU files everywhere and rebuilding the whole project.


And now the real solution ...


Delphi 1, and to some extent delphi 2 have problems with debugging when the project gets large. Breakpoints can be ignored; delphi will breakpoint where there was none set; breakpoints will only activate the first time etc. etc. I don't know why, but the problem appears to be to do with the total path length of all the units in your project! Although it is a pain to do, I'd sugggest you put all units into the same source directory, and give it a short name just off the root of the drive. e.g. put all source files in a directory call c:\Src\, rather than having a large ( useful! ) project source tree.
I didn't believe that this would help with my project, but I haven't had any problems since.

There doesn't appear to be any obvious point where a project starts failing. It isn't just the number of units, or size of code generated etc.

0
 
LVL 4

Expert Comment

by:StevenB
ID: 1337211
 While we're on the subject of breakpoints, there is a further bug in delphi 2 which you probably know about, but here it is for completeness. It occurs when you delete a line that has a breakpoint on it. The breakpoint seems to vanish, but infact it doesn't ,it moves to the next line and doesn't display itself. Your code subsequently breaks at this line despite the apparent absence of a breakpoint. The best solution here is to use the View|Breakpoints menu to clean up the mess. Apparently this bug is sorted in Delphi 3.

  Steven.
 
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Internet Explorer View Settings Question 15 122
code issue 8 181
Connection between libmysql.dll and MySQL Versions 7 119
firemonkey keyboard covers the controls 1 51
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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…

740 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