[Issue 4212] DWARF: void arrays cause gdb errors

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 20 12:45:38 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4212


Robert Clipsham <robert at octarineparrot.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #2 from Robert Clipsham <robert at octarineparrot.com> 2010-05-20 20:45:35 BST ---
The patch below fixes both test cases:
Index: backend/dwarf.c
===================================================================
--- backend/dwarf.c     (revisión: 494)
+++ backend/dwarf.c     (copia de trabajo)
@@ -1558,6 +1558,13 @@
                 DW_AT_type,             DW_FORM_ref4,
                 0,                      0,
             };
+            static unsigned char abbrevTypeArrayVoid[] =
+            {
+                DW_TAG_array_type,
+                1,                      // child (the subrange type)
+                DW_AT_sibling,          DW_FORM_ref4,
+                0,                      0,
+            };
             static unsigned char abbrevTypeSubrange[] =
             {
                 DW_TAG_subrange_type,
@@ -1573,7 +1580,6 @@
                 DW_AT_type,             DW_FORM_ref4,
                 0,                      0,
             };
-            unsigned code1 = dwarf_abbrev_code(abbrevTypeArray,
sizeof(abbrevTypeArray));
             unsigned code2 = (t->Tflags & TFsizeunknown)
                 ? dwarf_abbrev_code(abbrevTypeSubrange2,
sizeof(abbrevTypeSubrange2))
                 : dwarf_abbrev_code(abbrevTypeSubrange,
sizeof(abbrevTypeSubrange));
@@ -1581,12 +1587,15 @@
             unsigned idxsibling = 0;
             unsigned siblingoffset;
             nextidx = dwarf_typidx(t->Tnext);
+            unsigned code1 = nextidx ? dwarf_abbrev_code(abbrevTypeArray,
sizeof(abbrevTypeArray))
+                                     : dwarf_abbrev_code(abbrevTypeArrayVoid,
sizeof(abbrevTypeArrayVoid));
             idx = infobuf->size();

             infobuf->writeuLEB128(code1);       // DW_TAG_array_type
             siblingoffset = infobuf->size();
             infobuf->write32(idxsibling);       // DW_AT_sibling
-            infobuf->write32(nextidx);          // DW_AT_type
+            if (nextidx)
+                infobuf->write32(nextidx);      // DW_AT_type

             infobuf->writeuLEB128(code2);       // DW_TAG_subrange_type
             infobuf->write32(idxbase);          // DW_AT_type

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list