From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13344 invoked by alias); 11 Dec 2009 20:56:34 -0000 Received: (qmail 13334 invoked by uid 22791); 11 Dec 2009 20:56:34 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mta3.glam.ac.uk (HELO mta3.glam.ac.uk) (193.63.147.53) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 11 Dec 2009 20:56:22 +0000 Received: from j228-gm.comp.glam.ac.uk ([193.63.148.84] helo=j228-gm) by mta3.glam.ac.uk with esmtp (Exim 4.63) (envelope-from ) id 1NJCXB-0007nF-Vw; Fri, 11 Dec 2009 20:56:17 +0000 Received: from gaius by j228-gm with local (Exim 4.69) (envelope-from ) id 1NJCXC-0002FU-JY; Fri, 11 Dec 2009 20:56:18 +0000 To: tromey@redhat.com Cc: gdb-patches@sourceware.org, drow@false.org Subject: Re: recursive bug in dwarf2read.c References: <878wdcto0t.fsf@j228-gm.comp.glam.ac.uk> <20091209185157.GA29691@caradoc.them.org> <87pr6mliuh.fsf@j228-gm.comp.glam.ac.uk> From: Gaius Mulley Date: Fri, 11 Dec 2009 20:56:00 -0000 In-Reply-To: (Tom Tromey's message of "Fri\, 11 Dec 2009 12\:29\:03 -0700") Message-ID: <87hbrx5ix9.fsf@j228-gm.comp.glam.ac.uk> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2009-12/txt/msg00169.txt.bz2 Tom Tromey writes: >>>>>> "Gaius" == Gaius Mulley writes: > > Gaius> 2009-12-10 Gaius Mulley > Gaius> * dwarf2read.c (read_subroutine_type): Add the subroutine > Gaius> type to the die immediately to allow a parameter type to be > Gaius> the same subroutine type. > > This seems almost ok to me. > > With this change, read_subroutine_type calls set_die_type twice. > I think it would be preferable to eliminate the second call. Hi Tom, ahh yes - true, here is the modified patch without the redundant second call: --- src-orig/gdb/dwarf2read.c 2009-12-10 16:41:40.000000000 +0000 +++ src/gdb/dwarf2read.c 2009-12-11 20:31:52.000000000 +0000 @@ -5879,6 +5879,11 @@ the default value DW_CC_normal. */ attr = dwarf2_attr (die, DW_AT_calling_convention, cu); TYPE_CALLING_CONVENTION (ftype) = attr ? DW_UNSND (attr) : DW_CC_normal; + + /* We need to add the subroutine type to the die immediately so + we don't infinitely recurse when dealing with parameters + declared as the same subroutine type. */ + set_die_type (die, ftype, cu); if (die->child != NULL) { @@ -5926,7 +5931,7 @@ } } - return set_die_type (die, ftype, cu); + return ftype; } static struct type * 2009-12-11 Gaius Mulley * dwarf2read.c (read_subroutine_type): Add the subroutine type to the die immediately to allow a parameter type to be the same subroutine type. regards, Gaius