Solved

Debug not working

Posted on 2002-07-07
6
267 Views
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?

Thanks
   Shawn
0
Comment
Question by:aztec
6 Comments
 
LVL 7

Expert Comment

by:Cynna
Comment Utility
aztec,

> ... 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
0
 
LVL 8

Expert Comment

by:TOndrej
Comment Utility
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.
0
 

Author Comment

by:aztec
Comment Utility
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...

Shawn
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 7

Accepted Solution

by:
Cynna earned 50 total points
Comment Utility
aztec,

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.

                             OR

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.

                             OR

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

0
 

Author Comment

by:aztec
Comment Utility
I think I have isolated the problem....things debug fine up until a certain line in my code. That line is:

fromfile.Destroy;

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!

Thanks
   Shawn
0
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
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
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
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…

728 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