This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFA: fix PR macros/2564
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org, tromey at redhat dot com
- Date: Thu, 11 Dec 2008 17:53:22 +0000
- Subject: Re: RFA: fix PR macros/2564
- References: <m3tz9aej4d.fsf@fleche.redhat.com>
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 <tromey@redhat.com>
>
> 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 <tromey@redhat.com>
>
> * gdb.base/macscp.exp: Print "address.addr".
> * gdb.base/macscp1.c (struct outer): New struct.
> (address): New global.
>
--
Pedro Alves