[fpc-devel] label not found DBG2_****

Martin Frb lazarus at mfriebe.de
Wed Nov 11 14:42:05 CET 2026


Between dwarf 2 and 3 changes to the generated dwarf were made.

interfaces now use location expressions and no longer write a 
DW_TAG_pointer_type for the hidden pointer.

So, if you compile
   UNIT_BASE; type TBase = interface end
with
   dwarf 3
then it does not need  the "DBG2_" label.

That is because that label is used by the pointer to reference the 
actual structure, but no pointer, no need to reference...

Only if now (in a difference package) you have
   UNIT_FOO; type TFoo = interface(TBase) end
and compile it with
   dwarf 2

Then dwarf 2 writes the inheritance to refer to the DBG2_ label (because 
the inheritance must not have the pointer in it).

But that label does not exist....

--------------------------
2 ways to solve.

1)
Let Dwarf 3 (and up) write the DBG2_* label  it goes in the same place 
as the regular DBG_ label, right in front of the structure.

2)
Let UNIT_FOO know that UNIT_BASE was dwarf-3 (or up).
That requires changes to the ppu file, to store what dwarf was used.

Either add the info to the module
- could be: new field
- could be: existing (enum) field, if appropriate exists / new enum member
OR
add it to
- def.debug_state (repeats for each def, but wont take extra space, as 
long as the byte size of the enum holds)
   that is already written, and has ds_dwarf_dbg_info_written
   it could then have (additional) ds_dwarf_3_dbg_info_written



I can look into doing either (I will need pointers how to store as part 
of the module, if that is the path to take).


More information about the fpc-devel mailing list