This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 0/6 v3] Handle memory error on disassembly

Nowadays, we can set function pointer
disassemble_info.memory_error_func to throw error or exception when
disassembler gets an error, and the caller can/may catch the exception.
Both gdb and objdump use this interface for many years.  After GDB is
switched to C++, this stops working due to the "foreign frame" from
opcodes.  That is to say, a C++ program calls a C function
(print_insn_XXX from opcodes) and this function calls a C++ code which
throws exception.  DW2 C++ exception unwinder can unwind across the C
function frame, unless the C code is compiled with -fexceptions.  As
a result, GDB aborts on memory error during disassembly on some hosts.

This is the v3 of the patch series, and V2 can be found
V3 addressed all comments on function names and code comments in V2.

*** BLURB HERE ***

Yao Qi (6):
  New function null_stream
  Refactor disassembly code
  Call print_insn_mep in mep_gdb_print_insn
  Disassembly unit test: disassemble one instruction
  Disassembly unit test: memory error
  Don't throw exception in dis_asm_memory_error

 gdb/                                 |   5 +
 gdb/arm-tdep.c                                  |   5 +-
 gdb/disasm-selftests.c                          | 221 ++++++++++++++++++++++++
 gdb/disasm.c                                    | 183 ++++++++++----------
 gdb/disasm.h                                    |  57 ++++--
 gdb/guile/scm-disasm.c                          |  77 +++------
 gdb/mep-tdep.c                                  |  10 +-
 gdb/mips-tdep.c                                 |   5 +-
 gdb/record-btrace.c                             |   5 +-
 gdb/selftest-arch.c                             | 102 +++++++++++
 gdb/selftest-arch.h                             |  27 +++
 gdb/spu-tdep.c                                  |  20 +--
 gdb/testsuite/gdb.base/ |   5 +
 gdb/utils.c                                     |  15 ++
 gdb/utils.h                                     |   3 +
 15 files changed, 560 insertions(+), 180 deletions(-)
 create mode 100644 gdb/disasm-selftests.c
 create mode 100644 gdb/selftest-arch.c
 create mode 100644 gdb/selftest-arch.h


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]