5

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:

  1. I created a folder for it: "c:\D\Common\Delphi_Patches\Delphi_6\"
  2. I put the original Controls.pas into it.
  3. I modified the Controls.pas, replaced the position getter code.
  4. 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.

durumdara
  • 3,411
  • 4
  • 43
  • 71
  • 1
    Not sure if I get it right, but if you want to step into the `Controls.pas` while debugging, then go to `Project / Options` and there find something related to `Use debug .dcus`, save the options and re-build your project (not only compile, re-build). Then you'll be able to step into the system units. – TLama Aug 22 '12 at 13:33
  • 2
    @TLama, I think the issue is that `Use debug .dcus` is checked now, and the poster wants to stop stepping in. Of course, your comment is still right, but the solution is to **uncheck** the `Use debug .dcus` checkbox. :-) Poster: It helps when you tell us which Delphi version you're using in either the tags or in your text. – Ken White Aug 22 '12 at 13:46
  • @Ken, or the problem is with this setting persisting even for new projects (caused by [`Default`](http://i.imgur.com/EIINZ.jpg) check box). Hard to say... – TLama Aug 22 '12 at 13:59
  • 2
    Another possible issue is that VCL sources are became visible to the compiler (via Search Path) and recompiled each time you build a project. If so the solution is to edit Search Path parameter in the Compiler Options. – kludg Aug 22 '12 at 14:03
  • Or library paths, always mising in debug DCUs regardless the setting. He also could manage to modify some VCL sources during debugging, and now compiler rejects stock DCUs and recompiles all the dependent units. Happened to me :-) But methinks the most obvious thing - the forgotten checkbox - is the reason. @TLama - go post the answer to check it. You frequently put the answer in comments and not getting a tip. – Arioch 'The Aug 22 '12 at 14:08
  • 1
    Re: update - Put {$D-} on top of your modified controls.pas. – Sertac Akyuz Aug 23 '12 at 09:18

4 Answers4

8

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.

az01
  • 1,988
  • 13
  • 27
  • 1
    In Delphi XE8, this option is under "Delphi Compiler", select "Compiling", and expand "Debugging" on right tree. – rkawano Oct 29 '15 at 19:20
4

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.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • 1
    It appears that somehow answers and comments in this page does not reach to OP. Commented the same thing right after the question is updated, to no effect. – Sertac Akyuz Dec 26 '12 at 15:34
  • @SertacAkyuz Ah, indeed you did. I didn't see it because it was hidden (add/show 1 more comment). The accepted answer is pretty bizarre! – David Heffernan Dec 26 '12 at 15:39
2

As I see the solution is:

  1. create a project the uses only the new Controls.pas.

  2. unset the "Debug information" option in compiler options.

  3. build dcu

  4. put the dcu into a library folder

  5. hide the new Controls.pas from this library folders.

Wite this trick the I cannot "step into" controls.pas.

Regards: dd

durumdara
  • 3,411
  • 4
  • 43
  • 71
0

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>
Alfred767
  • 9
  • 3