Ghidra is a software reverse engineering (SRE) framework
GP-6245 DWARF - add support for GNU DW_FORM serialization types.
dev7473689e061fb0327e
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/DIEAggregate.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/DIEAggregate.javaindex 3734fe59f4..cda81c93c2 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/DIEAggregate.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/DIEAggregate.java@@ -417,19 +417,21 @@ public class DIEAggregate {}private DebugInfoEntry getRefDIE(DWARFAttribute attribute) {- DWARFNumericAttribute val = getAttribute(attribute, DWARFNumericAttribute.class);- if (val == null) {+ FoundAttribute foundAttr = findAttribute(attribute);+ if (foundAttr == null || !(foundAttr.attr instanceof DWARFNumericAttribute val)) {return null;}- long offset = val.getUnsignedValue();-- DebugInfoEntry result = getProgram().getDIEByOffset(offset);- if (result == null) {- Msg.warn(this, "Invalid reference value [%x]".formatted(offset));- Msg.warn(this, this.toString());+ try {+ return getProgram().getDIE(val.getAttributeForm(), val.getUnsignedValue(),+ foundAttr.die.getCompilationUnit());}- return result;+ catch (IOException e) {+ Msg.warn(this, "Invalid reference from DIE 0x%x to 0x%x (%s)".formatted(+ foundAttr.die.getOffset(), val.getUnsignedValue(), val.getAttributeForm()));+ Msg.debug(this, this.toString());+ }+ return null;}/**diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/DWARFProgram.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/DWARFProgram.javaindex 79aa514293..d0d6e53278 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/DWARFProgram.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/DWARFProgram.java@@ -396,7 +396,7 @@ public class DWARFProgram implements Closeable {private void indexDIEsForCU(DWARFCompilationUnit cu, LongArrayList dieOffsetList,IntArrayList parentIndexList, IntArrayList siblingIndexList, LongArrayList aggrTargets,- TaskMonitor monitor) throws CancelledException {+ TaskMonitor monitor) throws CancelledException, DWARFException {long endOffset = cu.getEndOffset();int perCuDieCount = 0;@@ -448,19 +448,26 @@ public class DWARFProgram implements Closeable {DIEAggregate diea = DIEAggregate.createSingle(die);for (DWARFAttribute attr : REF_ATTRS) {- long refdOffset = diea.getUnsignedLong(attr, -1);- if (refdOffset != -1) {+ DWARFNumericAttribute attrval =+ diea.getAttribute(attr, DWARFNumericAttribute.class);+ if (attrval != null) {+ long refdOffset = getLocalDIEOffset(attrval.getAttributeForm(),+ attrval.getUnsignedValue(), cu);aggrTargets.add(refdOffset);}}diesByOffset.put(startOfDIE, die);}+ catch (DWARFException e) {+ throw e;+ }catch (IOException e) {Msg.error(this,- "Failed to read DIE at offset 0x%x in compunit %d (at 0x%x), skipping remainder of compilation unit."- .formatted(startOfDIE, cu.getUnitNumber(), cu.getStartOffset()),- e);+ "Failed to read DIE at offset 0x%x in compunit %d (at 0x%x), skipping remainder of compilation unit: %s"+ .formatted(startOfDIE, cu.getUnitNumber(), cu.getStartOffset(),+ Objects.requireNonNullElse(e.getMessage(), "unspecified")));+ Msg.debug(this, "Error location", e);debugInfoBR.setPointerIndex(endOffset);}}@@ -1092,14 +1099,47 @@ public class DWARFProgram implements Closeable {return lineStrings.getStringAtOffset(offset);case DW_FORM_strp:return debugStrings.getStringAtOffset(offset);+ case DW_FORM_gnu_strp_alt:+ case DW_FORM_gnu_str_index:+ throw new IOException("Unsupported DWARF string attribute form " + form);case DW_FORM_strx, DW_FORM_strx1, DW_FORM_strx2, DW_FORM_strx3, DW_FORM_strx4:long strOffset = stringsOffsetTable.getOffset((int) offset, cu);return debugStrings.getStringAtOffset(strOffset);+default:throw new IOException("Unsupported string form: " + form);}}+ private long getLocalDIEOffset(DWARFForm form, long rawOffset, DWARFCompilationUnit cu)+ throws DWARFException {+ switch (form) {+ case DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref4, DW_FORM_ref8, DW_FORM_ref_udata:+ return rawOffset + cu.getStartOffset();+ case DW_FORM_ref_addr:+ return rawOffset;+ case DW_FORM_gnu_ref_alt:+ throw new DWARFException("Unsupported DIE reference form: " + form);+ default:+ Msg.warn(this, "Nontypical form %s used for reference".formatted(form));+ return rawOffset;+ }+ }++ /**+ * Return the DIE referenced by an attribute value (a DW_FORM and offset)+ *+ * @param form {@link DWARFForm}+ * @param rawOffset index / offset from the numeric attribute+ * @param cu compilation unit containing the value+ * @return {@link DebugInfoEntry}, or null if doesn't exist+ * @throws IOException if unsupported format for reference+ */+ public DebugInfoEntry getDIE(DWARFForm form, long rawOffset, DWARFCompilationUnit cu)+ throws IOException {+ return getDIEByOffset(getLocalDIEOffset(form, rawOffset, cu));+ }+/*** Returns the {@link DWARFRangeList} pointed at by the specified attribute.*@@ -1206,6 +1246,7 @@ public class DWARFProgram implements Closeable {long addr = addressListTable.getOffset((int) value, cu);return addr;}+ case DW_FORM_gnu_addr_index:default:throw new IOException("Unsupported form %s".formatted(form));}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/DebugInfoEntry.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/DebugInfoEntry.javaindex 38ee729c27..56207e4061 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/DebugInfoEntry.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/DebugInfoEntry.java@@ -292,7 +292,14 @@ public class DebugInfoEntry {for (int i = 0; i < attributes.length; i++) {buffer.append("\t\t");DWARFAttributeValue attribVal = getAttributeValueUnchecked(i);- buffer.append(attribVal != null ? attribVal.toString(compilationUnit) : "-missing-");+ if (attribVal != null) {+ buffer.append(attribVal.toString(compilationUnit));+ }+ else {+ AttrDef attrDef = abbreviation.getAttributeAt(i);+ buffer.append("%s : %s = <missing>".formatted(attrDef.getAttributeName(),+ attrDef.getAttributeForm()));+ }buffer.append("\n");}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/attribs/DWARFForm.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/attribs/DWARFForm.javaindex acf14c8e56..948dd68ba9 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/attribs/DWARFForm.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/attribs/DWARFForm.java@@ -134,14 +134,7 @@ public enum DWARFForm {context.def());}},- DW_FORM_strp(0xe, DWARFForm.DWARF_INTSIZE, string) {- // offset in .debug_str- @Override- public DWARFAttributeValue readValue(DWARFFormContext context) throws IOException {- long stringOffset = context.reader().readNextUnsignedValue(context.dwarfIntSize());- return new DWARFDeferredStringAttribute(stringOffset, context.def());- }- },+ DW_FORM_strp(0xe, DWARFForm.DWARF_INTSIZE, string),DW_FORM_udata(0xf, DWARFForm.LEB128_SIZE, constant) {@Overridepublic DWARFAttributeValue readValue(DWARFFormContext context) throws IOException {@@ -149,25 +142,12 @@ public enum DWARFForm {context.def());}},- DW_FORM_ref_addr(0x10, DWARFForm.DWARF_INTSIZE, reference) {- @Override- public DWARFAttributeValue readValue(DWARFFormContext context) throws IOException {- long addr = context.reader().readNextUnsignedValue(context.dwarfIntSize());- return new DWARFNumericAttribute(addr, context.def());- }- },+ DW_FORM_ref_addr(0x10, DWARFForm.DWARF_INTSIZE, reference),DW_FORM_ref1(0x11, 1, reference),DW_FORM_ref2(0x12, 2, reference),DW_FORM_ref4(0x13, 4, reference),DW_FORM_ref8(0x14, 8, reference),- DW_FORM_ref_udata(0x15, DWARFForm.LEB128_SIZE, constant) {- @Override- public DWARFAttributeValue readValue(DWARFFormContext context) throws IOException {- long uoffset = context.reader().readNext(LEB128::unsigned);- return new DWARFNumericAttribute(uoffset + context.compUnit().getStartOffset(),- context.def());- }- },+ DW_FORM_ref_udata(0x15, DWARFForm.LEB128_SIZE, constant, reference),DW_FORM_indirect(0x16, DWARFForm.DYNAMIC_SIZE /* value class will depend on the indirect form*/ ) {@Overridepublic long getSize(DWARFFormContext context) throws IOException {@@ -226,20 +206,8 @@ public enum DWARFForm {return new DWARFBooleanAttribute(true, context.def());}},- DW_FORM_strx(0x1a, DWARFForm.LEB128_SIZE, string) {- @Override- public DWARFAttributeValue readValue(DWARFFormContext context) throws IOException {- int index = context.reader().readNextUnsignedVarIntExact(LEB128::unsigned);- return new DWARFDeferredStringAttribute(index, context.def());- }- },- DW_FORM_addrx(0x1b, DWARFForm.LEB128_SIZE, address) {- @Override- public DWARFAttributeValue readValue(DWARFFormContext context) throws IOException {- int index = context.reader().readNextUnsignedVarIntExact(LEB128::unsigned);- return new DWARFIndirectAttribute(index, context.def());- }- },+ DW_FORM_strx(0x1a, DWARFForm.LEB128_SIZE, string),+ DW_FORM_addrx(0x1b, DWARFForm.LEB128_SIZE, address),DW_FORM_ref_sup4(0x1c, 4, reference), // unimplDW_FORM_strp_sup(0x1d, DWARFForm.DWARF_INTSIZE, string), // unimplDW_FORM_data16(0x1e, 16, constant) {@@ -248,13 +216,7 @@ public enum DWARFForm {return new DWARFBlobAttribute(context.reader().readNextByteArray(16), context.def());}},- DW_FORM_line_strp(0x1f, DWARFForm.DWARF_INTSIZE, string) {- @Override- public DWARFAttributeValue readValue(DWARFFormContext context) throws IOException {- return new DWARFDeferredStringAttribute(- context.reader().readNextUnsignedValue(context.dwarfIntSize()), context.def());- }- },+ DW_FORM_line_strp(0x1f, DWARFForm.DWARF_INTSIZE, string),DW_FORM_ref_sig8(0x20, 8, reference), // unimplDW_FORM_implicit_const(0x21, 0) {@Override@@ -285,7 +247,12 @@ public enum DWARFForm {DW_FORM_addrx1(0x29, 1, address),DW_FORM_addrx2(0x2a, 2, address),DW_FORM_addrx3(0x2b, 3, address),- DW_FORM_addrx4(0x2c, 4, address);+ DW_FORM_addrx4(0x2c, 4, address),++ DW_FORM_gnu_addr_index(0x1f01, DWARFForm.LEB128_SIZE, address),+ DW_FORM_gnu_str_index(0x1f02, DWARFForm.LEB128_SIZE, string),+ DW_FORM_gnu_ref_alt(0x1f20, DWARFForm.DWARF_INTSIZE, reference),+ DW_FORM_gnu_strp_alt(0x1f21, DWARFForm.DWARF_INTSIZE, string);private final int id;/**@@ -361,6 +328,11 @@ public enum DWARFForm {long index = context.reader().readNextUnsignedValue(size);return new DWARFIndirectAttribute(index, context.def());}+ case DW_FORM_addrx:+ case DW_FORM_gnu_addr_index: {+ int index = context.reader().readNextUnsignedVarIntExact(LEB128::unsigned);+ return new DWARFIndirectAttribute(index, context.def());+ }case DW_FORM_data1:case DW_FORM_data2:@@ -375,8 +347,16 @@ public enum DWARFForm {case DW_FORM_ref4:case DW_FORM_ref8: {long uoffset = context.reader().readNextUnsignedValue(size);- return new DWARFNumericAttribute(uoffset + context.compUnit().getStartOffset(),- context.def());+ return new DWARFNumericAttribute(uoffset, context.def());+ }+ case DW_FORM_ref_addr:+ case DW_FORM_gnu_ref_alt: {+ long addr = context.reader().readNextUnsignedValue(context.dwarfIntSize());+ return new DWARFNumericAttribute(addr, context.def());+ }+ case DW_FORM_ref_udata: {+ long uoffset = context.reader().readNext(LEB128::unsigned);+ return new DWARFNumericAttribute(uoffset, context.def());}case DW_FORM_strx1:@@ -384,7 +364,24 @@ public enum DWARFForm {case DW_FORM_strx3:case DW_FORM_strx4: {long index = context.reader().readNextUnsignedValue(size);- return new DWARFDeferredStringAttribute(index, context.def());+ String s =+ context.compUnit().getProgram().getString(this, index, context.compUnit());+ return new DWARFStringAttribute(s, context.def());+ }+ case DW_FORM_strp:+ case DW_FORM_line_strp:+ case DW_FORM_gnu_strp_alt: {+ long offset = context.reader().readNextUnsignedValue(context.dwarfIntSize());+ String s =+ context.compUnit().getProgram().getString(this, offset, context.compUnit());+ return new DWARFStringAttribute(s, context.def());+ }+ case DW_FORM_strx:+ case DW_FORM_gnu_str_index: {+ int index = context.reader().readNextUnsignedVarIntExact(LEB128::unsigned);+ String s =+ context.compUnit().getProgram().getString(this, index, context.compUnit());+ return new DWARFStringAttribute(s, context.def());}default:diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/bin/format/dwarf/DWARFDataTypeImporterTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/bin/format/dwarf/DWARFDataTypeImporterTest.javaindex 5274e79533..6d9a2fc476 100644--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/bin/format/dwarf/DWARFDataTypeImporterTest.java+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/util/bin/format/dwarf/DWARFDataTypeImporterTest.java@@ -36,15 +36,11 @@ import ghidra.util.exception.CancelledException;*/public class DWARFDataTypeImporterTest extends DWARFTestBase {- /**- * Base type defs without a name should resolve directly to the Ghidra basetype instance.- *- * @throws CancelledException- * @throws IOException- * @throws DWARFException- */@Testpublic void testAnonBaseType() throws CancelledException, IOException, DWARFException {++ // Base type defs without a name should resolve directly to the Ghidra basetype instance.+DebugInfoEntry baseDIE = addBaseType(null, 4, DWARFEncoding.DW_ATE_signed);importAllDataTypes();@@ -69,17 +65,13 @@ public class DWARFDataTypeImporterTest extends DWARFTestBase {assertEquals("mytypedef", tdDT.getName());}- /**- * Base type defs with a non-standard name should resolve to a typedef that points- * to the Ghidra basetype instance.- *- * @throws CancelledException- * @throws IOException- * @throws DWARFException- */@Testpublic void testNonStandardBaseTypeName()throws CancelledException, IOException, DWARFException {++ // Base type defs with a non-standard name should resolve to a typedef that points+ // to the Ghidra basetype instance.+DebugInfoEntry baseDIE = addBaseType("blah", 4, DWARFEncoding.DW_ATE_signed);importAllDataTypes();@@ -194,17 +186,12 @@ public class DWARFDataTypeImporterTest extends DWARFTestBase {assertEquals(100, structdt.getLength());}- /**- * Test structure definition when a struct is fwd decl'd in one CU and fully- * defined in a second CU.- *- * @throws CancelledException- * @throws IOException- * @throws DWARFException- */@Testpublic void testStructDanglingDecl() throws CancelledException, IOException, DWARFException {+ // Test structure definition when a struct is fwd decl'd in one CU and fully+ // defined in a second CU.+// CU1newDeclStruct("mystruct").create();@@ -342,15 +329,11 @@ public class DWARFDataTypeImporterTest extends DWARFTestBase {assertNull(structdt2);}- /**- * Test structure definition when incompatible structure defs are present in two CUs.- * @throws CancelledException- * @throws IOException- * @throws DWARFException- */@Testpublic void testStructConflictDup() throws CancelledException, IOException, DWARFException {+ // Test structure definition when incompatible structure defs are present in two CUs.+// CU1DebugInfoEntry intDIE1 = addInt();DebugInfoEntry floatDIE1 = addFloat();@@ -569,7 +552,7 @@ public class DWARFDataTypeImporterTest extends DWARFTestBase {assertEquals("f1", structdt.getDefinedComponents()[1].getFieldName());}- /**+ /** Tests when two structs in the same namespace have the same name and one includes the* other. (gcc linking options can cause types from different namespaces to be* forced into the root namespace)@@ -579,9 +562,6 @@ public class DWARFDataTypeImporterTest extends DWARFTestBase {* If this test starts failing it means this behavior in Ghidra's DTM has changed and* the DWARF logic needs to be examined in light of those changes.*- * @throws CancelledException- * @throws IOException- * @throws DWARFException*/@Testpublic void testStructMemberWithSameNameAsStruct()@@ -603,16 +583,12 @@ public class DWARFDataTypeImporterTest extends DWARFTestBase {assertEquals("mystruct.conflict", dt1b.getName());}- /**+ /** Tests when two structs have the same absolute type name and one includes the other,* and they are the same size.* <p>* This (incorrectly) triggers an error checking case that prevents structs from* including themselves as members.- *- * @throws CancelledException- * @throws IOException- * @throws DWARFException*/@Test@SuppressWarnings("unused")@@ -1143,15 +1119,11 @@ public class DWARFDataTypeImporterTest extends DWARFTestBase {assertTrue(flexDTC.getDataType() instanceof Array);}- //----------------------------------------------------------------------------------------------- /**- * Test skipping const, volatile data types.- * @throws CancelledException- * @throws IOException- * @throws DWARFException- */@Testpublic void testConstElide() throws CancelledException, IOException, DWARFException {++ // Test skipping const, volatile data types.+DebugInfoEntry intDIE = addInt();DebugInfoEntry constDIE =@@ -1189,21 +1161,11 @@ public class DWARFDataTypeImporterTest extends DWARFTestBase {assertEquals(f1dtc.getDataType(), f4dtc.getDataType());}- // not implemented yet- public void testNamespace() {-- }-- // not implemented yet- public void testNamespaceAnonType() {- // anon struct- }-- /*- * Test array defintions that use upper_bound attribute- */@Testpublic void testArray() throws CancelledException, IOException, DWARFException {++ // Test array definitions that use upper_bound attribute+DebugInfoEntry intDIE = addInt();DebugInfoEntry arrayDIE = newArray(intDIE, false, 10);@@ -1214,11 +1176,11 @@ public class DWARFDataTypeImporterTest extends DWARFTestBase {assertEquals(11, arr.getNumElements());}- /*- * Tests array definitions that use count attribute instead of upper_bounds- */@Testpublic void testArrayWithCountAttr() throws CancelledException, IOException, DWARFException {++ // Tests array definitions that use count attribute instead of upper_bounds+DebugInfoEntry intDIE = addInt();DebugInfoEntry arrayDIE = newArrayUsingCount(intDIE, 10);@@ -1259,28 +1221,6 @@ public class DWARFDataTypeImporterTest extends DWARFTestBase {assertTrue(arr.isZeroLength());}- // not implemented yet- public void testSubr() {- // func ptrs- // unamed, with typedefs pointing to- }-- // not implemented yet- public void testDeclParentVsHeadParent() {- // test that type's name is derived from its decl die location- // instead of its spec location.- }-- // not implemented yet- public void testMangledLinkageNames() {- // test _Zblahblh- }-- // not implemented yet- public void testMangledLinkageInfoFromChildren() {- // grub in children's info for their linkage and use it for us (their parent)- }-private static String longName(String prefix, String sufix, int len) {StringBuilder sb = new StringBuilder(prefix);for (int i = 0; i < len; i++) {@@ -1339,23 +1279,12 @@ public class DWARFDataTypeImporterTest extends DWARFTestBase {assertTrue(s3DNI.getName().length() < nameLenCutoff);}- // not implemented yet- public void testConflictingNamespace() {- // test a conflict between namespace and class symbols and other symbols- // when a DNI is trying to traverse to the final namespace- }-- /**- * Tests that endless loops (impossible without manual editing or intentional creation of bad- * data) does not cause endless loop when processing.- *- * @throws CancelledException- * @throws IOException- * @throws DWARFException- */@Testpublic void testHostilePtrLoop() throws CancelledException, IOException, DWARFException {+ // Tests that endless loops (impossible without manual editing or intentional creation of+ // bad data) does not cause endless loop when processing.+addCompUnit();// hack to make a forward reference to a DIE that hasn't been created yet.@@ -1375,7 +1304,7 @@ public class DWARFDataTypeImporterTest extends DWARFTestBase {assertEquals(dwarfDTM.getVoidType(), ((Pointer) ptrDT).getDataType());}- /**+ /** Tests that struct definitions (ref'd via a pointer) overwrite a previous* empty decl only DIE.* <pre>@@ -1392,10 +1321,6 @@ public class DWARFDataTypeImporterTest extends DWARFTestBase {* The fix isn't to change the resolve logic or equiv logic, but to ensure that the* direct struct datatype DIE is also submitted to the DTM to be resolved, instead of* relying on the result that came out of the DTM when resolving the ptr DIE.- *- * @throws DWARFException- * @throws IOException- * @throws CancelledException*/@Testpublic void testStructDeclViaPtr() throws CancelledException, IOException, DWARFException {@@ -1579,15 +1504,11 @@ public class DWARFDataTypeImporterTest extends DWARFTestBase {assertEquals("abc1", enum2DT.getNames()[0]);}- /**+ /** Test multiple anon enum with multiple typesdefs pointing to each anon enums.* <p>* Multiple inbound typedefs should disable the isCopyRenameAnonTypes feature for that* enum.- *- * @throws CancelledException- * @throws IOException- * @throws DWARFException*/@Testpublic void testMultiAnonEnumWithTypedef2()diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/dwarf/DIECreator.java b/Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/dwarf/DIECreator.javaindex e31bb859d9..2c2ed521cb 100644--- a/Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/dwarf/DIECreator.java+++ b/Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/dwarf/DIECreator.java@@ -63,13 +63,15 @@ public class DIECreator {public DIECreator addRef(DWARFAttribute attribute, DebugInfoEntry die) {AttrDef attrSpec = new AttrDef(attribute, attribute.getId(), DW_FORM_ref8, 0);- add(attrSpec, new DWARFNumericAttribute(die.getOffset(), attrSpec));+ add(attrSpec, new DWARFNumericAttribute(+ die.getOffset() - dwarfProg.getCurrentCompUnit().getStartOffset(), attrSpec));return this;}public DIECreator addRef(DWARFAttribute attribute, long offset) {AttrDef attrSpec = new AttrDef(attribute, attribute.getId(), DW_FORM_ref8, 0);- add(attrSpec, new DWARFNumericAttribute(offset, attrSpec));+ add(attrSpec, new DWARFNumericAttribute(+ offset - dwarfProg.getCurrentCompUnit().getStartOffset(), attrSpec));return this;}