[fpc-devel] DW_AT_declaration

Martin Frb lazarus at mfriebe.de
Mon Sep 4 10:59:18 CEST 2023


While looking at 
https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/448#note_1540865966

DW_AT_declaration came up.

 From the DWARF 5 spec
> A debugging information entry that represents a non-defining or 
> otherwise 11 incomplete declaration of a program entity has a 
> DW_AT_declaration attribute, 12 which is a flag.

 From further reading through the spec it seems to refer to
   "the name being declared but not defined"
- the actual definition of the type is not included here (may be in a 
diff scope/unit)
- the implementation of the procedure is not included


Then I found it in debug info generated by FPC:


   TScreen = class(TLCLComponent)
   private const
     crScreen = Low(TCursor); // use with 
Screen.BeginTempCursor/EndTempCursor to add Screen.Cursor into the temp list


  <0><e3376>: Abbrev Number: 1 (DW_TAG_compile_unit)
     <e3377>   DW_AT_name        : forms.pp
     <e3380>   DW_AT_producer    : Free Pascal 3.2.3 2023/06/21
     <e339d>   DW_AT_comp_dir    : B:/lazarus_main/lcl/
...
...
  <1><103e29>: Abbrev Number: 20 (DW_TAG_class_type)
     <103e2a>   DW_AT_name        : TScreen
     <103e32>   DW_AT_byte_size   : 376
...
  <2><103e3d>: Abbrev Number: 68 (DW_TAG_member)
     <103e3e>   DW_AT_name        : crScreen
     <103e47>   DW_AT_declaration : 1
     <103e48>   DW_AT_external    : 1
     <103e49>   DW_AT_type        : <0x115cf7>
     <103e4d>   DW_AT_const_value : -32768


But this isn't an "incomplete declaration".

Everything is in place? Why is the tag added?


More information about the fpc-devel mailing list