diff --git a/Ryujinx.Core/OsHle/Process.cs b/Ryujinx.Core/OsHle/Process.cs index 8520b9ad93..f9b90021e4 100644 --- a/Ryujinx.Core/OsHle/Process.cs +++ b/Ryujinx.Core/OsHle/Process.cs @@ -290,6 +290,57 @@ namespace Ryujinx.Core.OsHle Ns.Log.PrintDebug(LogClass.Cpu, $"Executing at 0x{e.Position:x16} {e.SubName} {NsoName}"); } + private string DemangleName(string mangled) + { + string result = null; + string charCountTemp = null; + int charCount = 0; + foreach(var chr in mangled) + { + if (charCount == 0) + { + if (charCountTemp == null) + { + if (chr == 'r' || chr == 'V' || chr == 'K') + { + continue; + } + if (chr == 'E') + { + break; + } + } + if (Char.IsDigit(chr)) + { + charCountTemp += chr; + } + else + { + if (!int.TryParse(charCountTemp, out charCount)) + { + return mangled; + } + result += chr; + charCount--; + charCountTemp = null; + } + } + else + { + result += chr; + charCount--; + if (charCount == 0) + { + result += "::"; + } + } + } + if (result == null) + { + return mangled; + } + return result.Substring(0, result.Length - 2); + } public void PrintStackTrace(AThreadState ThreadState) { long[] Positions = ThreadState.GetCallStack(); @@ -304,6 +355,10 @@ namespace Ryujinx.Core.OsHle { SubName = $"Sub{Position:x16}"; } + else if (SubName.StartsWith("_ZN")) + { + SubName = DemangleName(SubName.Substring(3)); + } Trace.AppendLine(" " + SubName + " (" + GetNsoNameAndAddress(Position) + ")"); }