Recent

Author Topic: Testers wanted: FpDebug on Linux and Windows  (Read 2908 times)

Igor Kokarev

  • Full Member
  • ***
  • Posts: 199
Re: Testers wanted: FpDebug on Linux and Windows
« Reply #15 on: July 28, 2020, 10:03:54 am »
Martin,

Thanks for FpDebug!

Will FpDebug support external symbols (-Xg)?

We use -Xg in our app to link statically some GCC .o libraries.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6470
    • wiki
Re: Testers wanted: FpDebug on Linux and Windows
« Reply #16 on: July 28, 2020, 11:17:43 am »
Will FpDebug support external symbols (-Xg)?

We use -Xg in our app to link statically some GCC .o libraries.

It should already do (at least in basic cases). I tested on Windows, but IIRC should be Linux too.

Note that debugging in libraries (dll/so) files is still work in progress. You have to test and see what works.

wp

  • Hero Member
  • *****
  • Posts: 7392
Re: Testers wanted: FpDebug on Linux and Windows
« Reply #17 on: July 28, 2020, 12:13:13 pm »
With my current gdb issues with console applications I finally decided to give fpdebug a try. And I must say I am extraordinarily surprised. It's almost like working with Delphi finally! Fly-over hints of properties? No problem (well, mostly...). 10 to 20 seconds waiting before the FileDialog opens in the debugger? No problem. I think i can do 90% of my debug work with it.

For those who like myself are confused by the many debugger packages available in the standard installation here are the steps that I took to make it work

- Go to "Package" > "Install/Uninstall packages". Make sure that LazDebuggerFp is installed (if not, install the package).
- Go to "Tools" > "Options" > "Debugger". In the gray combobox "Debugger type and paths" which usually displays "GNU debugger (gdb)", select "FpDebug standard Dwarf debugger (beta)".
- After compilation of a project you will be prompted to select which kind of dwarf debugging informations is too be used. The selection is written to the project file. (I hope permanent selection here is not a problem when the project is passed to others, like in my forum posts)

@Martin: There is also a package fpdebug. It is not installed on my systems. Is it needed?
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6470
    • wiki
Re: Testers wanted: FpDebug on Linux and Windows
« Reply #18 on: July 28, 2020, 12:20:36 pm »
With my current gdb issues with console applications I finally decided to give fpdebug a try. And I must say I am extraordinarily surprised. It's almost like working with Delphi finally! Fly-over hints of properties? No problem (well, mostly...). 10 to 20 seconds waiting before the FileDialog opens in the debugger? No problem. I think i can do 90% of my debug work with it.
Properties (or the working subset of them) are actually not fpdebug specific.

They are stabs vs dwarf. However fpdebug only supports dwarf, so you were forced to select that.

With dwarf, fpc writes info for properties that read the field directly (that is there is no getter proc).
When using dwarf, gdb will show the same set of properties.
https://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Properties

However, with FpDebug you can use "Dwarf 3" and get the names in stack/locals/... in normal case as declared (instead of all uppercase).

Gdb does dwarf-3, but  dwarf3 increases the risk of gdb crashing.

Quote
@Martin: There is also a package fpdebug. It is not installed on my systems. Is it needed?
Its used by LazDebuggerFp. So its compiled in.

But it does not need to be installed.

Igor Kokarev

  • Full Member
  • ***
  • Posts: 199
Re: Testers wanted: FpDebug on Linux and Windows
« Reply #19 on: July 28, 2020, 01:34:56 pm »
Martin,

I found a reason of the problem.

FpDebugger doesn't work on Windows 10 when Project Options use an option "Use external debug symbols file (-Xg)".

I see a warning, that FpDebugger doesn't work in this mode.

I prefer this option to reduce EXE file size. Of course, I perform strip command for a release version.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6470
    • wiki
Re: Testers wanted: FpDebug on Linux and Windows
« Reply #20 on: July 28, 2020, 02:25:42 pm »
FpDebugger doesn't work on Windows 10 when Project Options use an option "Use external debug symbols file (-Xg)".

