This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: symtab/1333: Internal error with Dwarf2


The following reply was made to PR symtab/1333; it has been noted by GNATS.

From: Jim Blandy <jimb@redhat.com>
To: gdb-gnats@sources.redhat.com
Cc:  
Subject: Re: symtab/1333: Internal error with Dwarf2
Date: 15 Aug 2003 16:30:46 -0500

 X-From-Line: imap Thu Aug 14 12:21:00 2003
 Return-Path: <gdb-return-15151-jimb=redhat.com@sources.redhat.com>
 Received: from pobox.corp.redhat.com ([unix socket])
 	by pobox.corp.redhat.com (Cyrus v2.1.12) with LMTP; Thu, 14 Aug 2003 10:56:13 -0400
 X-Sieve: CMU Sieve 2.2
 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254])
 	by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id h7EEuDED023586
 	for <jimb@pobox.corp.redhat.com>; Thu, 14 Aug 2003 10:56:13 -0400
 Received: from mx1.redhat.com (mx1.redhat.com [172.16.48.31])
 	by int-mx1.corp.redhat.com (8.11.6/8.11.6) with SMTP id h7EEuDs25957
 	for <jimb@redhat.com>; Thu, 14 Aug 2003 10:56:13 -0400
 Received: from sources.redhat.com (sources.redhat.com [67.72.78.213])
 	by mx1.redhat.com (8.11.6/8.11.6) with SMTP id h7EEuCt31360
 	for <jimb@redhat.com>; Thu, 14 Aug 2003 10:56:12 -0400
 Received: (qmail 8307 invoked by alias); 14 Aug 2003 14:56:01 -0000
 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm
 Precedence: bulk
 List-Unsubscribe: <mailto:gdb-unsubscribe-jimb=redhat.com@sources.redhat.com>
 List-Subscribe: <mailto:gdb-subscribe@sources.redhat.com>
 List-Archive: <http://sources.redhat.com/ml/gdb/>
 List-Post: <mailto:gdb@sources.redhat.com>
 List-Help: <mailto:gdb-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
 Sender: gdb-owner@sources.redhat.com
 Delivered-To: mailing list gdb@sources.redhat.com
 Received: (qmail 8292 invoked from network); 14 Aug 2003 14:56:00 -0000
 Received: from unknown (HELO maxipes.logix.cz) (81.0.234.97)
   by sources.redhat.com with SMTP; 14 Aug 2003 14:56:00 -0000
 Received: from suse.cz (styx.suse.cz [213.210.157.162])
 	(using TLSv1 with cipher RC4-MD5 (128/128 bits))
 	(Client CN "Michal Ludvig", Issuer "Personal Freemail RSA 2000.8.30" (verified OK))
 	by maxipes.logix.cz (Postfix) with ESMTP
 	id 5E8B4299DF; Thu, 14 Aug 2003 16:55:59 +0200 (CEST)
 Message-ID: <3F3BA318.3050305@suse.cz>
 Date: Thu, 14 Aug 2003 16:56:24 +0200
 From: Michal Ludvig <mludvig@suse.cz>
 Organization: SuSE CR, s.r.o.
 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.5b) Gecko/20030813
 X-Accept-Language: cs, cz, en
 To: gdb <gdb@sources.redhat.com>
 Cc: Elena Zannoni <ezannoni@redhat.com>, Daniel Jacobowitz <drow@mvista.com>
 Subject: Re: Dwarf2-related Internal error
 References: <3F0AD6F4.9060709@suse.cz>	<3F3B6C99.6020908@suse.cz> <16187.34103.759484.814559@localhost.redhat.com> <3F3B8C04.1010309@suse.cz>
 In-Reply-To: <3F3B8C04.1010309@suse.cz>
 Lines: 65
 Xref: zenia.home mail.gdb.outside:10405
 MIME-Version: 1.0
 Content-Type: text/plain; charset=us-ascii
 
 Michal Ludvig told me that:
 > Elena Zannoni told me that:
 > 
 >> I don't have much time to devote to this, but usually that kind of
 >> error is generated by some infinite loop that gdb got itself into.
 > 
 > 
 > Unlikely. The immediate problem is that the size of function's parameter 
 > 'xx' is too big:
 > 
 > (top-gdb) f
 > #0  read_var_value (var=0x8b35c0, frame=0x85ad98)
 >     at ../../gdb-head/gdb/findvar.c:397
 > 397       struct type *type = SYMBOL_TYPE (var);
 > (top-gdb) p *var->type
 > $2 = {pointer_type = 0x0, reference_type = 0x0, chain = 0x89fc00,
 >   instance_flags = 0, length = 4294967292, main_type = 0x89fc28}
 > (top-gdb) p (int)4294967292
 > $3 = -4
 > (top-gdb)
 > 
 > Very likely it was ment to be -4 because something somewhere in the 
 > debug info was wrongly interpreted.
 
 OK, I have found the problem. The type of the parameter 'xx' is an array 
 with unspecified size. Lower bound is set to '1' for Fortran and since 
 there is no upper bound specified, it's set to '-1' by default.
 
 3097     else if (attr->form == DW_FORM_block1)
 3098     {
 3099       /* GCC encodes arrays with unspecified or dynamic length
 3100          with a DW_FORM_block1 attribute.
 3101          FIXME: GDB does not yet know how to handle dynamic
 3102          arrays properly, treat them as arrays with unspecified
 3103          length for now.  */
 3104       high = -1;
 3105     }
 
 Later, when the actual size of the array type is computed, it takes the 
 size of the main type (real, size=4) and multiplies it by 
 (high-low+1=-1) leading to -4 which is quite a big number when converted 
 to unsigned.
 
 Now how to solve it. For now I did
 
                       length for now.  */
                    high = -1;
 +                 if (cu_language == language_fortran)
 +                   high = 0;
                  }
 
 which at least prevents GDB from crashing. IMHO it achieves the same 
 behaviour as for other languages, where low=0, high=-1 and so the size 
 of the array results to 0. In fortran low=1, so with high=0 the size 
 will become 0 as well.
 
 Would this be an acceptable solution? Any comments?
 
 Michal Ludvig
 -- 
 * SuSE CR, s.r.o     * mludvig@suse.cz
 * (+420) 296.545.373 * http://www.suse.cz
 
 
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]