From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13402 invoked by alias); 28 Jul 2010 19:32:02 -0000 Received: (qmail 13388 invoked by uid 22791); 28 Jul 2010 19:32:00 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,TW_BJ,TW_EG,TW_YM,T_FILL_THIS_FORM_SHORT,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.35) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 28 Jul 2010 19:31:48 +0000 Received: from kpbe16.cbf.corp.google.com (kpbe16.cbf.corp.google.com [172.25.105.80]) by smtp-out.google.com with ESMTP id o6SJVYdO022865; Wed, 28 Jul 2010 12:31:34 -0700 Received: from ruffy.mtv.corp.google.com (ruffy.mtv.corp.google.com [172.18.118.116]) by kpbe16.cbf.corp.google.com with ESMTP id o6SJVW0m026175; Wed, 28 Jul 2010 12:31:33 -0700 Received: by ruffy.mtv.corp.google.com (Postfix, from userid 67641) id 63CFB843B8; Wed, 28 Jul 2010 12:31:32 -0700 (PDT) To: swagiaal@redhat.com cc: gdb@sourceware.org Subject: gdb2384.exp segv Message-Id: <20100728193132.63CFB843B8@ruffy.mtv.corp.google.com> Date: Wed, 28 Jul 2010 19:32:00 -0000 From: dje@google.com (Doug Evans) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-07/txt/msg00112.txt.bz2 gdb.cp/gdb2384.exp is failing for me, gdb segvs. target = amd64-linux gdb$ cat foo.gdb set confirm off file testsuite/gdb.cp/gdb2384 b main run b 50 c d b main r gdb$ gdb gdb [...] (top-gdb) r -nx -x foo.gdb Starting program: /usr/local/g3/gnu/sourceware/pure-gdb/build/obj64/gdb/gdb -nx -x foo.gdb During symbol reading, DW_AT_name missing from DW_TAG_base_type. During symbol reading, unsupported tag: 'DW_TAG_const_type'. During symbol reading, DW_AT_type missing from DW_TAG_subrange_type. During symbol reading, DW_AT_name missing from DW_TAG_base_type. During symbol reading, DW_AT_type missing from DW_TAG_subrange_type. During symbol reading, unsupported tag: 'DW_TAG_const_type'. [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/grte/v1/lib64/libthread_db.so.1". GNU gdb (GDB) 7.2.50.20100728-cvs Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux". For bug reporting instructions, please see: . Breakpoint 1 at 0x400993: file ../../../../src/gdb/testsuite/gdb.cp/gdb2384.cc, line 48. Breakpoint 1, main () at ../../../../src/gdb/testsuite/gdb.cp/gdb2384.cc:48 48 derived1 d1 (42); Breakpoint 2 at 0x4009b5: file ../../../../src/gdb/testsuite/gdb.cp/gdb2384.cc, line 50. Breakpoint 2, main () at ../../../../src/gdb/testsuite/gdb.cp/gdb2384.cc:50 50 g = d1.meth (); // set breakpoint here Breakpoint 3 at 0x400993: file ../../../../src/gdb/testsuite/gdb.cp/gdb2384.cc, line 48. Program received signal SIGSEGV, Segmentation fault. During symbol reading, incomplete CFI data; unspecified registers (e.g., rax) at 0x410f9b. 0x0000000000410f0e in strcmp_iw_ordered (string1=0x745353545a5f0045
, string2=0x7fffffffd590 "main") at ../../../src/gdb/utils.c:2877 (top-gdb) up #1 0x000000000051010f in lookup_partial_symbol (pst=0xc38db0, name=0x7fffffffd590 "main", global=1, domain=LABEL_DOMAIN) at ../../../src/gdb/psymtab.c:475 (top-gdb) p **center $2 = { ginfo = { name = 0xc38eb1 "base::base", value = { ivalue = 140737354103350, block = 0x7ffff7ff7a36, bytes = 0x7ffff7ff7a36 "", address = 140737354103350, chain = 0x7ffff7ff7a36 }, language_specific = { mangled_lang = { demangled_name = 0xc7eff8 "E" }, cplus_specific = 0xc7eff8 }, language = language_cplus, section = 0, obj_section = 0x0 }, domain = VAR_DOMAIN, aclass = LOC_BLOCK } (top-gdb) up #2 0x000000000050ff52 in lookup_symbol_aux_psymtabs (objfile=0xc30770, block_index=0, name=0x7fffffffd590 "main", domain=LABEL_DOMAIN) at ../../../src/gdb/psymtab.c:417 (top-gdb) p *ps; $3 = { next = 0x0, filename = 0xc38e30 "../../../../src/gdb/testsuite/gdb.cp/gdb2384-base.cc", fullname = 0x0, dirname = 0xc38cfe "/usr/local/g3/gnu/sourceware/pure-gdb/build/obj64/gdb/testsuite", objfile = 0xc30770, section_offsets = 0xc2cc68, textlow = 140737354103308, texthigh = 140737354103514, dependencies = 0x0, number_of_dependencies = 0, globals_offset = 0, n_global_syms = 9, statics_offset = 0, n_static_syms = 1, symtab = 0x0, read_symtab = 0x587ab4 , read_symtab_private = 0xc38b40, readin = 0 '\000' } (top-gdb) p ps->objfile->name $4 = 0xc0c360 "/usr/local/g3/gnu/sourceware/pure-gdb/build/obj64/gdb/testsuite/gdb.cp/gdb2384-base.so" If I apply this hack, the test now passes: --- psymtab.c.~1.7.~ 2010-07-26 17:38:41.000000000 -0700 +++ psymtab.c 2010-07-28 11:55:19.000000000 -0700 @@ -1294,6 +1294,10 @@ add_psymbol_to_bcache (char *name, int n zeroed before assigning to it, because an assignment may not write the entire field. */ memset (&psymbol.ginfo.value, 0, sizeof (psymbol.ginfo.value)); + + /* HACK */ + psymbol.ginfo.language_specific.cplus_specific = 0; + /* val and coreaddr are mutually exclusive, one of them *will* be zero */ if (val != 0) { This is just a hack though. I'm not sure what The Right fix is, the above patch feels too hacky (e.g. psymtab.c is now another place that is aware of language-specific details). Here's the relevant portion of the valgrind output, for reference sake: gdb$ valgrind ./gdb -nx -x foo.gdb [...] Breakpoint 1, main () at ../../../../src/gdb/testsuite/gdb.cp/gdb2384.cc:48 48 derived1 d1 (42); Breakpoint 2 at 0x4009b5: file ../../../../src/gdb/testsuite/gdb.cp/gdb2384.cc, line 50. Breakpoint 2, main () at ../../../../src/gdb/testsuite/gdb.cp/gdb2384.cc:50 50 g = d1.meth (); // set breakpoint here Breakpoint 3 at 0x400993: file ../../../../src/gdb/testsuite/gdb.cp/gdb2384.cc, line 48. ==3658== ==3658== Invalid write of size 8 ==3658== at 0x507747: symbol_set_demangled_name (symtab.c:373) ==3658== by 0x508277: symbol_set_names (symtab.c:690) ==3658== by 0x511D69: add_psymbol_to_bcache (psymtab.c:1311) ==3658== by 0x511E74: add_psymbol_to_list (psymtab.c:1361) ==3658== by 0x591CC3: load_partial_dies (dwarf2read.c:8157) ==3658== by 0x585CC3: process_psymtab_comp_unit (dwarf2read.c:3063) ==3658== by 0x5860BD: dwarf2_build_psymtabs_hard (dwarf2read.c:3204) ==3658== by 0x584789: dwarf2_build_psymtabs (dwarf2read.c:2549) ==3658== by 0x584738: dwarf2_initialize_objfile (dwarf2read.c:2533) ==3658== by 0x4BC84D: elf_symfile_read (elfread.c:876) ==3658== by 0x514CF1: syms_from_objfile (symfile.c:999) ==3658== by 0x514EBE: symbol_file_add_with_addrs_or_offsets (symfile.c:1093) ==3658== Address 0x6a1b390 is 1,496 bytes inside a block of size 4,072 free'd ==3658== at 0x4C1CB92: free (vg_replace_malloc.c:323) ==3658== by 0x40E885: xfree (utils.c:1467) ==3658== by 0x5D910E7: obstack_free (obstack.c:347) ==3658== by 0x404128: free_objfile (objfiles.c:666) ==3658== by 0x404E5A: objfile_purge_solibs (objfiles.c:992) ==3658== by 0x41DB62: no_shared_libraries (solib.c:1306) ==3658== by 0x5655BE: target_pre_inferior (target.c:2120) ==3658== by 0x5228BD: run_command_1 (infcmd.c:493) ==3658== by 0x522B73: run_command (infcmd.c:596) ==3658== by 0x489690: do_cfunc (cli-decode.c:67) ==3658== by 0x48C639: cmd_func (cli-decode.c:1771) ==3658== by 0x40AD1D: execute_command (top.c:422) ==3658== ==3658== Invalid read of size 8 ==3658== at 0x5077B3: symbol_get_demangled_name (symtab.c:386) ==3658== by 0x5082B1: symbol_natural_name (symtab.c:706) ==3658== by 0x5083A4: symbol_search_name (symtab.c:758) ==3658== by 0x511B80: compare_psymbols (psymtab.c:1237) ==3658== by 0x5D4FFA8: msort_with_tmp (msort.c:56) ==3658== by 0x5D4FE82: msort_with_tmp (msort.c:47) ==3658== by 0x5D4FE82: msort_with_tmp (msort.c:47) ==3658== by 0x5D5010F: qsort (msort.c:102) ==3658== by 0x511BF0: sort_pst_symbols (psymtab.c:1245) ==3658== by 0x585DF9: process_psymtab_comp_unit (dwarf2read.c:3088) ==3658== by 0x5860BD: dwarf2_build_psymtabs_hard (dwarf2read.c:3204) ==3658== by 0x584789: dwarf2_build_psymtabs (dwarf2read.c:2549) ==3658== Address 0x6a1b390 is 1,496 bytes inside a block of size 4,072 free'd ==3658== at 0x4C1CB92: free (vg_replace_malloc.c:323) ==3658== by 0x40E885: xfree (utils.c:1467) ==3658== by 0x5D910E7: obstack_free (obstack.c:347) ==3658== by 0x404128: free_objfile (objfiles.c:666) ==3658== by 0x404E5A: objfile_purge_solibs (objfiles.c:992) ==3658== by 0x41DB62: no_shared_libraries (solib.c:1306) ==3658== by 0x5655BE: target_pre_inferior (target.c:2120) ==3658== by 0x5228BD: run_command_1 (infcmd.c:493) ==3658== by 0x522B73: run_command (infcmd.c:596) ==3658== by 0x489690: do_cfunc (cli-decode.c:67) ==3658== by 0x48C639: cmd_func (cli-decode.c:1771) ==3658== by 0x40AD1D: execute_command (top.c:422) Breakpoint 3, main () at ../../../../src/gdb/testsuite/gdb.cp/gdb2384.cc:48 48 derived1 d1 (42); (gdb) q [...]