[PATCH 9/9] scripts/qemugdb: coroutine: Don't touch the coredump for a plain backtrace
Andrey Drobyshev <[email protected]> Tue, 4 Aug 2026 18:17:43 +0300
| Newsgroups | gmane.comp.emulators.qemu |
|---|---|
| Message-ID | <[email protected]> |
init_coredump() creates a Coredump object for every coredump session. That
implies opening and scanning the actual coredump file. For non-detailed
'qemu bt' invocation we don't really need it.
Les't only create the object when the core is about to be patched, i.e.
for '--detailed'.
Fixes: 42f3c143c3a0 ("scripts/qemugdb: coroutine: Add option for obtaining detailed trace in coredump")
Signed-off-by: Andrey Drobyshev <[email protected]>
---
scripts/qemugdb/coroutine.py | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/scripts/qemugdb/coroutine.py b/scripts/qemugdb/coroutine.py
index 21ed7cbaab8..edc1f3cc69f 100644
--- a/scripts/qemugdb/coroutine.py
+++ b/scripts/qemugdb/coroutine.py
@@ -328,7 +328,7 @@ def coroutine_to_jmpbuf(co):
coroutine_pointer = co_cast(co)
return coroutine_pointer['env']['__jmpbuf']
-def init_coredump():
+def init_coredump(detailed=False):
global coredump
files = gdb.execute('info files', False, True)
@@ -337,7 +337,8 @@ def init_coredump():
if match is None:
return False
- if coredump is None:
+ # The object is only needed to patch the coredump
+ if detailed and coredump is None:
coredump = Coredump(match.group(1), gdb.current_progspace().filename)
return True
@@ -372,7 +373,7 @@ def invoke(self, arg, from_tty):
if gdb.selected_thread() is None:
raise gdb.GdbError('No stack.')
- is_coredump = init_coredump()
+ is_coredump = init_coredump(detailed)
if detailed and not is_coredump:
gdb.write('--detailed is only valid when debugging core dumps\n')
return
@@ -381,7 +382,7 @@ def invoke(self, arg, from_tty):
bt_jmpbuf(coroutine_to_jmpbuf(gdb.parse_and_eval(argv[0])),
is_coredump, detailed=detailed)
finally:
- if is_coredump:
+ if coredump is not None:
coredump.restore_regs()
class CoroutineBt(gdb.Command):
@@ -413,7 +414,7 @@ def invoke(self, arg, from_tty):
if gdb.selected_thread() is None:
raise gdb.GdbError('No stack.')
- is_coredump = init_coredump()
+ is_coredump = init_coredump(detailed)
if detailed and not is_coredump:
gdb.write('--detailed is only valid when debugging core dumps\n')
return
@@ -441,7 +442,7 @@ def invoke(self, arg, from_tty):
bt_jmpbuf(coroutine_to_jmpbuf(co_ptr), is_coredump,
detailed=detailed)
finally:
- if is_coredump:
+ if coredump is not None:
coredump.restore_regs()
class CoroutineSPFunction(gdb.Function):
--
2.47.1