From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8359 invoked by alias); 10 Dec 2009 19:39:16 -0000 Received: (qmail 8351 invoked by uid 22791); 10 Dec 2009 19:39:15 -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; Thu, 10 Dec 2009 19:39:10 +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 1NIoqw-000Gmg-KH; Thu, 10 Dec 2009 19:39:06 +0000 Received: from gaius by j228-gm with local (Exim 4.69) (envelope-from ) id 1NIoqs-00015N-RL; Thu, 10 Dec 2009 19:39:02 +0000 To: gdb-patches@sourceware.org CC: drow@false.org Subject: Re: recursive bug in dwarf2read.c References: <878wdcto0t.fsf@j228-gm.comp.glam.ac.uk> <20091209185157.GA29691@caradoc.them.org> From: Gaius Mulley Date: Thu, 10 Dec 2009 19:39:00 -0000 In-Reply-To: <20091209185157.GA29691@caradoc.them.org> (Daniel Jacobowitz's message of "Wed\, 9 Dec 2009 13\:51\:57 -0500") Message-ID: <87pr6mliuh.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/msg00152.txt.bz2 Daniel Jacobowitz writes: > On Wed, Dec 09, 2009 at 10:55:30AM +0000, Gaius Mulley wrote: >> >> Hi, >> >> I think there is a bug in dwarf2read.c which can be exposed by >> attempting to set a break point at RealIO_WriteFixed in this >> executable. >> >> I acknowledge the (gnu modula-2 generated executable) could probably >> be at fault, nevertheless it does contain cyclic data structures which >> are not explicitly created in the same way as C. For example: >> >> >> TYPE >> ScanState = PROCEDURE (CHAR, VAR ScanClass, VAR ScanState); > > See e.g. this from read_structure_type: > > /* We need to add the type field to the die immediately so we don't > infinitely recurse when dealing with pointers to the structure > type within the structure itself. */ > set_die_type (die, type, cu); > > It looks as if read_subroutine_type does not do that, but now has to. Hi Daniel, here is a patch which fixes the bug above. Embarrassingly after checking my private gdb directories I found I fixed this last year and sat on and forgot the patch. Guess there is a moral here somewhere.. 2009-12-10 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. --- src-orig/gdb/dwarf2read.c 2009-12-10 16:41:40.000000000 +0000 +++ src/gdb/dwarf2read.c 2009-12-10 17:04:16.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) { I've ran the testsuite on a AMD64 debian stable (lenny) system and and it doesn't appear to cause any regression. I've also some minor Modula-2 language support improvement patches which I wrote in Sept which I'll now push out to the mailing list.. regards, Gaius