Delphi 7 i am not able to debug my application as half the code in my delphi 7 form unit,as it is not showing blue dots on the left hand side gutter,not able to reach any of the break points when i run my application..
-
Please add a screenshot or something more.Envil– Envil2015-07-04 10:34:25 +00:00Commented Jul 4, 2015 at 10:34
-
Working fine here. What's different about your scenario?David Heffernan– David Heffernan2015-07-04 10:51:09 +00:00Commented Jul 4, 2015 at 10:51
-
If you add breakpoints from breakpoint manager - do they work? Have you checked a files for CRLF bug?Sega-Zero– Sega-Zero2015-07-04 11:03:40 +00:00Commented Jul 4, 2015 at 11:03
-
1You might try deleting (or renaming, if you are worried) the dsk file for the project and then reload the project.500 - Internal Server Error– 500 - Internal Server Error2015-07-04 11:18:23 +00:00Commented Jul 4, 2015 at 11:18
-
1Are you saying that some lines of code have blue dots, but some do not? If that's the case, this indicates that the code without dots cannot be reached, and the linker has removed it from the executable. For example, if you have a method, but that method is never called.David Dubois– David Dubois2015-07-04 13:12:57 +00:00Commented Jul 4, 2015 at 13:12
4 Answers
The way you explain it - if one unit has some breakpoints available, but others not, then it sounds like that code is unreachable / unused. The Delphi compiler is smart enough to the point where it does not compile any code which it detects is never used. And if it doesn't compile, then there is no way to use breakpoints there.
1 Comment
This is sort of a workaround but it works.
- Build your app;
- Delete the exe file generated just to be sure it will be created again;
- Select all your code and paste it into notepad;
- Save your "Blank" file into Delphi;
- Select all the text from notepad;
- Paste it again into Delphi file and save it;
- Build your app again;
I had this same problem with a special character pasted into my source code.
If after doing this you still can´t compile just paste your code for us to review it.
Comments
Not sure if this is the problem, but Optimisation is turned on by default. The compiler could be removing code. When you debug, can see the code in the editor, but the breakpoint won't hit the lines that have been optimised out.
You can turn off optimisation in Project Options > Compiler > Optimization, but a better technique is:
* Project Options > Directories/Conditionals
* In the Conditional defines box, add "DEBUG" and click Ok
* Return and add "NDEBUG" and click Ok
* Now at the top of the file which you want to debug add this code:
{$IF Defined(DEBUG)}
{$O-} // Debug build
{$ELSEIF Defined(NDEBUG)}
{$O+} // Non-debug (ie. release) build
{$IFEND}
Then you can simply define the type of build as "DEBUG" when you want to debug. Set as "NDEBUG" just before release. Not sure if its your problem, but hope that helps.