Debug not working

Hi, all of a sudden for some reason, I can't debug anything. I compile my program as usual, and the little dots go to the left of the executable lines of code, that's fine. So I click a dot to set a breakpoint, which turns the line red, as normal. But when I run my program, it flies right past the breakpoint without stopping! I'm using D6, enterprise version, trial.

Any thoughts?

Who is Participating?

Improve company productivity with a Business Account.Sign Up

CynnaConnect With a Mentor Commented:

1. About CR/LF:
   Your symptoms don't indicate this problem, but unpaired LF in source
   creates all kind of strange behaviour in you should check it
   just in case.
   One easy trick to find out if your lines are properly terminated is to
   open source from Notepad, which can't translate LF to CR/LF. If you see any black           rectangles where CR/LF should be, then you got your bug...
   If you have large number of these, I think WordPad can automatically translate it
   to the correct pair. In that case, all you have to do is open your "contaminated"
   file from WordPad, and than save it without any change. You can check if it
   is "cleared" by opening it with NotePad again.

2. Other options are much more likely the cause of your problem.

   Try this little test:
   - place breakpoints in *all* your units.
   - F9
   - write down unit(s) that produce this problem
   I think that you should have this behaviour only in some units.
   Even more probably only one unit.
   If this is the case:

a) You should check for exact location of the suspicious files, and
   delete any  of theirs *.dcu. I know you said you deleted all *.dcu files,
   but check again if any of your units is used outside project folder.
   It's easy to make this mistake, since Delphi doesn't show you the full
   unit path. Exact unit locations are stated in editor window caption.


b) If this doesn't work, you probably have some old unit version somewhere
   else in search path, and linker is using this one instead of the one
   you are editing. In this case, search for files on your HDD with the
   same name (not extension) as problematic unit. If you find more than
   one copy of them, delete or move all copies except the one you are using.
   This way you are certain only one is used. Alternative is to rename it
   to some unique name, and use this in your project.


c) If a) and b) doesn't help, then I can only suggest "atomic-bomb approach":
    - start new project in a new folder
    - copy *ONLY* relevant source (*.pas and *.dfm) files to this folder
    - rename problematic ones with unique names
    - add all units to your new project


> ... I can't debug anything

Anything as "anything in my current app" or "any project at all" ?

If your answer is "only my current app" then try this:

1) delete any *.dcu, *.dsm, *.exe file in your project folder

2) Be sure *all* lines in your source files are terminated properly (CR/LF), especially if you copy/pasted some parts of the code from somewhere other then Delphi editor

3) Turn all debugging related options in your Project->Options->Compiler tab on

4) Recompile your app
In addition to Cynna's advice:

If the breakpoint remains valid during execution (the line is still red) then it's possible that execution never reaches the line.
Sometimes it's as simple as this...

Another idea:
Make sure you have 'Integrated debugging' option turned on in Tools\Debugger options dialog.
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

aztecAuthor Commented:
Hello Cynna..
   I tried another of my apps (a small one) and the debugging worked fine within that on. It is just within this app that it doesn't. And get this: My app uses several different screens or tabs. Debugging will work fine in one tab/screen, but won't in another tab/screen!
  I followed your suggestions above (1) (3) and (4). For (2), I don't know how to check if there's a CR/LF at the end of each line. Just rename my .pas file to .txt and open in up in NotePad perhaps?

TOndrej: Yes, I am sure that execution reaches this point, but it still blows right by my breakpoint. And yes, "Integrated Debugging" was turned on.

Here's something else that's weird that might help you - you know how when you build your project, it puts all the little dots to the left of each line of executable code? OK, it does that all right, but when I do an F12 to show my form, and I go to another tab/screen via the Object Inspector, then double click on a button on that specific form (which takes me to that event handler), then all the dots on the left are gone... all the way down through my app's code!

Something very weird going on here...

aztecAuthor Commented:
I think I have isolated the problem....things debug fine up until a certain line in my code. That line is:


I am using a 3rd party component called TGPHugeFile, suggested to me by another expert. The component itself seems to be working ok, but it seems to be messing up the debugging. In the procedure containing this ine, I open up a TGPHugeFile like so:

fromfile:=TGpHugeFileStream.Create(infilestr, accRead);

...then I read from it like so:

ibytesOK:=fromfile.Read(buf, bigchunksize);

then finally I close it up with the fromfile.destroy statement as mentioned above. Everything debugs fine until I hit this Destroy statement.

I can step while in debug, right up to this line, when I try to step OVER it, it will go into code of the GPHugeF unit....and from there on, I lose debugging control over my project.

Hope someone can help!

Hi aztec,
Experts-Exchange is performing an automated process to delete old questions.  There have been no responses to this question, so it will be DELETED within 3 days.

Your points will be refunded.

If you still need the answer to this question, you should ask it again, as a new question.  Your new question will appear at the top of the list, where many Experts will see it and respond.  Here are some general tips on getting Experts to work on your questions:
1) Offer a high point level.  Experts often concentrate on higher-valued questions.
2) Choose the best Topic Area -- target the experts who have the specific skills that you need.
3) Include keywords in the Question Title that will attract the right Experts.
4) Provide FULL DETAILS in the question body so the Experts can get right to work on a solution.
5) When an Expert does make a comment, be sure to be responsive.

For more information on Asking Questions, see
For information on how to finalize questions, see:
Please DO NOT respond to this automated post.  DO NOT ACCEPT THIS COMMENT AS AN ANSWER.  Thank you for participating at Experts-Exchange.

CleanupGuy -- EE database cleanup volunteer
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.