Skip to content

Commit

Permalink
Fix edge case in unmangled function symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
CelestialAmber committed Oct 24, 2024
1 parent 8cd9dbe commit 9a94563
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Source/Core/Core/PowerPC/PPCSymbolDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,15 +424,25 @@ bool PPCSymbolDB::LoadMap(const Core::CPUThreadGuard& guard, const std::string&
{
// If it does, the symbol is likely demangled, so look for the end of the name
size_t nameEndOffset = parenthesisOffset;
while (processed_name[nameEndOffset] != ')')
int depth = 0; // Current parenthesis depth
while (true)
{
char curChar = processed_name[nameEndOffset];
if (curChar == '(')
depth++;
else if (curChar == ')')
depth--;

nameEndOffset++;

if (depth == 0)
break;
}

nameEndOffset++; // Advance past the ending parenthesis

// If the name ends with const, advance past it
if (processed_name.find(") const") != std::string::npos)
if (processed_name.find(") const ") != std::string::npos)
{
nameEndOffset += 6;
}
Expand Down

0 comments on commit 9a94563

Please sign in to comment.