From 21b93b3e50cadf4a60038a6069babe4d31c83a08 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Wed, 23 Jan 2019 20:28:57 +0100 Subject: [PATCH] Fix finding local symbols in .dbg.locals section FindLocal would crash if the .dbg.methods section was missing instead of just looking through the whole .dbg.locals section. Access to array variables wasn't detected properly too. --- tools/smxtools/smxdasm/Sections.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/smxtools/smxdasm/Sections.cs b/tools/smxtools/smxdasm/Sections.cs index 1f1647b88..fa5146c61 100644 --- a/tools/smxtools/smxdasm/Sections.cs +++ b/tools/smxtools/smxdasm/Sections.cs @@ -566,7 +566,7 @@ public SmxDebugLocals(SmxFile smx_file, FileHeader file, SectionEntry header, Sm public DebugVarEntry FindLocal(int codeaddr, int address) { int start_at = 0; - int stop_at = smx_file_.DebugMethods.Entries.Length; + int stop_at = Entries.Length; if (smx_file_.DebugMethods != null && smx_file_.RttiMethods != null) { int? index = null; @@ -599,7 +599,7 @@ public DebugVarEntry FindLocal(int codeaddr, int address) return sym; if (i == stop_at - 1) break; - var next_sym = Entries[stop_at + 1]; + var next_sym = Entries[i + 1]; if (address > sym.address && address < next_sym.address) return sym; }