[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/4] scripts/qemugdb: improve "qemu coroutine" comma
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[Qemu-devel] [PATCH 2/4] scripts/qemugdb: improve "qemu coroutine" command |
Date: |
Wed, 28 Mar 2018 20:32:36 +0300 |
- print regs
- catch exception for coredump debugging
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---
scripts/qemugdb/coroutine.py | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/scripts/qemugdb/coroutine.py b/scripts/qemugdb/coroutine.py
index ffaa45c464..7070a592f3 100644
--- a/scripts/qemugdb/coroutine.py
+++ b/scripts/qemugdb/coroutine.py
@@ -80,9 +80,8 @@ def get_jmpbuf_regs(jmpbuf):
'r15': jmpbuf[JB_R15],
'rip': glibc_ptr_demangle(jmpbuf[JB_PC], pointer_guard) }
-def bt_jmpbuf(jmpbuf):
- '''Backtrace a jmpbuf'''
- regs = get_jmpbuf_regs(jmpbuf)
+def bt_regs(regs):
+ '''Backtrace with specified regs'''
old = dict()
for i in regs:
@@ -113,7 +112,18 @@ class CoroutineCommand(gdb.Command):
gdb.write('usage: qemu coroutine <coroutine-pointer>\n')
return
- bt_jmpbuf(coroutine_to_jmpbuf(gdb.parse_and_eval(argv[0])))
+ jmpbuf = coroutine_to_jmpbuf(gdb.parse_and_eval(argv[0]))
+ regs = get_jmpbuf_regs(jmpbuf)
+ for k, v in regs.iteritems():
+ gdb.write('%s: 0x%x\n' %(k,v))
+
+ gdb.write('\n')
+
+ try:
+ bt_regs(regs)
+ except gdb.error:
+ print "Coroutine backtrace can't be obtained without " \
+ "a process to debug."
class CoroutineSPFunction(gdb.Function):
def __init__(self):
--
2.11.1