diff --git a/pwndbg/qemu.py b/pwndbg/qemu.py index f91c50ce9..a4693d128 100644 --- a/pwndbg/qemu.py +++ b/pwndbg/qemu.py @@ -33,18 +33,15 @@ def is_usermode(): if not pwndbg.remote.is_remote(): return False - - # If we had QEMU 2.4 or better, we could use - # - # maintenance packet QAttached: - # - # However, Ubuntu 14 still has QEMU 2.2, so we have to use - # a different command as a heuristic. - response = gdb.execute('maintenance packet QOffsets', + # There is also 'qAttached' - maybe we can use it too? + # for qemu user though it returned "0"? + # Try with: + # qemu-x86_64 -g 1234 `which ps` + # gdb -nx `which ps` -ex 'target remote :1234' + response = gdb.execute('maintenance packet qOffsets', to_string=True, from_tty=False) - return 'Text=' in response @pwndbg.memoize.reset_on_stop diff --git a/pwndbg/remote.py b/pwndbg/remote.py index 49e5f4f44..3122acc5e 100644 --- a/pwndbg/remote.py +++ b/pwndbg/remote.py @@ -11,6 +11,7 @@ import pwndbg.memoize @pwndbg.memoize.reset_on_objfile +@pwndbg.memoize.reset_on_start def is_remote(): # Example: # pwndbg> maintenance print target-stack