From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19135 invoked by alias); 17 Nov 2008 09:32:45 -0000 Received: (qmail 19075 invoked by uid 22791); 17 Nov 2008 09:32:44 -0000 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.31) with ESMTP; Mon, 17 Nov 2008 09:32:04 +0000 Received: from j228-gm.comp.glam.ac.uk ([193.63.148.84]) by mta3.glam.ac.uk with esmtp (Exim 4.63) (envelope-from ) id 1L20Sg-000LQa-8f for gdb-patches@sources.redhat.com; Mon, 17 Nov 2008 09:32:02 +0000 Received: from gaius by j228-gm.comp.glam.ac.uk with local (Exim 4.63) (envelope-from ) id 1L20Sa-0006ni-RV for gdb-patches@sources.redhat.com; Mon, 17 Nov 2008 09:31:56 +0000 To: gdb-patches@sources.redhat.com Subject: Re: patch for dwarf2read.c References: <877i724s7s.fsf@j228-gm.comp.glam.ac.uk> From: Gaius Mulley Date: Mon, 17 Nov 2008 21:02:00 -0000 In-Reply-To: <877i724s7s.fsf@j228-gm.comp.glam.ac.uk> Message-ID: <87fxlq3dgz.fsf@j228-gm.comp.glam.ac.uk> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 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: 2008-11/txt/msg00432.txt.bz2 Gaius Mulley writes: > Hi, > > here is a patch for dwarf2read.c which fixes a cyclic recursive bug > when gdb is asked to resolve the following Modula-2 procedure type: > > ScanClass = (padding, valid, invalid, terminator); > ScanState = PROCEDURE (CHAR, VAR ScanClass, VAR ScanState); > > when compiled by gm2. > > regards, > Gaius ps. oops I forgot to say that no more regression tests fail if the patch is applied on the x86_64 Debian GNU/Linux platform > > > > --- orig/src/gdb/dwarf2read.c 2008-11-16 23:51:59.000000000 +0000 > +++ modified/src/gdb/dwarf2read.c 2008-11-16 23:47:51.000000000 +0000 > @@ -769,6 +769,9 @@ > static void add_partial_enumeration (struct partial_die_info *enum_pdi, > struct dwarf2_cu *cu); > > +static void add_partial_subroutine_type (struct partial_die_info *enum_pdi, > + struct dwarf2_cu *cu); > + > static void add_partial_subprogram (struct partial_die_info *pdi, > CORE_ADDR *lowpc, CORE_ADDR *highpc, > struct dwarf2_cu *cu); > @@ -2287,6 +2290,32 @@ > } > } > > +/* Read a partial die corresponding to a subroutine type. */ > + > +static void > +add_partial_subroutine_type (struct partial_die_info *subroutine_type_pdi, > + struct dwarf2_cu *cu) > +{ > + struct objfile *objfile = cu->objfile; > + bfd *abfd = objfile->obfd; > + struct partial_die_info *pdi; > + > + if (subroutine_type_pdi->name != NULL) > + add_partial_symbol (subroutine_type_pdi, cu); > + > + pdi = subroutine_type_pdi->die_child; > + while (pdi) > + { > + if (pdi->tag != DW_TAG_formal_parameter > + || pdi->tag != DW_TAG_unspecified_parameters > + || pdi->name == NULL) > + complaint (&symfile_complaints, _("malformed parameter DIE ignored")); > + else > + add_partial_symbol (pdi, cu); > + pdi = pdi->die_sibling; > + } > +} > + > /* Read the initial uleb128 in the die at INFO_PTR in compilation unit CU. > Return the corresponding abbrev, or NULL if the number is zero (indicating > an empty DIE). In either case *BYTES_READ will be set to the length of > @@ -4946,7 +4975,16 @@ > 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; > - > + > + TYPE_STUB_SUPPORTED (ftype) = 1; > + if (die_is_declaration (die, cu)) > + TYPE_STUB (ftype) = 1; > + > + /* We need to add the type field 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) > { > struct die_info *child_die; > @@ -4993,7 +5031,7 @@ > } > } > > - return set_die_type (die, ftype, cu); > + return ftype; > } > > static struct type * > @@ -5598,8 +5636,8 @@ > case DW_TAG_ptr_to_member_type: > case DW_TAG_set_type: > case DW_TAG_string_type: > - case DW_TAG_subroutine_type: > #endif > + case DW_TAG_subroutine_type: > case DW_TAG_base_type: > case DW_TAG_class_type: > case DW_TAG_interface_type: