[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/12] qemu-gdb: add $qemu_coroutine_sp and $qemu_cor
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 03/12] qemu-gdb: add $qemu_coroutine_sp and $qemu_coroutine_pc |
Date: |
Thu, 29 Oct 2015 18:09:16 +0000 |
From: Paolo Bonzini <address@hidden>
These can be useful to manually get a stack trace of a coroutine inside
a core dump.
Signed-off-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
scripts/qemu-gdb.py | 3 +++
scripts/qemugdb/coroutine.py | 16 ++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/scripts/qemu-gdb.py b/scripts/qemu-gdb.py
index d6f2e5a..ef2fd19 100644
--- a/scripts/qemu-gdb.py
+++ b/scripts/qemu-gdb.py
@@ -38,6 +38,9 @@ QemuCommand()
coroutine.CoroutineCommand()
mtree.MtreeCommand()
+coroutine.CoroutineSPFunction()
+coroutine.CoroutinePCFunction()
+
# Default to silently passing through SIGUSR1, because QEMU sends it
# to itself a lot.
gdb.execute('handle SIGUSR1 pass noprint nostop')
diff --git a/scripts/qemugdb/coroutine.py b/scripts/qemugdb/coroutine.py
index b5c8678..ab69979 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)
--
2.4.3
- [Qemu-devel] [PULL 00/12] Block patches, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 01/12] qemu-gdb: allow using glibc_pointer_guard() on core dumps, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 02/12] qemu-gdb: extract parts of "qemu coroutine" implementation, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 04/12] s390x: include HW_COMPAT_* props, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 06/12] virtio-blk: switch off scsi-passthrough by default, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 03/12] qemu-gdb: add $qemu_coroutine_sp and $qemu_coroutine_pc,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 05/12] ppc/spapr: add 2.4 compat props, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 07/12] gdb command: qemu handlers, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 08/12] virtio: sync the dataplane vring state to the virtqueue before virtio_save, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 11/12] target-arm: xlnx-zynqmp: Add sdhci support., Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 10/12] sdhci: Split sdhci.h for public and internal device usage, Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 12/12] block: Consider all child nodes in bdrv_requests_pending(), Stefan Hajnoczi, 2015/10/29
- [Qemu-devel] [PULL 09/12] sd.h: Move sd.h to include/hw/sd/, Stefan Hajnoczi, 2015/10/29
- Re: [Qemu-devel] [PULL 00/12] Block patches, Peter Maydell, 2015/10/30