On Linux/x86-64, v8 JIT debug is broken: ./gdb ./shell_g.x86 .. Reading symbols from /export/gnu/import/git/v8/shell_g.x64...done. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". [New Thread 0x7ffff7ffc700 (LWP 24786)] .gdbinit:1: Error in sourced command file: Dwarf Error: Could not find abbrev number 863432147 [in module <in-memory>] (gdb)
It is caused by mcheck addition in: http://sourceware.org/ml/gdb-cvs/2012-06/msg00005.html
Valgrind reports: ==31227== Conditional jump or move depends on uninitialised value(s) ==31227== at 0x5C1DFF: peek_die_abbrev (dwarf2read.c:12103) ==31227== by 0x5CC1EC: skip_children (dwarf2read.c:5019) ==31227== by 0x5D0814: load_partial_dies (dwarf2read.c:5165) ==31227== by 0x5D35E7: process_psymtab_comp_unit_reader (dwarf2read.c:4147) ==31227== by 0x5CD13A: init_cutu_and_read_dies (dwarf2read.c:3954) ==31227== by 0x5CF6C3: process_psymtab_comp_unit (dwarf2read.c:4223) ==31227== by 0x5DC6D9: dwarf2_build_psymtabs (dwarf2read.c:4337) ==31227== by 0x556FDD: require_partial_symbols (psymtab.c:88) ==31227== by 0x55D5D9: syms_from_objfile (symfile.c:1001) ==31227== by 0x55D764: symbol_file_add_with_addrs_or_offsets.constprop.16 (symfile.c:1108) ==31227== by 0x65BE44: jit_register_code (jit.c:895) ==31227== by 0x65CD0F: jit_event_handler (jit.c:1341)
Could you attach the 'shell_g.x64' file? I do not see any regressions with GDB testsuite and -lmcheck and it is not clear to me from the Comment 2.
Or rather the whole code registering the new in-memory symbol file, there will be the bug.
Created attachment 6562 [details] GDB chokes on it valgrind reports: ==23313== Invalid read of size 1 ==23313== at 0x639749: read_unsigned_leb128 (dwarf2read.c:13581) ==23313== by 0x628A6A: peek_die_abbrev (dwarf2read.c:6070) ==23313== by 0x628AFF: skip_children (dwarf2read.c:6098) ==23313== by 0x628FBC: locate_pdi_sibling (dwarf2read.c:6248) ==23313== by 0x6378D3: load_partial_dies (dwarf2read.c:12593) ==23313== by 0x625CB0: process_psymtab_comp_unit_reader (dwarf2read.c:4800) ==23313== by 0x62559E: init_cutu_and_read_dies (dwarf2read.c:4584) ==23313== by 0x62617B: process_psymtab_comp_unit (dwarf2read.c:4882) ==23313== by 0x6273CF: dwarf2_build_psymtabs_hard (dwarf2read.c:5377) ==23313== by 0x6232C6: dwarf2_build_psymtabs (dwarf2read.c:3704) ==23313== by 0x50F4E0: read_psyms (elfread.c:1467) ==23313== by 0x594529: require_partial_symbols (psymtab.c:88) ==23313== Address 0xcc467f3 is 0 bytes after a block of size 211 alloc'd ==23313== at 0x4A0884D: malloc (vg_replace_malloc.c:263) ==23313== by 0x6F8CEA: xmalloc (common-utils.c:50) ==23313== by 0x5EF3A8: gdb_bfd_map_section (gdb_bfd.c:485) ==23313== by 0x61EF3E: dwarf2_read_section (dwarf2read.c:1838) ==23313== by 0x62731A: dwarf2_build_psymtabs_hard (dwarf2read.c:5356) ==23313== by 0x6232C6: dwarf2_build_psymtabs (dwarf2read.c:3704) ==23313== by 0x50F4E0: read_psyms (elfread.c:1467) ==23313== by 0x594529: require_partial_symbols (psymtab.c:88) ==23313== by 0x59A782: syms_from_objfile (symfile.c:1002) ==23313== by 0x59A991: symbol_file_add_with_addrs_or_offsets (symfile.c:1105) ==23313== by 0x59AB8F: symbol_file_add_from_bfd (symfile.c:1195) ==23313== by 0x6F3D58: jit_bfd_try_read_symtab (jit.c:901) (top-gdb) p *orig_pdi $20 = {offset = {sect_off = 60}, tag = DW_TAG_subprogram, has_children = 1, is_external = 0, is_declaration = 0, has_type = 0, has_specification = 0, has_pc_info = 1, may_be_inlined = 0, scope_set = 0, has_byte_size = 0, has_template_arguments = 0, fixup_called = 0, is_dwz = 0, spec_is_dwz = 0, name = 0x31d2fcd "native runtime.js", linkage_name = 0x0, scope = 0x0, d = { locdesc = 0x0, offset = {sect_off = 0}}, lowpc = 28346582892064, highpc = 28346582892708, sibling = 0x0, spec_offset = {sect_off = 0}, die_parent = 0x0, die_child = 0x0, die_sibling = 0x0} (top-gdb)
It is a v8 jit bug.
It is true GDB is not protected against invalid DWARF, it can read past allocated memory.