Debugger: fix infinite recursion when resolving lambdas
* Should fix #14346. Uploaded executable there doesn't work anymore, but this patch is prepared for case in #16040, and fixes #16680 too. * The issue is that if lambda parameters use an alias, this alias has that lambda as a parent. Specifically the compiler generates operator() subprogram, Debugger tries to resolve types for its parameters, but at the same time it is a parent namespace for those types. * Call chain: operator()( -> type 1 -> namespace: operator()( -> type 1 -> namespace: operator()( -> ... Change-Id: I7aad150a8d9de4f0c01ae0c1db5e486416b72112 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3824 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
parent
e7438cbeba
commit
a78899d40a
@ -40,7 +40,8 @@ DwarfUtils::GetDIEName(const DebugInfoEntry* entry, BString& _name)
|
||||
|
||||
|
||||
/*static*/ void
|
||||
DwarfUtils::GetDIETypeName(const DebugInfoEntry* entry, BString& _name)
|
||||
DwarfUtils::GetDIETypeName(const DebugInfoEntry* entry, BString& _name,
|
||||
const DebugInfoEntry* requestingEntry)
|
||||
{
|
||||
const DIEType* type = dynamic_cast<const DIEType*>(entry);
|
||||
if (type == NULL)
|
||||
@ -79,7 +80,7 @@ DwarfUtils::GetDIETypeName(const DebugInfoEntry* entry, BString& _name)
|
||||
if (type == NULL)
|
||||
typeName = "void";
|
||||
else
|
||||
GetFullyQualifiedDIEName(type, typeName);
|
||||
GetFullyQualifiedDIEName(type, typeName, requestingEntry);
|
||||
|
||||
if (modifier.Length() > 0) {
|
||||
if (modifier[modifier.Length() - 1] == ' ')
|
||||
@ -163,7 +164,7 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name)
|
||||
BString paramName;
|
||||
BString modifier;
|
||||
DIEType* type = parameter->GetType();
|
||||
GetDIETypeName(type, paramName);
|
||||
GetDIETypeName(type, paramName, entry);
|
||||
|
||||
if (firstParameter)
|
||||
firstParameter = false;
|
||||
@ -185,7 +186,7 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name)
|
||||
|
||||
/*static*/ void
|
||||
DwarfUtils::GetFullyQualifiedDIEName(const DebugInfoEntry* entry,
|
||||
BString& _name)
|
||||
BString& _name, const DebugInfoEntry* requestingEntry)
|
||||
{
|
||||
// If we don't seem to have a name but an abstract origin, return the
|
||||
// origin's name.
|
||||
@ -207,6 +208,8 @@ DwarfUtils::GetFullyQualifiedDIEName(const DebugInfoEntry* entry,
|
||||
// Get the namespace, if any.
|
||||
DebugInfoEntry* parent = entry->Parent();
|
||||
while (parent != NULL) {
|
||||
if (parent == requestingEntry)
|
||||
break;
|
||||
if (parent->IsNamespace()) {
|
||||
BString parentName;
|
||||
GetFullyQualifiedDIEName(parent, parentName);
|
||||
|
@ -19,12 +19,16 @@ public:
|
||||
static void GetDIEName(const DebugInfoEntry* entry,
|
||||
BString& _name);
|
||||
static void GetDIETypeName(const DebugInfoEntry* entry,
|
||||
BString& _name);
|
||||
BString& _name,
|
||||
const DebugInfoEntry*
|
||||
requestingEntry = NULL);
|
||||
static void GetFullDIEName(const DebugInfoEntry* entry,
|
||||
BString& _name);
|
||||
static void GetFullyQualifiedDIEName(
|
||||
const DebugInfoEntry* entry,
|
||||
BString& _name);
|
||||
BString& _name,
|
||||
const DebugInfoEntry*
|
||||
requestingEntry = NULL);
|
||||
|
||||
static bool GetDeclarationLocation(DwarfFile* dwarfFile,
|
||||
const DebugInfoEntry* entry,
|
||||
|
Loading…
Reference in New Issue
Block a user