summaryrefslogtreecommitdiffstats
path: root/scripts/qemugdb
diff options
context:
space:
mode:
authorPaolo Bonzini2015-10-12 10:02:54 +0200
committerStefan Hajnoczi2015-10-29 18:59:26 +0100
commita201b0ff28d9fa0f965450c1ba7191eca69f9fd5 (patch)
tree50a0e4f761228f4f86ea9a728fdea19c59aa8f10 /scripts/qemugdb
parentqemu-gdb: extract parts of "qemu coroutine" implementation (diff)
downloadqemu-a201b0ff28d9fa0f965450c1ba7191eca69f9fd5.tar.gz
qemu-a201b0ff28d9fa0f965450c1ba7191eca69f9fd5.tar.xz
qemu-a201b0ff28d9fa0f965450c1ba7191eca69f9fd5.zip
qemu-gdb: add $qemu_coroutine_sp and $qemu_coroutine_pc
These can be useful to manually get a stack trace of a coroutine inside a core dump. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1444636974-19950-4-git-send-email-pbonzini@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'scripts/qemugdb')
-rw-r--r--scripts/qemugdb/coroutine.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/qemugdb/coroutine.py b/scripts/qemugdb/coroutine.py
index b5c86787c4..ab699794ab 100644
--- a/scripts/qemugdb/coroutine.py
+++ b/scripts/qemugdb/coroutine.py
@@ -15,6 +15,8 @@
import gdb
+VOID_PTR = gdb.lookup_type('void').pointer()
+
def get_fs_base():
'''Fetch %fs base value using arch_prctl(ARCH_GET_FS). This is
pthread_self().'''
@@ -101,3 +103,17 @@ class CoroutineCommand(gdb.Command):
return
bt_jmpbuf(coroutine_to_jmpbuf(gdb.parse_and_eval(argv[0])))
+
+class CoroutineSPFunction(gdb.Function):
+ def __init__(self):
+ gdb.Function.__init__(self, 'qemu_coroutine_sp')
+
+ def invoke(self, addr):
+ return get_jmpbuf_regs(coroutine_to_jmpbuf(addr))['rsp'].cast(VOID_PTR)
+
+class CoroutinePCFunction(gdb.Function):
+ def __init__(self):
+ gdb.Function.__init__(self, 'qemu_coroutine_pc')
+
+ def invoke(self, addr):
+ return get_jmpbuf_regs(coroutine_to_jmpbuf(addr))['rip'].cast(VOID_PTR)