Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account for new header layout in DWARF v5 #214

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.0.0.qualifier
Bundle-Version: 8.0.100.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 @@ -460,11 +460,22 @@ void parseDebugInfo(IDebugEntryRequestor requestor) {
header.offsetSize = sectionLength.offsetSize;

header.version = read_2_bytes(data);
if (header.offsetSize == 8)
header.abbreviationOffset = (int) read_8_bytes(data);
else
header.abbreviationOffset = read_4_bytes(data);
header.addressSize = data.get();
if (header.version >= 5) {
// XXX: We don't use this new field in DWARF v5 yet
var unit_type = data.get();
header.addressSize = data.get();

if (header.offsetSize == 8)
header.abbreviationOffset = (int) read_8_bytes(data);
else
header.abbreviationOffset = read_4_bytes(data);
} else {
if (header.offsetSize == 8)
header.abbreviationOffset = (int) read_8_bytes(data);
else
header.abbreviationOffset = read_4_bytes(data);
header.addressSize = data.get();
}

if (printEnabled) {
System.out.println("Compilation Unit @ " + Long.toHexString(data.position())); //$NON-NLS-1$
Expand All @@ -476,10 +487,20 @@ void parseDebugInfo(IDebugEntryRequestor requestor) {
// A 4-byte or 12-byte unsigned integer representing the length of the .debug_info
// contribution for that compilation unit, not including the length field itself.
ByteBuffer entryBuffer = data.slice();
entryBuffer.limit(((int) header.length) - (header.offsetSize == 8 ? 11 : 7));
int newLimit = ((int) header.length) - (header.offsetSize == 8 ? 11 : 7);
if (header.version >= 5) {
// account for new field in DWARF v5
newLimit -= 1;
}
entryBuffer.limit(newLimit);
parseDebugInfoEntry(requestor, entryBuffer, abbrevs, header);

data.position(data.position() + ((int) header.length) - (header.offsetSize == 8 ? 11 : 7));
int newLimit2 = ((int) header.length) - (header.offsetSize == 8 ? 11 : 7);
if (header.version >= 5) {
// account for new field in DWARF v5
newLimit2 -= 1;
}
data.position(data.position() + newLimit2);

if (printEnabled)
System.out.println();
Expand Down