Skip to content

Commit

Permalink
Parse function referenced variables
Browse files Browse the repository at this point in the history
  • Loading branch information
RA-Kooi committed Jan 28, 2022
1 parent e02f24e commit eab7668
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DwarfOne2C/Parsing/BlockParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ private Tag ParseFunction(

if(!line.StartsWith("AT_low_pc")
&& !line.StartsWith("AT_high_pc")
&& !line.StartsWith('(')
&& !ParseReference(line, tag)
&& !ParseName(line, tag)
&& !ParseTypes(line, tag)
&& !ParseLoUser(line, tag)
Expand Down Expand Up @@ -446,7 +446,7 @@ private Tag ParsePadding(
&& !ParseTypes(line, tag)
&& !ParseLoUser(line, tag)
&& !ParseAtMember(line, tag)
&& !line.StartsWith('(')
&& !ParseReference(line, tag)
&& !line.StartsWith("AT_location"))
Console.Error.WriteLine("Unkown attribute: " + line + " @" + current);
}
Expand Down
16 changes: 16 additions & 0 deletions DwarfOne2C/Parsing/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,5 +325,21 @@ private static bool ParseLoUser(string line, Tag tag)

return false;
}

private static bool ParseReference(string line, Tag tag)
{
if(line.StartsWith('('))
{
int reference = Convert.ToInt32(
line.Substring(1, line.Length - 2),
16);

tag.references.Add(reference);

return true;
}

return false;
}
}
}
4 changes: 4 additions & 0 deletions DwarfOne2C/Tags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ public enum TagType

// Padding
public bool isFunction = false;

// Padding
// Function
public List<int> references = new();
}

public class Type
Expand Down

0 comments on commit eab7668

Please sign in to comment.