Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2024-04

Stepping into the LCL with fpdebug

12 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luca Olivetti

Hello,

up until now I used gdb with -gl and, if in the project options I selected -gl, I could step inside the LCL.

For the rtl/fcl I compile fpc this way

make clean install OPT=-g INSTALL_PREFIX=d:\pp-debug

and I specify the resulting compiler in Lazarus' tools->options.

Now I'm switching to fpdebug, it needs -gw3 but I cannot step into the LCL.

I compile fpc with

make clean install OPT=-gw3 INSTALL_PREFIX=d:\pp-fpdebug

(different path so I can keep the two versions) and I can step inside the rtl, just not inside the LCL.

Since the packages are automatically built when I build the project, I think they should pick the -gw3 setting, shouldn't they?

I thought that the problem was the "Use external debug symbols file (-Xg)" but even without that option I cannot step inside the LCL.

Bye

Luca Olivetti Wetron Automation Technology https://wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email

Mattias Gaertner
to Luca Olivetti
Luca Olivetti wrote 8 lines
[...] make clean install OPT=-gw3 INSTALL_PREFIX=d:\pp-fpdebug (different path so I can keep the two versions) and I can step inside the rtl, just not inside the LCL. Since the packages are automatically built when I build the project, I think they should pick the -gw3 setting, shouldn't they?

First of all, the fpc release units have no debug information, so normally there is nothing to pick.

But if they have it would be super useful to have a setting "use the debug setting of the system unit", but there is not.

You can add the -gw3 flag depending on build mode: https://wiki.lazarus.freepascal.org/IDE_Window:_Compiler_Options#Add_a_flag_to_project_and_all_packages

I thought that the problem was the "Use external debug symbols file (-Xg)" but even without that option I cannot step inside the LCL.

Mattias

Reply by email

Luca Olivetti
to Mattias Gaertner

El 22/4/24 a les 10:10, Mattias Gaertner via lazarus ha escrit:

Show quoted text 14 lines
On 22.04.24 09:54, Luca Olivetti via lazarus wrote: > [...] > make clean install OPT=-gw3 INSTALL_PREFIX=d:\pp-fpdebug > > (different path so I can keep the two versions) and I can step inside > the rtl, just not inside the LCL. > > Since the packages are automatically built when I build the project, I > think they should pick the -gw3 setting, shouldn't they? First of all, the fpc release units have no debug information, so normally there is nothing to pick.

I have no problem with rtl/fcl units, as I explained, I compile them with debug info (either -gl or -gw3) and I can step into them.

Show quoted text 6 lines
But if they have it would be super useful to have a setting "use the debug setting of the system unit", but there is not. You can add the -gw3 flag depending on build mode: https://wiki.lazarus.freepascal.org/IDE_Window:_Compiler_Options#Add_a_flag_to_project_and_all_packages

Then why I can step into the LCL with gdb and -gl? I'm already using the additions and overrides but I don't currently specify any debug option there.

Bye

Luca Olivetti Wetron Automation Technology https://wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email

Martin Frb
to Luca Olivetti
Luca Olivetti wrote 11 lines
> But if they have it would be super useful to have a setting "use the > debug setting of the system unit", but there is not. > > You can add the -gw3 flag depending on build mode: > https://wiki.lazarus.freepascal.org/IDE_Window:_Compiler_Options#Add_a_flag_to_project_and_all_packages > Then why I can step into the LCL with gdb and -gl? I'm already using the additions and overrides but I don't currently specify any debug option there.

packages (even if rebuild) have their own settings what debug info type they use.

This is in each package's options.

LCL and many packages also include the settings that you specify in "Tools > Configure build Lazarus". So you can specify the setting there.

Or you can specify in "Additions and Overrides" with Target packagname, or *

Reply by email

Luca Olivetti
to Martin Frb

El 22/4/24 a les 11:02, Martin Frb via lazarus ha escrit:

Show quoted text 22 lines
On 22/04/2024 10:37, Luca Olivetti via lazarus wrote: > >> But if they have it would be super useful to have a setting "use the >> debug setting of the system unit", but there is not. >> >> You can add the -gw3 flag depending on build mode: >> https://wiki.lazarus.freepascal.org/IDE_Window:_Compiler_Options#Add_a_flag_to_project_and_all_packages > > Then why I can step into the LCL with gdb and -gl? > I'm already using the additions and overrides but I don't currently > specify any debug option there. packages (even if rebuild) have their own settings what debug info type they use. This is in each package's options. LCL and many packages also include the settings that you specify in "Tools > Configure build Lazarus". So you can specify the setting there. Or you can specify in "Additions and Overrides" with Target packagname, or *

