Hide Forgot
Created attachment 531015 [details] Patch that fix the crash Description of problem: gdb crashes on some dwarf2 executables with NULL symtab Version-Release number of selected component (if applicable): gdb-7.2-48.el6 How reproducible: 100% Steps to Reproduce: 1. Build the dwarf2 with null symtab 2. Run gdb 3. Crash Actual results: Crash Expected results: Don't crash Additional info: With this small patch all is OK. Please, apply: --- --- gdb-7.3/gdb/dwarf2read.c.orig 2011-10-27 16:11:01.000000000 +0400 +++ gdb-7.3/gdb/dwarf2read.c 2011-10-27 16:11:09.000000000 +0400 @@ -11444,7 +11444,8 @@ new_symbol_full (struct die_info *die, s /* For the benefit of old versions of GCC, check for anonymous namespaces based on the demangled name. */ if (!processing_has_namespace_info - && cu->language == language_cplus) + && cu->language == language_cplus + && sym->symtab) cp_scan_for_anonymous_namespaces (sym); } return (sym); ---
Could you provide a reproducer for the crash? "dwarf2 with null symtab" is too ambiguous to blindly try some.
(In reply to comment #1) > Could you provide a reproducer for the crash? I'll attach it tomorrow. Thanx!
Created attachment 531559 [details] Source code of crash-example
Created attachment 531560 [details] Binary of crash-example
It has been fixed upstream by: ad387dddfa899b9ef76e3c2420b163e0ca47fe16 is the first bad (=good) commit commit ad387dddfa899b9ef76e3c2420b163e0ca47fe16 Author: Aleksandar Ristovski <aristovski> Date: Thu Oct 20 20:06:11 2011 +0000 * cp-namespace.c (cp_scan_for_anonymous_namespaces): Changed function arguments by adding OBJFILE. Instead of getting objfile from symbol's symtab, use new argument OBJFILE. * cp-support.h (cp_scan_for_anonymous_namespaces): Changed function arguments by adding OBJFILE. * gdb/dwarf2read.c (new_symbol_full): Change call to cp_scan_for_anonymous_namespaces to match new signature. * gdb/stabsread.c (define_symbol): Change call to cp_scan_for_anonymous_namespaces to match new signature. To ensure it gets backported you should contact your RHEL support services.
[patch] gdb crash in cp_scan_for_anonymous_namespace http://sourceware.org/ml/gdb-patches/2011-10/msg00570.html
[commit] testsuite: New gdb.dwarf2/dw2-namespaceless-anonymous.exp http://sourceware.org/ml/gdb-patches/2012-01/msg00511.html QA: New testcase: gdb.dwarf2/dw2-namespaceless-anonymous.exp
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2012-0930.html