Wrong Dwarf-3 for "type foo = OBJECT ...."

Original Reporter info from Mantis: Martin @martin_frb
  • Reporter name: Martin Friebe

Description:

An "object" (old style object), is NOT a referenced type. (like a record / allocated on the stack, or embedded)

However FPC (tested 64bit from 3.0.2 up to slightly order 3.1.1) write debug info with a DW_OP_deref.
This is only dwarf-3 (and presumingly dwarf 4)

type
  TObject3Int64     =        object a,b,c: Int64; end;

Abr: 20 Tag: 22 DW_TAG_typedef  // TObject3Int64
  --  Attr: DW_AT_name: DW_FORM_string >TObject3Int64
  --  Attr: DW_AT_type: DW_FORM_ref4 >[REF:1]

    * REF: 1
Abr: 31 Tag: 19 DW_TAG_structure_type  // TObject3Int64
  --  Attr: DW_AT_name: DW_FORM_string >TObject3Int64
  --  Attr: DW_AT_byte_size: DW_FORM_udata >24
  --  Attr: DW_AT_allocated: DW_FORM_block1 >2: 0697    // DW_OP_push_object_address, DW_OP_deref
  --  Attr: DW_AT_data_location: DW_FORM_block1 >2: 0697  // DW_OP_push_object_address, DW_OP_deref
.... members

There should be no DW_AT_data_location.
The data is at the given address, and needs no deref.

Also there should be no DW_AT_allocated

Mantis conversion info:

  • Mantis ID: 36017
  • OS: win 10
  • OS Build: 10
  • Platform: 64bit Intel
  • Version: 3.3.1
  • Fixed in version: 3.3.1
  • Fixed in revision: 43183 (#6e581789)