From 6066a80794e6bc6e37f8e6241033714ef382ad73 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Thu, 8 Dec 2011 16:20:35 -0500 Subject: [PATCH] Fix handling of variable specifications. In the case of variables that refer to static members of compound types, the specification will be a reference to a DIEMember rather than a DIEVariable in DWARF3. Relax our restrictions accordingly. --- src/apps/debugger/dwarf/DebugInfoEntries.cpp | 7 +++++++ src/apps/debugger/dwarf/DebugInfoEntries.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/apps/debugger/dwarf/DebugInfoEntries.cpp b/src/apps/debugger/dwarf/DebugInfoEntries.cpp index dbc7509dc9..34b0b4c890 100644 --- a/src/apps/debugger/dwarf/DebugInfoEntries.cpp +++ b/src/apps/debugger/dwarf/DebugInfoEntries.cpp @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2011, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -2169,6 +2170,12 @@ DIEVariable::AddAttribute_specification(uint16 attributeName, const AttributeValue& value) { fSpecification = dynamic_cast(value.reference); + // in the case of static variables declared within a compound type, + // the specification may point to a member entry rather than + // a variable entry + if (fSpecification == NULL) + fSpecification = dynamic_cast(value.reference); + return fSpecification != NULL ? B_OK : B_BAD_DATA; } diff --git a/src/apps/debugger/dwarf/DebugInfoEntries.h b/src/apps/debugger/dwarf/DebugInfoEntries.h index dbbc0b8ff8..6f7d904528 100644 --- a/src/apps/debugger/dwarf/DebugInfoEntries.h +++ b/src/apps/debugger/dwarf/DebugInfoEntries.h @@ -1413,7 +1413,7 @@ private: LocationDescription fLocationDescription; ConstantAttributeValue fValue; DIEType* fType; - DIEVariable* fSpecification; + DebugInfoEntry* fSpecification; DIEVariable* fAbstractOrigin; uint64 fStartScope; };