Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  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.

like image 883
durumdara Avatar asked Aug 22 '12 13:08

durumdara


People also ask

How do I stop debug mode?

To exit debug mode, press Alt+B followed by D. at the Command Prompt to exit debug mode.

What is remote debugging?

In simple terms, remote debugging is debugging an application that runs in a place other than your local environment. This is usually done by connecting the remotely running application with your development environment.

How do I debug in Delphi?

Debugging delphi source files You need to go to "project->options->compiler" on this tab you need to check the "use debug DCUs". After that you need to build your project again and you can run your application. From now on breakpoints also stop in Delphi source files.


3 Answers

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.

like image 58
az01 Avatar answered Oct 16 '22 15:10

az01


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.

like image 31
David Heffernan Avatar answered Oct 16 '22 15:10

David Heffernan


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

like image 33
durumdara Avatar answered Oct 16 '22 15:10

durumdara