Skip to content

Commit

Permalink
Fix finding local symbols in .dbg.locals section
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
peace-maker authored and dvander committed Feb 1, 2019
1 parent 34ccc0b commit 21b93b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/smxtools/smxdasm/Sections.cs
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 21b93b3

Please sign in to comment.