featuregood first issuehelp wanted
Métriques du dépôt
- Stars
- (5 820 stars)
- Métriques de merge PR
- (Merge moyen 3j 12h) (32 PRs mergées en 30 j)
Description
It would be great to display return addresses in the telescope, stack etc outputs.
I initially worked on it in https://github.com/pwndbg/pwndbg/pull/794 but the patch had some issues.
We should proceed with:
- Move the logic of finding return addresses to
pwndbg.stack.yield_return_addresses, e.g.:
def yield_return_addresses():
sp = pwndbg.regs.sp
stack = pwndbg.vmmap.find(sp)
# Enumerate all return addresses
frame = gdb.newest_frame()
addresses = []
while frame:
addresses.append(frame.pc())
frame = frame.older()
# Find all of them on the stack
start = stack.vaddr
stop = start + stack.memsz
while addresses and start < sp < stop:
value = pwndbg.memory.u(sp)
if value in addresses:
index = addresses.index(value)
del addresses[:index]
yield sp
sp += pwndbg.arch.ptrsize
- Question: shouldn't the first operator (between
startandsp) here:start < sp < stopbe<=? On a quick glance now I think so
- Rethink how to add it into
telescopeand other output
- Shall we display it in all cases or only on demand?
- Rethink if we want to add GDB variables for return addresses. This is really neat, but if we do it, we probably need to do it on each GDB stop and then it may be hurt performance on tough targets when debugging via gdbserver...