瀏覽代碼

* Generate proper Dwarf-debuginfo for DW_AT_vtable_elem_location, containing
a Dwarf-block that evaluates the location of a method within the vmt.
The vmtindex as it was used is is only used by older GCC versions and does
not work with a Pascal VMT.

git-svn-id: trunk@19253 -

joost 14 年之前
父節點
當前提交
ce01b15c49
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6 4
      compiler/dbgdwarf.pas

+ 6 - 4
compiler/dbgdwarf.pas

@@ -2044,7 +2044,7 @@ implementation
         procentry      : string;
         procentry      : string;
         cc             : Tdwarf_calling_convention;
         cc             : Tdwarf_calling_convention;
         st             : tsymtable;
         st             : tsymtable;
-        vmtindexnr     : pint;
+        vmtoffset      : pint;
         in_currentunit : boolean;
         in_currentunit : boolean;
       begin
       begin
         { only write debug info for procedures defined in the current module,
         { only write debug info for procedures defined in the current module,
@@ -2128,10 +2128,12 @@ implementation
             { Element number in the vmt (needs to skip stuff coming before the
             { Element number in the vmt (needs to skip stuff coming before the
               actual method addresses in the vmt, so we use vmtmethodoffset()
               actual method addresses in the vmt, so we use vmtmethodoffset()
               and then divide by sizeof(pint)).  }
               and then divide by sizeof(pint)).  }
-            vmtindexnr:=tobjectdef(def.owner.defowner).vmtmethodoffset(def.extnumber) div sizeof(pint);
-            append_attribute(DW_AT_vtable_elem_location,DW_FORM_block1,[1+LengthUleb128(vmtindexnr)]);
+            vmtoffset:=tobjectdef(def.owner.defowner).vmtmethodoffset(def.extnumber);
+            append_attribute(DW_AT_vtable_elem_location,DW_FORM_block1,[3+LengthUleb128(vmtoffset)]);
+            current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_push_object_address)));
             current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_constu)));
             current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_constu)));
-            current_asmdata.asmlists[al_dwarf_info].concat(tai_const.Create_uleb128bit(vmtindexnr));
+            current_asmdata.asmlists[al_dwarf_info].concat(tai_const.Create_uleb128bit(vmtoffset));
+            current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus)));
           end;
           end;
 
 
         { accessibility: public/private/protected }
         { accessibility: public/private/protected }