Ouch, my fault. I recently had to fix something on the gdb debugger. So my debugger was set to gdb.

Indeed, FpDebug does not yet support that.


It should not be too much work to implement. But I do not know when I will have time for it

It needs to be done in unit FpImgReaderWinPE (package FpDebug)

For the "how to" see unit LNfoDwarf (part of fpc), and exeinfo.
Code: Pascal  [Select][+][-]
  1. function OpenDwarf(addr : codepointer) : boolean;
  2.   if ReadDebugLink(e,dbgfn) then
  3.  
and the code in ReadDebugLink.

---
The warning prompt can be configured in
class function TFpDebugDebugger.RequiredCompilerOpts(ATargetCPU, ATargetOS: String): TDebugCompilerRequirements;
"dcrNoExternalDbgInfo"
« Last Edit: July 28, 2020, 02:29:26 pm by Martin_fr »

Igor Kokarev

  • Full Member
  • ***
  • Posts: 199
Re: Testers wanted: FpDebug on Linux and Windows
« Reply #21 on: July 28, 2020, 07:29:00 pm »
Martin,

Thanks! It's not critical problem and it can wait.

calebs

  • Full Member
  • ***
  • Posts: 134
Re: Testers wanted: FpDebug on Linux and Windows
« Reply #22 on: August 11, 2020, 09:45:31 pm »
Hello all
i've followed all these steps and enabled fpdebugger but sometimes when i press f7 instead of f8 to enter a function or procedure it gives me protection fault.
Im using lazarus 2.0.10 rev 63526 x86 with windows 10x64 compiling in x86 mode (not x64).
Also, f7 doesn't get inside the code in control.inc for example when i press f7 on labeledit.caption:='hi'; (which is very anoying to me because i don't want to debug the master work of lazarus devs, only my mess lol) but i don't know if its normal.
When asked about debug info type  i've selected dwarf3-beta.
With dwarf2 also fails with f7 on some lines.

Is this normal because i'm not using trunk? thanks!


With my current gdb issues with console applications I finally decided to give fpdebug a try. And I must say I am extraordinarily surprised. It's almost like working with Delphi finally! Fly-over hints of properties? No problem (well, mostly...). 10 to 20 seconds waiting before the FileDialog opens in the debugger? No problem. I think i can do 90% of my debug work with it.

For those who like myself are confused by the many debugger packages available in the standard installation here are the steps that I took to make it work

- Go to "Package" > "Install/Uninstall packages". Make sure that LazDebuggerFp is installed (if not, install the package).
- Go to "Tools" > "Options" > "Debugger". In the gray combobox "Debugger type and paths" which usually displays "GNU debugger (gdb)", select "FpDebug standard Dwarf debugger (beta)".
- After compilation of a project you will be prompted to select which kind of dwarf debugging informations is too be used. The selection is written to the project file. (I hope permanent selection here is not a problem when the project is passed to others, like in my forum posts)

@Martin: There is also a package fpdebug. It is not installed on my systems. Is it needed?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6470
    • wiki
Re: Testers wanted: FpDebug on Linux and Windows
« Reply #23 on: August 11, 2020, 10:31:09 pm »
First of all: Dwarf2 vs Dwarf3 etc only matters for inspecting variables.
Line info (for stepping) should be the same for all of them.

First question is, if you have debug info (dwarf) for the LCL / LCLBase?
Does "procedure TControl.SetText(const Value: TCaption);" have the blue dots.

It may work under gdb, because if "debug info type" is "default -g", that may (on 32bit win) generate stabs. And fpdebug does not read stabs.
The dialog that pops up, requiring dwarf, only affect project files.

You can
- edit the Package options. LclBase
- tools > configure build lazarus. Add  -gw   or -gw3 to options, and save (no need to rebuild the IDE, packages will be rebuild on next run)
- Use "additions and overrides"

With debug info, it works for me. 32 bit 2.0.10 IDE on a Win64 PC.


Stepping had a major overhaul in trunk. There was no known fix for anything matching the above. But if the issue is not due to missing line info, then there still is a chance that it works in trunk.


 

TinyPortal © 2005-2018