Delphi 7 not able to debug using break points - delphi

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

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.

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.

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.

Go to menu Project | Options...
Go to Tab Compiler
check all flags in Debugging frame

Related

Delphi XE7: Debug points not appearing, Breakpoints not getting hit on debugging and CPU window opens up

On building my code i cannot see the debug points in the pages.Only the page which is open while building shows the debug points.Also, The breakpoint is not getting hit and CPU window is opening by default where debug is set. I searched for the same and found this following statement on Embarcadero page (http://docwiki.embarcadero.com/RADStudio/Tokyo/en/CPU_Windows_Index):
The CPU window also opens automatically whenever program execution stops at a location for which source code is unavailable. For example, the debugger cannot open the source file if you link a DLL (Windows) built with debug information but do not include its source file in your project, or if you place the source file in a directory not specified in your project.
I also tried following things:
When I create a new project, put a breakpoint, it hits (no CPU
window opens up in this case).
When I modify the original code (like just put ShowMessage('Hello World');) where debug point is not
hitting, message dialog appears but debug is not hitting.
I
uninstalled and installed XE7 again, but problem persists.
Tried
cleaning the project, but did not work.
Please help me in fixing this problem. Thanks in advance!
As i also had a lot of problems with getting my debugger to work, so i made myself a list of what has to be checked. So here are some things you could try:
use the "debug" buildconfiguration of your project, which should be configured like this
searchpath matches your actual sources
"local symbols" is true
"with debug dcus" is true
"debug-information" is debug-information
"optimization" is false
one time i also had to check "remote debugging symbols"
try to close the ide and reopen it with just one project
if you use devextension, go to devextensions options
under compilation -> check "release compiler unit cache of other projects before compiling"
under extended ide settings -> check "disable package cache"
in delphi options under "debugger options", "integrated debugging" has to be true
(but sometimes it helps to uncheck this, close the ide, reopen and check again)
I hope, this also helps you

XCode can't find symbols for a specific iOS library/framework project

I'm having a problem with breakpoints in the source code of a specific library / framework (new to Xcode - i'm not sure what the correct term is) in a fairly large iOS project. I have all the code for this library. Breakpoints are working fine everywhere else, but in this one specific library, all breakpoints are ignored.
I can put a breakpoint in a function called from within one of those source files, and it will trigger, but then the callstack shows "__lldb_unnamed_function" for the location in the file i'm interested in, as if the symbols have been stripped.
I have the following settings for the library in question
Generate Debug Symbols = YES
Strip Debug Symbols During Copy = NO
Strip Linked Product = NO
Dead Code Stripping = NO
I have been using a lot of #ifdefs to test alternate implementations of a few functions so i thought some stuff might be getting marked as dead code by accident (hence that last setting). I already tried clean/rebuild. I tried completely removing the app from the target iPhone. I tried deleting intermediate file folder under
/Library/Developer/Xcode/DerivedData
The code is definitely executing because all my NSLog calls show up properly.
I don't have much experience with Xcode so i'm hoping i'm just missing something simple
Thanks
Some part of your build process must be stripping this binary. If you were generating an unstripped binary with no debug information, then you would see full symbol names in backtraces and the like, you just wouldn't have debug information for them.
The only good way to figure out who is doing this is to look at the full build log in Xcode, and expand each of the stages and grub through all the build stages to figure out who is doing this. You expand the stages by hovering over each build line on the RHS and you'll get a disclosure dingus that looks like a bunch of lines on a page; click that to see the real commands.
Another way to finesse this may be to build the dSYM for this framework (by setting the Debug Format to "DWARF + dSYM".) That should get made before anything gets stripped, so unless whoever is stripping this is being awfully clever this should preserve the debug information.

C++ Builder (XE7) compile without linking?

Is it possible - only compile/make source in C++ Builder (XE7) without the long delay of linking?
If yes, is there a shortcut key for it?
It would be very useful when I just want to check if my code compiles at a point, but don't want to execute it.
mauroaraujo is right - since BCB4 or thereabouts the Project menu has an item that is misleadingly labelled 'Build ' + current source file. This compiles the current .cpp file (compiler switch -c). The item description in the documentation is a bit misleading as well.
The standard keyboard shortcut is Alt+F9 - the same as it always has been ever since the times of Turbo C/C++ (with the possible exception of some early C++Builder incarnations). The shortcut might change or disappear when certain editor key mappings are selected, though.
There seems to be no direct equivalent to 'Syntax check' item that becomes available in the Project menu when the current source is a .pas file, but for most practical purposes it should be close enough.
What the IDE doesn't seem to have is a command for compiling all sources without linking (sort of like a 'syntax check all sources'). However, you may be able to build a custom target where the link phase is configured to do nothing.

