mirror of https://github.com/pwndbg/pwndbg
Fix stack.update caching bug (#1703)
The `pwndbg.gdblib.regs.sp` value is cached and its cache is cleared on a next stop, memory write or register write events. We keep a dictionary of stacks in Pwndbg, that are updated on each stop by the `stack.update` functionality which reused a cached stack pointer (`gdblib.regs.sp`) value. As a result, if we had more than one threads, the `pwndbg.gdblib.stacks.stacks` reported the same stack address for all threads and then the `canary` command printed the same addresses N times where N is the number of threads that were running. This commit fixes this bug by clearing up the registers cache when we switch into a different thread in the loop in the `stacks.update` function.
This commit is contained in:
parent
3bc91c1cb2
commit
e77c6f5c2e
|
@ -62,6 +62,7 @@ def update() -> None:
|
|||
try:
|
||||
for thread in gdb.selected_inferior().threads():
|
||||
thread.switch()
|
||||
pwndbg.gdblib.regs.__getattr__.cache.clear()
|
||||
sp = pwndbg.gdblib.regs.sp
|
||||
|
||||
# Skip if sp is None or 0
|
||||
|
|
Loading…
Reference in New Issue