Skip to content

Commit

Permalink
Fix issue with reading debug files with empty sections
Browse files Browse the repository at this point in the history
  • Loading branch information
TollyH committed Aug 1, 2023
1 parent 3345729 commit 3233a31
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions DebugInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,30 @@ public static DebugInfoFile ParseDebugInfoFile(string fileText)

foreach (string line in fileMatch.Groups["Instructions"].Value.Split('\n'))
{
if (line.Trim() == string.Empty)
{
continue;
}
string[] split = line.Split(" @ ");
assembledInstructions.Add((Convert.ToUInt64(split[0], 16), split[1]));
}

foreach (string line in fileMatch.Groups["Labels"].Value.Split('\n'))
{
if (line.Trim() == string.Empty)
{
continue;
}
string[] split = line.Split(" @ ");
addressLabels.Add((Convert.ToUInt64(split[0], 16), split[1].Split(',')));
}

foreach (string line in fileMatch.Groups["Imports"].Value.Split('\n'))
{
if (line.Trim() == string.Empty)
{
continue;
}
string[] split = line.Split(" @ ");
importLocations.Add((Convert.ToUInt64(split[0], 16), split[1].Split(" -> ")[0].Trim('"')));
}
Expand Down

0 comments on commit 3233a31

Please sign in to comment.