Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug Delphi IDE?

What are the detailed steps on how to debug the Delphi IDE?

I understand, from other posts, that one needs to create a project and, in the project's debugger settings, set the project's "host application" to Delphi (C:\Program Files\Borland\BDS\3.0\Bin\bds.exe). Then, when the project is run in the debugger (by pressing the F9 key), a second instance of the Delphi IDE should appear.

I have managed to do the above step. However, when I run the project in debugger mode, I don't see any second instance of the Delphi IDE opening.

Motivation

There is a VCL component, for which I do have the source code, that builds, compiles and installs fine. But, when it is placed on a form in a project, Delphi hangs when you close the form. So, I want to find out why Delphi is freezing on exit with this component on a form. (It hangs at design-time, when closing the project).

like image 782
user1202134 Avatar asked Mar 10 '12 04:03

user1202134


People also ask

How do I Debug Delphi code?

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.

How does an IDE Debug code?

The debugger component of an IDE typically provides the programmer with the capability to view memory and see variables, run the program to the next breakpoint, execute just the next line of code, and, in some cases, change the value of variables or even change the contents of the line of code about to be executed.

How do I run debug mode?

Run the program in debug modeClick the Run icon in the gutter, then select Modify Run Configuration. Enter arguments in the Program arguments field. Click the Run button near the main method. From the menu, select Debug.


1 Answers

Your project is most likely an EXE-type. EXE type projects don't need host applications so the setting is ignored, no other IDE is started. At a minimum, you should make your project a DLL-type: that will start the second IDE, but it will not be very helpful.

The technique you mentioned is usually used to debug your design time package projects. Create a design-time package project, install it into the IDE, set the project's host application to be the IDE, set some breakpoints, hit F9 and a second copy of Delphi will start.

You can also "debug" the Delphi IDE by manually starting a second copy yourself and then using the "Attach to process" command from the "Run" menu, but that's not going to be very useful since you can't easily find your code to set a breakpoint.

like image 75
Cosmin Prund Avatar answered Sep 29 '22 07:09

Cosmin Prund