From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25222 invoked by alias); 11 Dec 2008 17:53:52 -0000 Received: (qmail 25212 invoked by uid 22791); 11 Dec 2008 17:53:51 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 11 Dec 2008 17:53:16 +0000 Received: (qmail 32328 invoked from network); 11 Dec 2008 17:53:14 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 11 Dec 2008 17:53:14 -0000 From: Pedro Alves To: gdb-patches@sourceware.org, tromey@redhat.com Subject: Re: RFA: fix PR macros/2564 Date: Thu, 11 Dec 2008 17:53:00 -0000 User-Agent: KMail/1.9.10 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812111753.22624.pedro@codesourcery.com> 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-12/txt/msg00206.txt.bz2 On Thursday 11 December 2008 17:06:58, Tom Tromey wrote: > This patch fixes PR macros/2564. > > The bug here is that the lexer calls finished_macro_expansion, freeing > the macro expansion text, while a token referring to this memory is > still "live". This happens because the parser has not yet reduced the > rule using this token. > > This patch fixes this problem in a simple way: we create an obstack > for use during parsing, and simply keep all macro expansions on this > obstack for the duration of the parse. > > Built and regtested on x86-64 (compile farm). > > Please review. It looks quite reasonable to me. OK. Thanks a lot. > > Tom > > 2008-12-11 Tom Tromey > > PR macros/2564: > * c-exp.y (macro_original_text, expansion_obstack, > expression_macro_scope): New globals. > (scan_macro_expansion): New function. > (scanning_macro_expansion): Likewise. > (finished_macro_expansion): Likewise. > (scan_macro_cleanup): Likewise. > (c_parse): Find macro scope. Initialize obstack. > * c-lang.h (scan_macro_expansion, scanning_macro_expansion, > finished_macro_expansion, expression_macro_lookup_func, > expression_macro_lookup_baton): Remove. > * c-lang.c (scan_macro_expansion, scanning_macro_expansion, > finished_macro_expansion, expression_macro_lookup_func, > expression_macro_lookup_baton): Remove. > (macro_original_text, macro_expanded_text, > c_preprocess_and_parse): Remove. > (c_language_defn, cplus_language_defn, asm_language_defn, > minimal_language_defn): Use c_parse. > > 2008-12-11 Tom Tromey > > * gdb.base/macscp.exp: Print "address.addr". > * gdb.base/macscp1.c (struct outer): New struct. > (address): New global. > -- Pedro Alves