diff options
author | Tom de Vries <tdevries@suse.de> | 2022-10-24 14:20:49 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2022-10-24 14:20:49 +0200 |
commit | 0a9c805dfd0dd9a284b30ec0563e4dc1ab5b16c4 (patch) | |
tree | 29c58f19eb4acac8716b5ffd1e4a63e494890dfb /gdb/disasm.c | |
parent | 67527cffcd5eb548a5de26d6a2b139a52bffa5a6 (diff) | |
download | fsf-binutils-gdb-0a9c805dfd0dd9a284b30ec0563e4dc1ab5b16c4.zip fsf-binutils-gdb-0a9c805dfd0dd9a284b30ec0563e4dc1ab5b16c4.tar.gz fsf-binutils-gdb-0a9c805dfd0dd9a284b30ec0563e4dc1ab5b16c4.tar.bz2 |
[gdb] Fix rethrow exception slicing in pretty_print_insn
The preferred way of rethrowing an exception is by using throw without
expression, because it avoids object slicing of the exception [1].
Fix this in gdb_pretty_print_disassembler::pretty_print_insn.
Tested on x86_64-linux.
[1] https://en.cppreference.com/w/cpp/language/throw
Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/disasm.c')
-rw-r--r-- | gdb/disasm.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/disasm.c b/gdb/disasm.c index de44aac..60f95c3 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -445,7 +445,7 @@ gdb_pretty_print_disassembler::pretty_print_insn (const struct disasm_insn *insn size = m_di.print_insn (pc); gdb_assert (size > 0); } - catch (const gdb_exception &ex) + catch (const gdb_exception &) { /* An exception was thrown while disassembling the instruction. However, the disassembler might still have written something @@ -454,7 +454,7 @@ gdb_pretty_print_disassembler::pretty_print_insn (const struct disasm_insn *insn object destructor as the write itself might throw an exception if the pager kicks in, and the user selects quit. */ write_out_insn_buffer (); - throw ex; + throw; } if ((flags & (DISASSEMBLY_RAW_INSN | DISASSEMBLY_RAW_BYTES)) != 0) |