Skip to content

Commit

Permalink
fixing a parsing error (#115)
Browse files Browse the repository at this point in the history
The parsing assumes a 4 lines header, which is removed and assumes to blank line.
However, it appears to have blank lines in the output, which causes index out of range errors. 
Solution: 1) splitting on the last part of the header "objfile" to remove unwanted header lines, and then ignoring the blank lines while parsing.
  • Loading branch information
kindtrojan authored Jan 6, 2023
1 parent 25de83f commit dd3f025
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions avatar2/plugins/gdb_memory_map_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def load_memory_mappings(avatar, target, forward=False, update=True):
raise TypeError("The memory mapping can be loaded ony from GDBTargets")

ret, resp = target.protocols.execution.get_mappings()
lines = resp.split("\n")[4:]
lines = resp.split("objfile")[-1].split("\n")
mappings = [
{
"start": int(x[0], 16),
Expand All @@ -35,7 +35,7 @@ def load_memory_mappings(avatar, target, forward=False, update=True):
"offset": int(x[3], 16),
"obj": x[4],
}
for x in [y.split() for y in lines]
for x in [y.split() for y in lines if y != ""]
]
memory_ranges = IntervalTree()

Expand Down

0 comments on commit dd3f025

Please sign in to comment.