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

Debug not working

Posted on 2002-07-07
Last Modified: 2010-04-04
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?

Question by:aztec

Expert Comment

ID: 7137090

> ... 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

Expert Comment

ID: 7137403
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.

Author Comment

ID: 7139010
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...

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Accepted Solution

Cynna earned 50 total points
ID: 7139379

1. About CR/LF:
   Your symptoms don't indicate this problem, but unpaired LF in source
   creates all kind of strange behaviour in Delphi...so 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


Author Comment

ID: 7198522
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!

LVL 49

Expert Comment

ID: 8442156
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 http://www.cityofangels.com/Experts/Member.htm
For information on how to finalize questions, see: http://www.cityofangels.com/Experts/Closing.htm
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

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

856 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