On 25/04/2026 19:31, Tomas Hajny via fpc-devel wrote:
Actually, what debuggers are used by core team members? Anyone still using gdb 
in some cases (including OOP targets?)
  .
  .

Not sure what is meant with OOP in this context, but there's no other option for OS/2 
than GDB with stabs (not because there wouldn't be other debuggers available, but because 
neither me nor anybody else managed to provide support for them (since it wouldn't be 
"just" implementing support for something else, but rather to solve a bunch of 
other issues first - at least different object format and different linker).


I was wondering if it is an issue just with the GDB I have or a general issue.

Though, I did not test stabs.

There is some old, incorrect DWARF code that generates wrong info for
  type TFoo = class
    public const X = 1;
  end;

And, that causes an assert failure in gdb (at least mine).

But, that never was a big issue => likely no one ever spotted it, because such constants are rare.
Or well, used to be.

Now TObject itself (in 331) has one of them. And gdb gives an issue.

Then again, no one seems to have been bothered by it (other than me occidentally stumbling on it). Because
- I saw no mention
- I saw no attempt to fix it

So I wasn't sure, maybe my GDB is just bad...

Try above, with DWARF.
To inspect the variable
  var MyFoo: TFoo; //MyFoo:= TFoo.create;

in GDB
  p MyFoo^

without deref, gdb only prints the address.

---------------------
There are various fixes.

remove those constants completely from DWARF => but I don't know if that is object/record only.  This may be some other

TDebugInfoDwarf.enum_membersyms_callback => which is called in a few places
calls
TDebugInfoDwarf.appendsym_const_member
which adds
          append_entry(DW_TAG_member,false,

That looks like in classes/records only...

------------------
Alternatively make it dependent on godwarfcpp
Because, despite it being wrong => FpDebug deals with it.

(And even one of the DWARF maintainers (I think it was) has recently (on a diff subject) told me:  If the debugger can read it, just use tags/attribs that aren't meant in that place.

But, I think that wouldn't be worth it.... Just go with the below instead.

--------------
And of course, lets do DWARF 5
Because there is an official solution.

And for constants it works with GDB (I think, I done a ton of diff testing, so hope not to mix up results)

For "class var" also official supported, GDB fails...

Latest GDB has lots of "for each language C, Pascal, ...", and that broke some previously working stuff...

_______________________________________________
fpc-devel maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to