Bug 750341 - gdb crashes on some dwarf2 executables
Summary: gdb crashes on some dwarf2 executables
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: gdb
Version: 6.1
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Jan Kratochvil
QA Contact: qe-baseos-tools-bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2011-10-31 18:56 UTC by Konstantin Volkov
Modified: 2012-06-20 14:29 UTC (History)
3 users (show)

Fixed In Version: gdb-7.2-51.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-06-20 14:29:39 UTC
Target Upstream Version:

Attachments (Terms of Use)
Patch that fix the crash (522 bytes, patch)
2011-10-31 18:56 UTC, Konstantin Volkov
no flags Details | Diff
Source code of crash-example (746 bytes, text/x-c++src)
2011-11-03 13:39 UTC, Konstantin Volkov
no flags Details
Binary of crash-example (26.04 KB, application/octet-stream)
2011-11-03 13:40 UTC, Konstantin Volkov
no flags Details

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0930 0 normal SHIPPED_LIVE gdb bug fix update 2012-06-19 20:45:57 UTC

Description Konstantin Volkov 2011-10-31 18:56:39 UTC
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):


How reproducible:

Steps to Reproduce:
1. Build the dwarf2 with null symtab
2. Run gdb
3. Crash
Actual results:

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);


Comment 1 Jan Kratochvil 2011-10-31 19:06:23 UTC
Could you provide a reproducer for the crash?

"dwarf2 with null symtab" is too ambiguous to blindly try some.

Comment 3 Konstantin Volkov 2011-10-31 19:17:02 UTC
(In reply to comment #1)
> Could you provide a reproducer for the crash?

I'll attach it tomorrow. Thanx!

Comment 5 Konstantin Volkov 2011-11-03 13:39:28 UTC
Created attachment 531559 [details]
Source code of crash-example

Comment 6 Konstantin Volkov 2011-11-03 13:40:09 UTC
Created attachment 531560 [details]
Binary of crash-example

Comment 7 Jan Kratochvil 2011-11-03 14:27:54 UTC
It has been fixed upstream by:

ad387dddfa899b9ef76e3c2420b163e0ca47fe16 is the first bad (=good) commit
commit ad387dddfa899b9ef76e3c2420b163e0ca47fe16
Author: Aleksandar Ristovski <aristovski@qnx.com>
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.

Comment 12 Jan Kratochvil 2012-01-13 22:12:13 UTC
[patch] gdb crash in cp_scan_for_anonymous_namespace

Comment 13 Jan Kratochvil 2012-01-14 10:50:08 UTC
[commit] testsuite: New gdb.dwarf2/dw2-namespaceless-anonymous.exp

QA: New testcase:

Comment 17 errata-xmlrpc 2012-06-20 14:29:39 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.