瀏覽代碼

* Dwarf3: Classes are not encoded as a pointer to a class-structure, but
as a class-structure directly. Make sure that in this case:
- The size is the size of the structure, not the size of a pointer
- The (hidden) pointer is dereferenced
- The class is marked as unallocated when the (hidden) pointer is nil

git-svn-id: trunk@16674 -

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

+ 12 - 9
compiler/dbgdwarf.pas

@@ -3801,13 +3801,20 @@ implementation
         begin
           if assigned(def.objname) then
             append_entry(tag,true,[
-              DW_AT_name,DW_FORM_string,def.objrealname^+#0,
-              DW_AT_byte_size,DW_FORM_udata,def.size
+              DW_AT_name,DW_FORM_string,def.objrealname^+#0
               ])
           else
-            append_entry(DW_TAG_structure_type,true,[
-              DW_AT_byte_size,DW_FORM_udata,def.size
-              ]);
+            append_entry(DW_TAG_structure_type,true,[]);
+          append_attribute(DW_AT_byte_size,DW_FORM_udata,[tobjectsymtable(def.symtable).datasize]);
+          // The pointer to the class-structure is hidden. The debug-information
+          // does not contain an implicit pointer, but the data-adress is dereferenced here.
+          // In case of a nil-pointer, report the class as being unallocated.
+          append_block1(DW_AT_allocated,2);
+          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_deref)));
+          append_block1(DW_AT_data_location,2);
+          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_deref)));
           finish_entry;
         end;
 
@@ -3869,10 +3876,6 @@ implementation
             end;
           odt_class:
             begin
-              { not sure if the implicit pointer is needed for tag_class (MWE)}
-              {
-              doimplicitpointer;
-              }
               dostruct(DW_TAG_class_type);
               doparent(false);
             end;