mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 03:54:41 +08:00
[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>
This commit is contained in:
parent
67527cffcd
commit
0a9c805dfd
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user