Recent

Author Topic: fpDebug vs GDB in source code package debugging  (Read 932 times)

Nicola Gorlandi

  • Full Member
  • ***
  • Posts: 132
fpDebug vs GDB in source code package debugging
« on: May 20, 2022, 07:59:50 am »
Hi all,

Using fpDebug i am not able to trace code in package (using F7). Is this something to be implemented or I have miss some settings in my project ?

Using GDB i can trace code.

Using GDB, in case of exception the debugger show me where the error happens even if it is in source code in package, again fpDebug do not.

Many thanks

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: fpDebug vs GDB in source code package debugging
« Reply #1 on: May 20, 2022, 12:32:55 pm »
Go to package option, and change the package to use dwarf.

That is "package" = Lazarus package / lpk ?


if you mean library then that is not yet supported in the release.


OS ?
Bitness?

Nicola Gorlandi

  • Full Member
  • ***
  • Posts: 132
Re: fpDebug vs GDB in source code package debugging
« Reply #2 on: May 20, 2022, 05:38:21 pm »
Many thanks,

I suppose that the option Automatic -g was already the way to get what I need.

Following your suggestion I need to open all the packages and change that setting.

Anyway I try with one package but F7 still is not working using fpDebug as it does using GDB.


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: fpDebug vs GDB in source code package debugging
« Reply #3 on: May 20, 2022, 08:47:42 pm »
Automatic is determined by fpc. And yes on a lot of platforms it is dwarf.


We are talking Lazarus 2.2.0 or 2.2.2 ?
With FPC 3.2.2 (as included)

On which OS ? 64/32Bit?



One more point (might be obvious, but...) "Generate debug info" is enabled in those packages?
And "Use external" should not be set. If for some reason you need that, then setting it in the project should be fine. (I don't know if it does anything if set in package options....)



Instead of opening all packages you can in "Project Options" go to "Additions and overrides". (details on our wiki)

In the gird select "stored in project", then from the toolbar "Add" > "new target".
Edit the target to *  Or edit it to a comma separated list of package-names.

From the toolbar Add > Custom Option
Edit it to
    -gw3

Or if you prefer Dwarf-2:  -gw -godwarfsets


This will also force the generation of debug info, if the checkbox is not set.



Known issues...

Code: Pascal  [Select][+][-]
  1. type TFoo = object
  2. end;
The OLD style object... This has a bug, and can currently not be stepped into. (GDB does / FpDebug does only in Lazarus 2.3).

There is another issues with some forms of nested classes.... Or classes nested in generics.... I only stumbled no it a few days ago, I hadn't even have time to figure out the exact conditions.
(Normal generics should be step-able)




If none of that helps, it will be hard to figure out remotely.
2)
If you can, you can send the project (with lpi, lps and all settings) to me. Also in private lazarus " a t " mfriebe " d o t " de

1)
Or before sending the project, just sent the compiled exe. (it contains names of your variables, so mind that I will see those).
- I do not plan to run it. Just use some tools to read the debug info.
- Or I can give you instructions how to run the tools (they are part of fpc / the tool is objdump)

3)
If you rather do not sent it (or if it does not reproduce on my PC...)

Try to open the asm window, when you are on the line where you want to F7 into a package.
(Once the asm has loaded, set the "power button" in the asm window to off / works faster)
- Use the buttons in the asm window to asm-single-step.
- make sure to "step into asm" when you are at the call instruction.

Once you stepped into the function => look at the call stack, what does it display?
Try to do another 10 asm single steps inside the function => see if the callstack updates?



Sorry, steps getting more complicated.

Nicola Gorlandi

  • Full Member
  • ***
  • Posts: 132
Re: fpDebug vs GDB in source code package debugging
« Reply #4 on: May 21, 2022, 09:36:34 am »
Many thanks!!

I try with Lazarus 2.2.2 (I had 2.2.0 at the time of the first post) on Windows.


It works even with "Use external" setted.

 

TinyPortal © 2005-2018