Delphi annoyances, "find declaration" often doesn't work

Been having this with most Delphi versions over the years, so I'm wondering if maybe it's just something wrong with my code or is this the expected behavior from the IDE..
Normally when you place the cursor over a procedure/function/variable etc you can press Alt+Up and it goes to wherever it was declared whether in the same unit or in separate ones, just like if you right-click and pick "Find Declaration", but very often this doesn't work, even if when you hover the mouse over and after a second it tells you like.. "Declared in xx.pas", but it still won't go there. Even if I type unitname.proc and try on the proc, it still doesn't jump to the proc. If I open the unit (ctrl+enter over the unit) first once, even if I close it afterwards, then it works.
Is there any reason why this happens?
This happens because the related systems are driven by their own special parser that's different from the one in the compiler, and it's been very buggy and poorly maintained for years now. It's been a known issue for a long time, but it's apparently pretty low-priority for the folks at Embarcadero.
Go to "Project">"Options...">"Compiler".
Here tick the following boxes:
"Debug information"
"Local symbols"
"Reference info"
Press "OK".
Restart Delphi.
This is solved the problem in my case (Delphi 7).
Good luck
I ran into this problem with the latest (as of 5/2/16) version of RadStudio (RadStudio/Delphi Berlin).
My settings, more or less, already matched those suggested by tcxbalage.
Here's the RadStudio Berlin equivalent:
Project | Option... | Delphi Compiler | Compiling | Debugging:
Local symbols: true
Symbol reference info: Reference info
Here's what I did that got the "Find Declaration" support working correctly:
1) I changed
Symbol reference info
to "Definitions Only".
2) Pressed "OK".
3) Reopened Project | Options and change "Symbol reference info" back to "Reference info". Pressed "OK".
4) Rebuilt my project.
Hope this helps anybody else who runs into the same problem.
Do you have set an output path for compiled units that contains an environment variable? That's what made CTRL+Click stop working for me.
I also encountered such a problem after switching to C++ Builder 10.4. Changing the "Use 'Classic' Borland compiler" setting to "true" helped me.

How do I stop the debugger from stepping into Delphi-supplied units?

The debugger steps into the source code on errors (like with F7), but I want to restore the normal working mode where the Delphi basic DCUs (the library) are only compiled into my code, and the sources are not used in debugging.
For example, on an error in my program, the debugger is stepping into Controls.pas, into TControl.Click. The normal case (right after installation) is for Delphi to step over these methods.
Should I recompile Controls.pas without debug information? If so, how?
I extending this theme with additional information to better understanding:
We use Delphi6 Prof. what have problem with Mouse (System Error Code 5).
So we want to recompile to Controls.pas to replace the Mouse Position getter code.
Then:
I created a folder for it: "c:\D\Common\Delphi_Patches\Delphi_6\"
I put the original Controls.pas into it.
I modified the Controls.pas, replaced the position getter code.
I set the Delphi's Library path, set the first folder to "c:\D\Common\Delphi_Patches\Delphi_6\"
With these steps I can compiled the source with mouse-safe code.
Ok, but then the Delphi everytime steps into Controls.pas on F7, and on any exceptions - this is very "angermaker" thing.
No matter that I removed the "Controls.pas" from the Library path - then the debugger is finding the original "Controls.pas" for it, and opens it... :-(
We don't use "Use Debug DCU-s" in any codes.
I tried to remove "Debug Information" from compiler options, but it is no matter, the Delphi is opens the original Controls.pas...
So I search the way to Delphi don't step into "Controls.pas", but use my dcu...
I hope this provide better context to understand the problem.
I think that you need to Shift+Ctrl+F11 (tools/options) then in Compiler, uncheck "Use debug DCU"...Then if an exception occurs it wont break into the RTL or VCL sources.
Since you are compiling your own version of a Delphi unit, you can disable debug info in that unit. Add {$D-} to the source code of the unit(s) in question.
As I see the solution is:
create a project the uses only the new Controls.pas.
unset the "Debug information" option in compiler options.
build dcu
put the dcu into a library folder
hide the new Controls.pas from this library folders.
Wite this trick the I cannot "step into" controls.pas.
Regards: dd
I had this same problem with Delphi XE8.
You can untick the "Project >> Option >> Compiling >> Use debug .dcus" and it will continue tracing into System unit and so on.
I found that the best way to stop this is to open your Application.dproj file - which is in XML. In it, you can change the settings as follows:
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<DCC_AssertionsAtRuntime>false</DCC_AssertionsAtRuntime> <--- note false
<DCC_DebugDCUs>false</DCC_DebugDCUs>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<DCC_RemoteDebug>false</DCC_RemoteDebug>
</PropertyGroup>

Resources