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
|
/*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);
|
const DIEType* type = dynamic_cast<const DIEType*>(entry);
|
||||||
if (type == NULL)
|
if (type == NULL)
|
||||||
@ -79,7 +80,7 @@ DwarfUtils::GetDIETypeName(const DebugInfoEntry* entry, BString& _name)
|
|||||||
if (type == NULL)
|
if (type == NULL)
|
||||||
typeName = "void";
|
typeName = "void";
|
||||||
else
|
else
|
||||||
GetFullyQualifiedDIEName(type, typeName);
|
GetFullyQualifiedDIEName(type, typeName, requestingEntry);
|
||||||
|
|
||||||
if (modifier.Length() > 0) {
|
if (modifier.Length() > 0) {
|
||||||
if (modifier[modifier.Length() - 1] == ' ')
|
if (modifier[modifier.Length() - 1] == ' ')
|
||||||
@ -163,7 +164,7 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name)
|
|||||||
BString paramName;
|
BString paramName;
|
||||||
BString modifier;
|
BString modifier;
|
||||||
DIEType* type = parameter->GetType();
|
DIEType* type = parameter->GetType();
|
||||||
GetDIETypeName(type, paramName);
|
GetDIETypeName(type, paramName, entry);
|
||||||
|
|
||||||
if (firstParameter)
|
if (firstParameter)
|
||||||
firstParameter = false;
|
firstParameter = false;
|
||||||
@ -185,7 +186,7 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name)
|
|||||||
|
|
||||||
/*static*/ void
|
/*static*/ void
|
||||||
DwarfUtils::GetFullyQualifiedDIEName(const DebugInfoEntry* entry,
|
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
|
// If we don't seem to have a name but an abstract origin, return the
|
||||||
// origin's name.
|
// origin's name.
|
||||||
@ -207,6 +208,8 @@ DwarfUtils::GetFullyQualifiedDIEName(const DebugInfoEntry* entry,
|
|||||||
// Get the namespace, if any.
|
// Get the namespace, if any.
|
||||||
DebugInfoEntry* parent = entry->Parent();
|
DebugInfoEntry* parent = entry->Parent();
|
||||||
while (parent != NULL) {
|
while (parent != NULL) {
|
||||||
|
if (parent == requestingEntry)
|
||||||
|
break;
|
||||||
if (parent->IsNamespace()) {
|
if (parent->IsNamespace()) {
|
||||||
BString parentName;
|
BString parentName;
|
||||||
GetFullyQualifiedDIEName(parent, parentName);
|
GetFullyQualifiedDIEName(parent, parentName);
|
||||||
|
@ -19,12 +19,16 @@ public:
|
|||||||
static void GetDIEName(const DebugInfoEntry* entry,
|
static void GetDIEName(const DebugInfoEntry* entry,
|
||||||
BString& _name);
|
BString& _name);
|
||||||
static void GetDIETypeName(const DebugInfoEntry* entry,
|
static void GetDIETypeName(const DebugInfoEntry* entry,
|
||||||
BString& _name);
|
BString& _name,
|
||||||
|
const DebugInfoEntry*
|
||||||
|
requestingEntry = NULL);
|
||||||
static void GetFullDIEName(const DebugInfoEntry* entry,
|
static void GetFullDIEName(const DebugInfoEntry* entry,
|
||||||
BString& _name);
|
BString& _name);
|
||||||
static void GetFullyQualifiedDIEName(
|
static void GetFullyQualifiedDIEName(
|
||||||
const DebugInfoEntry* entry,
|
const DebugInfoEntry* entry,
|
||||||
BString& _name);
|
BString& _name,
|
||||||
|
const DebugInfoEntry*
|
||||||
|
requestingEntry = NULL);
|
||||||
|
|
||||||
static bool GetDeclarationLocation(DwarfFile* dwarfFile,
|
static bool GetDeclarationLocation(DwarfFile* dwarfFile,
|
||||||
const DebugInfoEntry* entry,
|
const DebugInfoEntry* entry,
|
||||||
|
Loading…
Reference in New Issue
Block a user