All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-devel@nongnu.org
Cc: stefanha@redhat.com, pbonzini@redhat.com,
	vsementsov@virtuozzo.com, den@openvz.org
Subject: [Qemu-devel] [PATCH 2/4] scripts/qemugdb: improve "qemu coroutine" command
Date: Wed, 28 Mar 2018 20:32:36 +0300	[thread overview]
Message-ID: <20180328173238.507470-3-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20180328173238.507470-1-vsementsov@virtuozzo.com>

 - print regs
 - catch exception for coredump debugging

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 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

  parent reply	other threads:[~2018-03-28 17:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 17:32 [Qemu-devel] [PATCH 0/4] qemugdb: coroutine backtrace for coredump Vladimir Sementsov-Ogievskiy
2018-03-28 17:32 ` [Qemu-devel] [PATCH 1/4] scripts/qemugdb: get pthread_self from "info threads" command Vladimir Sementsov-Ogievskiy
2018-04-04  9:52   ` Paolo Bonzini
2018-04-04  9:57   ` Stefan Hajnoczi
2018-03-28 17:32 ` Vladimir Sementsov-Ogievskiy [this message]
2018-04-04 10:37   ` [Qemu-devel] [PATCH 2/4] scripts/qemugdb: improve "qemu coroutine" command Stefan Hajnoczi
2018-03-28 17:32 ` [Qemu-devel] [PATCH 3/4] scripts/qemugdb: add coredump.py for coredump patching Vladimir Sementsov-Ogievskiy
2018-03-28 17:32 ` [Qemu-devel] [PATCH 4/4] scripts/qemugdb: backtraces for coroutines in coredump Vladimir Sementsov-Ogievskiy
2018-04-04 10:36   ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180328173238.507470-3-vsementsov@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.