[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/20] scripts/gdb: fix 'qemu coroutine' when users selects a non
From: |
Paolo Bonzini |
Subject: |
[PULL 09/20] scripts/gdb: fix 'qemu coroutine' when users selects a non topmost stack frame |
Date: |
Tue, 12 Jan 2021 18:14:39 +0100 |
From: Maxim Levitsky <mlevitsk@redhat.com>
The code that dumps the stack frame works like that:
* save current registers
* overwrite current registers (including rip/rsp) with coroutine snapshot
in the jmpbuf
* print backtrace
* restore the saved registers.
If the user has currently selected a non topmost stack frame in gdb,
the above code will still restore the selected frame registers,
but the gdb will then lose the selected frame index, which makes it impossible
to switch back to frame 0, to continue debugging the executable.
Therefore switch temporarily to the topmost frame of the stack
for the above code.
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20201217155436.927320-2-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
scripts/qemugdb/coroutine.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/scripts/qemugdb/coroutine.py b/scripts/qemugdb/coroutine.py
index db61389022..e1399211e6 100644
--- a/scripts/qemugdb/coroutine.py
+++ b/scripts/qemugdb/coroutine.py
@@ -70,6 +70,11 @@ def bt_jmpbuf(jmpbuf):
regs = get_jmpbuf_regs(jmpbuf)
old = dict()
+ # remember current stack frame and select the topmost
+ # so that register modifications don't wreck it
+ selected_frame = gdb.selected_frame()
+ gdb.newest_frame().select()
+
for i in regs:
old[i] = gdb.parse_and_eval('(uint64_t)$%s' % i)
@@ -81,6 +86,8 @@ def bt_jmpbuf(jmpbuf):
for i in regs:
gdb.execute('set $%s = %s' % (i, old[i]))
+ selected_frame.select()
+
def coroutine_to_jmpbuf(co):
coroutine_pointer = co.cast(gdb.lookup_type('CoroutineUContext').pointer())
return coroutine_pointer['env']['__jmpbuf']
--
2.29.2
- [PULL 00/20] Misc patches for 2021-01-12, Paolo Bonzini, 2021/01/12
- [PULL 01/20] meson: do not use CONFIG_VIRTFS, Paolo Bonzini, 2021/01/12
- [PULL 07/20] whpx: move whpx_lapic_state from header to c file, Paolo Bonzini, 2021/01/12
- [PULL 02/20] whpx: rename whp-dispatch to whpx-internal.h, Paolo Bonzini, 2021/01/12
- [PULL 06/20] maintainers: Add me as Windows Hosted Continuous Integration maintainer, Paolo Bonzini, 2021/01/12
- [PULL 04/20] cirrus/msys2: Exit powershell with $LastExitCode, Paolo Bonzini, 2021/01/12
- [PULL 03/20] whpx: move internal definitions to whpx-internal.h, Paolo Bonzini, 2021/01/12
- [PULL 18/20] configure: move Cocoa incompatibility checks to Meson, Paolo Bonzini, 2021/01/12
- [PULL 20/20] target/i386: Use X86Seg enum for segment registers, Paolo Bonzini, 2021/01/12
- [PULL 05/20] cirrus/msys2: Cache msys2 mingw in a better way., Paolo Bonzini, 2021/01/12
- [PULL 09/20] scripts/gdb: fix 'qemu coroutine' when users selects a non topmost stack frame,
Paolo Bonzini <=
- [PULL 08/20] meson: fix Cocoa option in summary, Paolo Bonzini, 2021/01/12
- [PULL 10/20] scripts/gdb: implement 'qemu bt', Paolo Bonzini, 2021/01/12
- [PULL 11/20] Docs/RCU: Correct sample code of qatomic_rcu_set, Paolo Bonzini, 2021/01/12
- [PULL 14/20] cocoa: do not enable coreaudio automatically, Paolo Bonzini, 2021/01/12
- [PULL 12/20] meson: Propagate gnutls dependency, Paolo Bonzini, 2021/01/12
- [PULL 13/20] virtio-scsi: trace events, Paolo Bonzini, 2021/01/12
- [PULL 15/20] gtk: remove CONFIG_GTK_GL, Paolo Bonzini, 2021/01/12
- [PULL 16/20] configure: move X11 detection to Meson, Paolo Bonzini, 2021/01/12
- [PULL 17/20] configure: move GTK+ detection to Meson, Paolo Bonzini, 2021/01/12
- [PULL 19/20] configure: quote command line arguments in config.status, Paolo Bonzini, 2021/01/12