diff --git a/UI/Debugger/Integration/ElfImporter.cs b/UI/Debugger/Integration/ElfImporter.cs index 502cce85..409224c8 100644 --- a/UI/Debugger/Integration/ElfImporter.cs +++ b/UI/Debugger/Integration/ElfImporter.cs @@ -57,7 +57,6 @@ private void PrivateImport(string path, bool showResult, CpuType cpuType) continue; } - //Demangle and replace any invalid characters with underscores name = LabelManager.InvalidLabelRegex.Replace(Demangle(name), "_"); @@ -106,11 +105,11 @@ private static string Demangle(string name) List parts = new(); int i = 0; - while(i < name.Length && (name[i] < '0' || name[i] > '9')) { - i++; - } - while(true) { + while(i < name.Length && (name[i] < '0' || name[i] > '9')) { + i++; + } + bool hasLen = false; int start = i; while(i < name.Length && name[i] >= '0' && name[i] <= '9') { @@ -121,7 +120,7 @@ private static string Demangle(string name) if(hasLen) { int val = int.Parse(name.AsSpan(start, i - start)); - if(start + val <= name.Length) { + if(i + val <= name.Length) { string part = name.Substring(i, val); if(!string.IsNullOrWhiteSpace(part) && part != "_GLOBAL__N_1") { parts.Add(part); @@ -188,10 +187,6 @@ protected override bool TryGetSymbolInfo(SymbolEntry symbol, int romSize, { symbolInfo = null; - if(symbol.Type == SymbolType.Object) { - return false; - } - uint value = symbol.Value & ~(uint)0x01; AddressInfo relAddr = new AddressInfo() { Address = (int)value, Type = MemoryType.GbaMemory }; AddressInfo absAddr = DebugApi.GetAbsoluteAddress(relAddr);