From: Tom de Vries Date: Thu, 22 Aug 2024 07:49:53 +0000 (+0200) Subject: [gdb] Eliminate catch(...) in get_test_insn X-Git-Tag: gdb-16-branchpoint~1095 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a16c032a5c67453e88bc58dc3db0ac568c348973;p=thirdparty%2Fbinutils-gdb.git [gdb] Eliminate catch(...) in get_test_insn In get_test_insn in gdb/disasm-selftests.c, we find this code: ... try { kind = gdbarch_breakpoint_kind_from_pc (gdbarch, &pc); insn = gdbarch_sw_breakpoint_from_kind (gdbarch, kind, &bplen); } catch (...) { continue; } ... The catch is there to catch memory errors, but it swallows all exceptions, including gdb_exception_quit and gdb_exception_forced_quit. Fix this by limiting the catch to gdb_exception_error. Tested on x86_64-linux, by rebuilding and running gdb.gdb/unittest.exp. Approved-By: Tom Tromey --- diff --git a/gdb/disasm-selftests.c b/gdb/disasm-selftests.c index 14b7fb30bad..dd849fb1eb9 100644 --- a/gdb/disasm-selftests.c +++ b/gdb/disasm-selftests.c @@ -165,7 +165,7 @@ get_test_insn (struct gdbarch *gdbarch, size_t *len) kind = gdbarch_breakpoint_kind_from_pc (gdbarch, &pc); insn = gdbarch_sw_breakpoint_from_kind (gdbarch, kind, &bplen); } - catch (...) + catch (const gdb_exception_error &) { continue; }