Skip to content

Commit

Permalink
[gdb] Fix UartBuffer pointer address
Browse files Browse the repository at this point in the history
  • Loading branch information
niklaut committed Jul 30, 2024
1 parent 5183c34 commit a8fa9d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Substitute GitHub CI path with local path by default.
- Show stack overflow warning if stack usage >90%.
- Do not attempt to load SVD file if target is unknown.
- Fix UartBuffer pointer address computation.

## 1.5.2

Expand Down
7 changes: 4 additions & 3 deletions src/emdbg/debug/px4/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ def children(self) -> Iterator[tuple[str, Any]]:
yield ("buffer", self._buf['buffer'])
yield ("tail -> head", f"{tail} -> {head}: {used} used, {free} free")
if used:
ptr = int(self._buf['buffer'].address)
if (tail < head):
# [tail, head]
memories = [self.read_memory(self._buf['buffer'] + tail, used)]
memories = [self.read_memory(ptr + tail, used)]
else:
# head], [tail
memories = [self.read_memory(self._buf['buffer'] + tail, size - tail),
self.read_memory(self._buf['buffer'], head)]
memories = [self.read_memory(ptr + tail, size - tail),
self.read_memory(ptr, head)]
# Convert to Prints else \hh hex values
content = "".join(chr(v) if chr(v).isprintable() else f"\\{v:02x}"
for memory in memories
Expand Down

0 comments on commit a8fa9d0

Please sign in to comment.