-
Notifications
You must be signed in to change notification settings - Fork 852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
telescope: display retaddrs #794
Conversation
Extends `telescope` command so it displays not only register names, but also return addresses names (ret0, ret1, ret2, ...). The names are also set as GDB variables so they can be referenced via `$retX` similarly as registers are by default. Additionally, I moved the `retaddr` command from pwndbg/commands/stack.py to pwndbg/commands/retaddr.py.
One thing I am concerned about: I guess it will crash the command if stack frame is totally broken. We should probably handle this gracefully. Also: setting GDB variables is not ideal: they are not refreshed e.g. on break and only on telescope, so a variable may hold old values or, e.g., a |
import pwndbg.arch | ||
import pwndbg.chain | ||
import pwndbg.commands | ||
import pwndbg.regs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those imports need to be fixed
name = 'ret%d' % idx | ||
names_values[retaddr].append(name) | ||
# Set $retX variable so it can be used by the user | ||
gdb.execute("set $%s=0x%x" % (name, retaddr)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the GDB variable setting, should probably be removed from the PR.
We already have ROP handling through Unicorn emulation, we may be able to rely on that in order to get higher-quality information so we don't have to worry about crashing the |
I am closing this for now, I will add an issue for it. |
Extends
telescope
command so it displays not only register names, butalso return addresses names (ret0, ret1, ret2, ...).
The names are also set as GDB variables so they can be referenced via
$retX
similarly as registers are by default.Additionally, I moved the
retaddr
command frompwndbg/commands/stack.py to pwndbg/commands/retaddr.py.