1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-13 19:25:38 +02:00

Support DWARF attribute form DW_FORM_implicit_const

This commit is contained in:
John Dallaway 2023-07-02 14:49:00 +01:00
parent 8a8b94bfbb
commit 54d5e1445c
4 changed files with 33 additions and 6 deletions

View file

@ -1,6 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.cdt.core" version="2"> <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"> <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"> <filter id="336658481">
<message_arguments> <message_arguments>
<message_argument value="org.eclipse.cdt.utils.debug.dwarf.DwarfConstants"/> <message_argument value="org.eclipse.cdt.utils.debug.dwarf.DwarfConstants"/>

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.core; singleton:=true 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-Activator: org.eclipse.cdt.core.CCorePlugin
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-Localization: plugin Bundle-Localization: plugin

View file

@ -13,6 +13,7 @@
* Salvatore Culcasi - Bug 322475 * Salvatore Culcasi - Bug 322475
* Serge Beauchamp - Bug 409916 * Serge Beauchamp - Bug 409916
* John Dallaway - Support DW_FORM_line_strp (#198) * John Dallaway - Support DW_FORM_line_strp (#198)
* John Dallaway - Support DW_FORM_implicit_const (#443)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.utils.debug.dwarf; package org.eclipse.cdt.utils.debug.dwarf;
@ -109,17 +110,21 @@ public class Dwarf implements AutoCloseable {
long name; long name;
/* unsigned */ /* unsigned */
long form; long form;
/* signed (for DW_FORM_implicit_const) */
long value;
Attribute(long n, long f) { Attribute(long n, long f, long v) {
name = n; name = n;
form = f; form = f;
value = v;
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("name: ").append(Long.toHexString(name)); //$NON-NLS-1$ sb.append("name: ").append(Long.toHexString(name)); //$NON-NLS-1$
sb.append(" value: ").append(Long.toHexString(form)); //$NON-NLS-1$ sb.append(" form: ").append(Long.toHexString(form)); //$NON-NLS-1$
sb.append(" value: ").append(Long.toHexString(value)); //$NON-NLS-1$
return sb.toString(); return sb.toString();
} }
} }
@ -579,11 +584,17 @@ public class Dwarf implements AutoCloseable {
do { do {
name = read_unsigned_leb128(data); name = read_unsigned_leb128(data);
form = 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) { if (name != 0) {
entry.attributes.add(new Attribute(name, form)); entry.attributes.add(new Attribute(name, form, value));
} }
if (printEnabled) 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); } while (name != 0 && form != 0);
abbrevs.put(Long.valueOf(code), entry); abbrevs.put(Long.valueOf(code), entry);
} }
@ -603,7 +614,12 @@ public class Dwarf implements AutoCloseable {
try { try {
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
Attribute attr = entry.attributes.get(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)); list.add(new AttributeValue(attr, obj));
} }
} catch (IOException e) { } catch (IOException e) {

View file

@ -11,6 +11,7 @@
* Contributors: * Contributors:
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
* John Dallaway - Add DW_FORM_line_strp (#198) * John Dallaway - Add DW_FORM_line_strp (#198)
* John Dallaway - Add DW_FORM_implicit_const (#443)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.utils.debug.dwarf; package org.eclipse.cdt.utils.debug.dwarf;
@ -216,6 +217,10 @@ public class DwarfConstants {
* @since 5.7 * @since 5.7
*/ */
public final static int DW_FORM_ref_sig8 = 0x20; 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. */ /* Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFission. */
/** /**
* @since 5.7 * @since 5.7