[Bug python/33158] New: [gdb/python] Don't print gdb.Error with prefix Python Exception <class 'gdb.error'>
vries at gcc dot gnu.org
sourceware-bugzilla@sourceware.org
Wed Jul 16 06:03:21 GMT 2025
https://sourceware.org/bugzilla/show_bug.cgi?id=33158
Bug ID: 33158
Summary: [gdb/python] Don't print gdb.Error with prefix Python
Exception <class 'gdb.error'>
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: python
Assignee: unassigned at sourceware dot org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
While looking at PR33152 I noticed:
...
(gdb) bt^M
Python Exception <class 'gdb.error'>: Required frame unwinder may have been
disabled, see 'maint info frame-unwinders'^M
#0 callback () at backtrace-through-cu-nodebug-main.c:25^M
(gdb)
...
I don't see much point in printing the "Python Exception <class 'gdb.error'>: "
prefix here.
Indeed, there is some extra information: the error was thrown while in python
code, but that's a bit implementation-specific.
Using this patch:
...
diff --git a/gdb/python/python.c b/gdb/python/python.c
index cb0d642a67d..050c646dcc8 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1723,6 +1723,8 @@ gdbpy_print_stack (void)
"message.\n"));
PyErr_Clear ();
}
+ else if (fetched_error.type_matches (gdbpy_gdb_error))
+ gdb_printf (gdb_stderr, "%s\n", msg.get ());
else
gdb_printf (gdb_stderr, "Python Exception %s: %s\n",
type.get (), msg.get ());
...
I get instead:
...
(gdb) bt^M
Required frame unwinder may have been disabled, see 'maint info
frame-unwinders'^M
#0 callback () at backtrace-through-cu-nodebug-main.c:25^M
(gdb)
...
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Gdb-prs
mailing list