That doesn't answer my question: then how is it possible that I can step into the lcl with gdb and -gl even if I don't specify "-gl" in additions and overrides?

Bye

Luca Olivetti Wetron Automation Technology https://wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email

Luca Olivetti
to Luca Olivetti

El 22/4/24 a les 11:13, Luca Olivetti via lazarus ha escrit:

Show quoted text 29 lines
El 22/4/24 a les 11:02, Martin Frb via lazarus ha escrit: > On 22/04/2024 10:37, Luca Olivetti via lazarus wrote: >> >>> But if they have it would be super useful to have a setting "use the >>> debug setting of the system unit", but there is not. >>> >>> You can add the -gw3 flag depending on build mode: >>> https://wiki.lazarus.freepascal.org/IDE_Window:_Compiler_Options#Add_a_flag_to_project_and_all_packages >> >> Then why I can step into the LCL with gdb and -gl? >> I'm already using the additions and overrides but I don't currently >> specify any debug option there. > > packages (even if rebuild) have their own settings what debug info > type they use. > > This is in each package's options. > > LCL and many packages also include the settings that you specify in > "Tools > Configure build Lazarus". So you can specify the setting there. > > Or you can specify in "Additions and Overrides" with Target > packagname, or * That doesn't answer my question: then how is it possible that I can step into the lcl with gdb and -gl even if I don't specify "-gl"? in additions and overrides?

Adding "-gw3" to the options in "Tools->Configure build lazarus" allows me to step into the LCL.
I tried that before but building lazarus failed (I don't remember the exact error).
That doesn't explain why I didn't need to to that with gdb and -gl.

Bye

Luca Olivetti Wetron Automation Technology https://wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email

Luca Olivetti
to Luca Olivetti

El 22/4/24 a les 11:22, Luca Olivetti via lazarus ha escrit:

Show quoted text 36 lines
El 22/4/24 a les 11:13, Luca Olivetti via lazarus ha escrit: > El 22/4/24 a les 11:02, Martin Frb via lazarus ha escrit: >> On 22/04/2024 10:37, Luca Olivetti via lazarus wrote: >>> >>>> But if they have it would be super useful to have a setting "use >>>> the debug setting of the system unit", but there is not. >>>> >>>> You can add the -gw3 flag depending on build mode: >>>> https://wiki.lazarus.freepascal.org/IDE_Window:_Compiler_Options#Add_a_flag_to_project_and_all_packages >>> >>> Then why I can step into the LCL with gdb and -gl? >>> I'm already using the additions and overrides but I don't currently >>> specify any debug option there. >> >> packages (even if rebuild) have their own settings what debug info >> type they use. >> >> This is in each package's options. >> >> LCL and many packages also include the settings that you specify in >> "Tools > Configure build Lazarus". So you can specify the setting there. >> >> Or you can specify in "Additions and Overrides" with Target >> packagname, or * > > > That doesn't answer my question: then how is it possible that I can > step into the lcl with gdb and -gl even if I don't specify "-gl"? in > additions and overrides? > Adding "-gw3" to the options in "Tools->Configure build lazarus" allows me to step into the LCL. I tried that before but building lazarus failed (I don't remember the exact error). That doesn't explain why I didn't need to to that with gdb and -gl.

Spoke too soon: while I can step into the LCL directly, if I put a breakpoint in one of my packages (in a function which is called by the LCL, it implements a THelpManager), fpdebug doesn't stop at the breakpoint. For it to work I have to add -gw3 to the "additions and overrides" (and, sorry to repeat myself, I didn't need to to that with gdb and -gl).

Bye

Luca Olivetti Wetron Automation Technology https://wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email

Mattias Gaertner
to Luca Olivetti: El 22/4/24 a les 10:10, Mattias Gaertner via lazarus ha escrit: I have no problem with…
Luca Olivetti wrote 6 lines
[...] > First of all, the fpc release units have no debug information, so > normally there is nothing to pick. I have no problem with rtl/fcl units, as I explained, I compile them with debug info (either -gl or -gw3) and I can step into them.

Yes, you compiled them yourself, because the fpc *release* does not include debug information.

[...] Then why I can step into the LCL with gdb and -gl?

... and not with fpdebug?

Martin?

Mattias

Reply by email

Luca Olivetti
to Mattias Gaertner

El 22/4/24 a les 11:31, Mattias Gaertner via lazarus ha escrit:

