From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23736 invoked by alias); 28 Jul 2010 20:16:36 -0000 Received: (qmail 23263 invoked by uid 22791); 28 Jul 2010 20:16:27 -0000 X-SWARE-Spam-Status: No, hits=-3.3 required=5.0 tests=AWL,BAYES_00,KAM_STOCKTIP,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_CP,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 28 Jul 2010 20:16:22 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6SKGIcc028369 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 28 Jul 2010 16:16:19 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6SKGIOm027033 for ; Wed, 28 Jul 2010 16:16:18 -0400 Received: from [10.15.16.129] (dhcp-10-15-16-129.yyz.redhat.com [10.15.16.129]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o6SKGHdY014888 for ; Wed, 28 Jul 2010 16:16:18 -0400 Message-ID: <4C509011.2040207@redhat.com> Date: Wed, 28 Jul 2010 20:16:00 -0000 From: sami wagiaalla User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Thunderbird/3.0.5 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [patch] stabs assertion failure symbol_get_demangled_name Content-Type: multipart/mixed; boundary="------------040403000208090009060703" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-07/txt/msg00519.txt.bz2 This is a multi-part message in MIME format. --------------040403000208090009060703 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 661 Pedro reported a crash of code compiled with stabs on gdb_assert(gsymbol->language_specific.cplus_specific != NULL); in symbol_get_demangled_name. The problem was that stabsread.c:define_symbol was calling cp_scan_for_anonymous_namespaces before setting the name. I corrected that but there other case, and for those I changed the assertion into an if statement that returns null since symbol_natural_name depends on symbol_get_demangled_name to return null in order to fall back to gsymbol->name. This was tested by running the test suite and compiling member-ptr with -gstabs breaking on main executing a few commands and printing some values. Sami --------------040403000208090009060703 Content-Type: text/plain; name="stabs.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="stabs.patch" Content-length: 1575 Fixed stabs cplus_specific issue 2010-07-28 Sami Wagiaalla * symtab.c (symbol_get_demangled_name): Remove assertion and return NULL when language_specific.cplus_specific is not initialized. * stabsread.c (define_symbol): Set the name before calling cp_scan_for_anonymous_namespaces. diff --git a/gdb/stabsread.c b/gdb/stabsread.c index b62156c..7a68d7a 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -712,7 +712,6 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, memcpy (name, string, p - string); name[p - string] = '\0'; new_name = cp_canonicalize_string (name); - cp_scan_for_anonymous_namespaces (sym); } if (new_name != NULL) { @@ -721,6 +720,10 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, } else SYMBOL_SET_NAMES (sym, string, p - string, 1, objfile); + + if (SYMBOL_LANGUAGE (sym) == language_cplus) + cp_scan_for_anonymous_namespaces (sym); + } p++; diff --git a/gdb/symtab.c b/gdb/symtab.c index ec0e809..822c89c 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -381,10 +381,10 @@ char * symbol_get_demangled_name (const struct general_symbol_info *gsymbol) { if (gsymbol->language == language_cplus) - { - gdb_assert (gsymbol->language_specific.cplus_specific != NULL); + if (gsymbol->language_specific.cplus_specific != NULL) return gsymbol->language_specific.cplus_specific->demangled_name; - } + else + return NULL; else return gsymbol->language_specific.mangled_lang.demangled_name; } --------------040403000208090009060703--