diff options
-rw-r--r-- | gdb/dwarf2/frame.c | 3 | ||||
-rw-r--r-- | gdb/objfiles.h | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/jit-reader.exp | 13 |
3 files changed, 19 insertions, 1 deletions
diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c index 3f884ab..54a0912 100644 --- a/gdb/dwarf2/frame.c +++ b/gdb/dwarf2/frame.c @@ -1560,6 +1560,9 @@ dwarf2_frame_find_fde (CORE_ADDR *pc, dwarf2_per_objfile **out_per_objfile) CORE_ADDR offset; CORE_ADDR seek_pc; + if (objfile->obfd == nullptr) + continue; + comp_unit *unit = find_comp_unit (objfile); if (unit == NULL) { diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 9a152cb..0d887ce 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -646,7 +646,9 @@ public: struct compunit_symtab *compunit_symtabs = nullptr; /* The object file's BFD. Can be null if the objfile contains only - minimal symbols, e.g. the run time common symbols for SunOS4. */ + minimal symbols (e.g. the run time common symbols for SunOS4) or + if the objfile is a dynamic objfile (e.g. created by JIT reader + API). */ gdb_bfd_ref_ptr obfd; diff --git a/gdb/testsuite/gdb.base/jit-reader.exp b/gdb/testsuite/gdb.base/jit-reader.exp index 69bf721..a66896d 100644 --- a/gdb/testsuite/gdb.base/jit-reader.exp +++ b/gdb/testsuite/gdb.base/jit-reader.exp @@ -277,6 +277,19 @@ proc jit_reader_test {} { "True" \ "at least one file-based objfile" } + + with_test_prefix "test dwarf unwinder" { + # Check that the DWARF unwinder does not crash in presence of + # JIT objfiles. + gdb_test "up" + gdb_breakpoint "*function_add" temporary + gdb_test "cont" ".*Temporary breakpoint ${any} in jit_function_add .*" + gdb_test "bt" \ + [multi_line \ + "#0 ${any} in jit_function_add ${any}" \ + "#1 ${any} in main ${any}" \ + ] + } } jit_reader_test |