Forum > Debugger

fpDebug vs GDB in source code package debugging


Nicola Gorlandi:
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

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 ?

Nicola Gorlandi:
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.

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

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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---type TFoo = objectend;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.
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

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)

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:
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.


[0] Message Index

Go to full version