Show quoted text 12 lines
On 22.04.24 10:37, Luca Olivetti via lazarus wrote: > [...] >> First of all, the fpc release units have no debug information, so >> normally there is nothing to pick. > > I have no problem with rtl/fcl units, as I explained, I compile them > with debug info (either -gl or -gw3) and I can step into them. Yes, you compiled them yourself, because the fpc *release* does not include debug information.

That's what I said: I use a self compiled version with debug information

Show quoted text 6 lines
> [...] > Then why I can step into the LCL with gdb and -gl? ... and not with fpdebug?

no, only if I add "-gw3" to the additions and overrides (which I didn't need to do with gdb and -gl).

Bye

Luca Olivetti Wetron Automation Technology https://wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email

Luca Olivetti
to Luca Olivetti: El 22/4/24 a les 11:22, Luca Olivetti via lazarus ha escrit: Spoke too soon: while I can…

El 22/4/24 a les 11:29, Luca Olivetti via lazarus ha escrit:

Show quoted text 16 lines
>> That doesn't answer my question: then how is it possible that I can >> step into the lcl with gdb and -gl even if I don't specify "-gl"? in >> additions and overrides? >> > > Adding "-gw3" to the options in "Tools->Configure build lazarus" > allows me to step into the LCL. > I tried that before but building lazarus failed (I don't remember the > exact error). > That doesn't explain why I didn't need to to that with gdb and -gl. Spoke too soon: while I can step into the LCL directly, if I put a breakpoint in one of my packages (in a function which is called by the LCL, it implements a THelpManager), fpdebug doesn't stop at the breakpoint. For it to work I have to add -gw3 to the "additions and overrides" (and, sorry to repeat myself, I didn't need to to that with gdb and -gl).

For the record: it is *not* necessary to add -gw3 to "configure build lazarus", it's enough to put it in the "additions and overrides".

Bye

Luca Olivetti Wetron Automation Technology https://wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email

Martin Frb
to Luca Olivetti: El 22/4/24 a les 11:02, Martin Frb via lazarus ha escrit: That doesn't answer my…
Luca Olivetti wrote
That doesn't answer my question: then how is it possible that I can step into the lcl with gdb and -gl even if I don't specify "-gl"? in additions and overrides?

Because your LCL is probably build with STABS. And gdb can read stabs, but FpDebug can't.

The problem is -g => and that is also the reason for the "Chose DWARF" dialog that pops up when you haven't explicitly set your project to dwarf.

-g is decided by FPC, it can be stabs or dwarf. Depends on Target and fpc version. The IDE does not have a list, so (prior to compiling it does not know). Therefore when using FpDebug the IDE requires explicit set to Dwarf. (But only checks the project).

Ideally the IDE should have a setting "Use IDE default" or "Follow project" for packages. But you can't put that in Makefiles (which are still used), because it would need to be translated before handing it to fpc.
Still, if we accept that any "just installed" or "build with make" files get immediately rebuild by the IDE, then it could be added.... But it hasn't yet (and probably is major work)

For the record: it is *not* necessary to add -gw3 to "configure build lazarus",?it's?enough?to?put?it?in?the?"additions?and?overrides".

Yes, it's either, or, or both.

Additions and Overrides (with *) will affect ALL packages, even 3rd party. As long as they are part of the project (except RTL, because the IDE does not rebuild RTL / or fpc packages dir).

"Configure build Lazarus" only affects (most) packages that came with Lazarus. => they have $(IDEBuildOptions) in their "custom options". But once done, it is done for all projects (for the packages that follow it).

Reply by email

Luca Olivetti
to Martin Frb

El 22/4/24 a les 11:47, Martin Frb via lazarus ha escrit:

Show quoted text 8 lines
On 22/04/2024 11:13, Luca Olivetti via lazarus wrote: > > That doesn't answer my question: then how is it possible that I can > step into the lcl with gdb and -gl even if I don't specify "-gl"? in > additions and overrides? Because your LCL is probably build with STABS. And gdb can read stabs, but FpDebug can't.

That would explain it, provided it's fpc default (in this case for win32).

> For the record: it is *not* necessary to add -gw3 to "configure build > lazarus",?it's?enough?to?put?it?in?the?"additions?and?overrides". Yes, it's either, or, or both.

Well, since putting it in "configure build lazarus" didn't work (at least it didn't solve my problem), while putting it in "additions and overrides" did, I don't consider them equivalent.
In any case, problem solved, until next time I decide to change something ;-) (which I should refrain to do :-D)

Bye

Luca Olivetti Wetron Automation Technology https://wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007

Reply by email