Skip to content

Commit

Permalink
Support DWARF attribute form DW_FORM_implicit_const
Browse files Browse the repository at this point in the history
  • Loading branch information
jld01 committed Jul 2, 2023
1 parent 8a8b94b commit 069ee4a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
6 changes: 6 additions & 0 deletions core/org.eclipse.cdt.core/.settings/.api_filters
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.cdt.core" version="2">
<resource path="utils/org/eclipse/cdt/utils/debug/dwarf/DwarfConstants.java" type="org.eclipse.cdt.utils.debug.dwarf.DwarfConstants">
<filter id="336658481">
<message_arguments>
<message_argument value="org.eclipse.cdt.utils.debug.dwarf.DwarfConstants"/>
<message_argument value="DW_FORM_implicit_const"/>
</message_arguments>
</filter>
<filter id="336658481">
<message_arguments>
<message_argument value="org.eclipse.cdt.utils.debug.dwarf.DwarfConstants"/>
Expand Down
2 changes: 1 addition & 1 deletion core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.core; singleton:=true
Bundle-Version: 8.2.200.qualifier
Bundle-Version: 8.3.0.qualifier
Bundle-Activator: org.eclipse.cdt.core.CCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* Salvatore Culcasi - Bug 322475
* Serge Beauchamp - Bug 409916
* John Dallaway - Support DW_FORM_line_strp (#198)
* John Dallaway - Support DW_FORM_implicit_const (#443)
*******************************************************************************/

package org.eclipse.cdt.utils.debug.dwarf;
Expand Down Expand Up @@ -109,17 +110,21 @@ class Attribute {
long name;
/* unsigned */
long form;
/* signed (for DW_FORM_implicit_const) */
long value;

Attribute(long n, long f) {
Attribute(long n, long f, long v) {
name = n;
form = f;
value = v;
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("name: ").append(Long.toHexString(name)); //$NON-NLS-1$
sb.append(" value: ").append(Long.toHexString(form)); //$NON-NLS-1$
sb.append(" format: ").append(Long.toHexString(form)); //$NON-NLS-1$
sb.append(" value: ").append(Long.toHexString(value)); //$NON-NLS-1$
return sb.toString();
}
}
Expand Down Expand Up @@ -579,11 +584,17 @@ Map<Long, AbbreviationEntry> parseDebugAbbreviation(CompilationUnitHeader header
do {
name = read_unsigned_leb128(data);
form = read_unsigned_leb128(data);
long value = 0;
if (DwarfConstants.DW_FORM_implicit_const == form) {
value = read_signed_leb128(data);
}
if (name != 0) {
entry.attributes.add(new Attribute(name, form));
entry.attributes.add(new Attribute(name, form, value));
}
if (printEnabled)
System.out.println("\t\t " + Long.toHexString(name) + " " + Long.toHexString(form)); //$NON-NLS-1$ //$NON-NLS-2$
System.out.println("\t\t " + Long.toHexString(name) //$NON-NLS-1$
+ " " + Long.toHexString(form) //$NON-NLS-1$
+ " " + Long.toHexString(value)); //$NON-NLS-1$
} while (name != 0 && form != 0);
abbrevs.put(Long.valueOf(code), entry);
}
Expand All @@ -603,7 +614,12 @@ void parseDebugInfoEntry(IDebugEntryRequestor requestor, ByteBuffer in, Map<Long
try {
for (int i = 0; i < len; i++) {
Attribute attr = entry.attributes.get(i);
Object obj = readAttribute((int) attr.form, in, header);
Object obj;
if (DwarfConstants.DW_FORM_implicit_const == attr.form) {
obj = Long.valueOf(attr.value);
} else {
obj = readAttribute((int) attr.form, in, header);
}
list.add(new AttributeValue(attr, obj));
}
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Contributors:
* QNX Software Systems - Initial API and implementation
* John Dallaway - Add DW_FORM_line_strp (#198)
* John Dallaway - Add DW_FORM_implicit_const (#443)
*******************************************************************************/

package org.eclipse.cdt.utils.debug.dwarf;
Expand Down Expand Up @@ -216,6 +217,10 @@ public class DwarfConstants {
* @since 5.7
*/
public final static int DW_FORM_ref_sig8 = 0x20;
/**
* @since 8.3
*/
public final static int DW_FORM_implicit_const = 0x21;
/* Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFission. */
/**
* @since 5.7
Expand Down

0 comments on commit 069ee4a

Please sign in to comment.