From 12730b4cb188f6d2b169d3d78a40861efa865447 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 4 Feb 2006 16:08:51 +0000 Subject: [PATCH] + dwarf: objectdef git-svn-id: trunk@2429 - --- compiler/dbgbase.pas | 2 +- compiler/dbgdwarf.pas | 97 +++++++++++++++++++++++++++---------------- 2 files changed, 62 insertions(+), 37 deletions(-) diff --git a/compiler/dbgbase.pas b/compiler/dbgbase.pas index 3e3dcd324c..74cf240d5d 100644 --- a/compiler/dbgbase.pas +++ b/compiler/dbgbase.pas @@ -116,7 +116,7 @@ implementation var pd : tprocdef; begin - if tsym(p).typ = procsym then + if tsym(p).typ=procsym then begin pd:=tprocsym(p).first_procdef; insertdef(taasmoutput(arg),pd.rettype.def); diff --git a/compiler/dbgdwarf.pas b/compiler/dbgdwarf.pas index 60ef3fa8c9..d2eb9b4614 100644 --- a/compiler/dbgdwarf.pas +++ b/compiler/dbgdwarf.pas @@ -878,6 +878,65 @@ implementation end; + procedure append_dwarftag_objectdef(def:tobjectdef); + + procedure doappend; + begin + if assigned(def.objname) then + append_entry(DW_TAG_structure_type,true,[ + DW_AT_name,DW_FORM_string,def.objname^+#0, + DW_AT_byte_size,DW_FORM_udata,def.size + ]) + else + append_entry(DW_TAG_structure_type,true,[ + DW_AT_byte_size,DW_FORM_udata,def.size + ]); + finish_entry; + if assigned(def.childof) then + begin + append_entry(DW_TAG_inheritance,false,[ + DW_AT_accessibility,DW_FORM_data1,DW_ACCESS_public, + DW_AT_data_member_location,DW_FORM_block1,1+lengthuleb128(0) + ]); + asmlist[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus_uconst))); + asmlist[al_dwarf_info].concat(tai_const.create_uleb128bit(0)); + append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.childof)); + finish_entry; + end; + + def.symtable.foreach(@field_add_dwarftag,nil); + + finish_children; + end; + + var + obj : tasmlabel; + + begin + case def.objecttype of + odt_cppclass, + odt_object: + doappend; + odt_interfacecom, + odt_interfacecorba, + odt_dispinterface, + odt_class: + begin + objectlibrary.getdatalabel(obj); + { implicit pointer } + append_entry(DW_TAG_pointer_type,false,[]); + append_labelentry_ref(DW_AT_type,obj); + finish_entry; + + asmlist[al_dwarf_info].concat(tai_symbol.create(obj,0)); + doappend; + end; + else + internalerror(200602041); + end; + end; + + procedure append_dwarftag_pointerdef(def:tpointerdef); begin append_entry(DW_TAG_pointer_type,false,[]); @@ -1164,43 +1223,9 @@ implementation end; end; - case def.deftype of - objectdef : - begin - { classes require special code to write the record and the invisible pointer } - if is_class(def) then - begin - { Write the record class itself } - tobjectdef(def).writing_class_record_dbginfo:=true; - append_dwarftag(list,def); - tobjectdef(def).writing_class_record_dbginfo:=false; - { Write the invisible pointer class } - oldtypesym:=def.typesym; - def.typesym:=nil; - append_dwarftag(list,def); - def.typesym:=oldtypesym; - end - else - append_dwarftag(list,def); - { VMT symbol } - if (oo_has_vmt in tobjectdef(def).objectoptions) and - assigned(def.owner) and - assigned(def.owner.name) then - { - list.concat(Tai_stab.create(stab_stabs,strpnew('"vmt_'+def.owner.name^+tobjectdef(def).name+':S'+ - def_stab_number(vmttype.def)+'",'+tostr(N_STSYM)+',0,0,'+tobjectdef(def).vmt_mangledname))); - } - ; - end; - procdef : - begin - { procdefs are handled separatly } - end; - else - append_dwarftag(list,def); - end; + append_dwarftag(list,def); - def.dbg_state := dbg_state_written; + def.dbg_state:=dbg_state_written; end;