-
Notifications
You must be signed in to change notification settings - Fork 852
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only look for readable address in retaddr command (#2143)
* Only look for readable address in retaddr command * Rename stack.py to retaddr.py * Add pwndbg.gdblib.stack.callstack and use it in retaddr * Add callstack gdb test * Add QEMU callstack test
- Loading branch information
Showing
5 changed files
with
52 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from __future__ import annotations | ||
|
||
import gdb | ||
|
||
import pwndbg.gdblib.memory | ||
import pwndbg.gdblib.stack | ||
import tests | ||
|
||
REFERENCE_BINARY = tests.binaries.get("reference-binary.out") | ||
|
||
|
||
def test_callstack_readable(start_binary): | ||
start_binary(REFERENCE_BINARY) | ||
gdb.execute("b break_here") | ||
gdb.execute("r") | ||
|
||
addresses = pwndbg.gdblib.stack.callstack() | ||
|
||
assert len(addresses) > 0 | ||
assert all(pwndbg.gdblib.memory.is_readable_address(address) for address in addresses) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from __future__ import annotations | ||
|
||
import pwndbg.gdblib.memory | ||
import pwndbg.gdblib.stack | ||
|
||
|
||
def test_callstack_readable(): | ||
addresses = pwndbg.gdblib.stack.callstack() | ||
|
||
assert len(addresses) > 0 | ||
assert all(pwndbg.gdblib.memory.is_readable_address(address) for address in addresses) |