This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
Re: macros/2564: 'p siginfo->si_addr' doesn't work anymore
- From: tromey at redhat dot com
- To: gdb-prs at sources dot redhat dot com, nobody at sources dot redhat dot com, pedro at codesourcery dot com, tromey at redhat dot com
- Date: 11 Dec 2008 01:14:14 -0000
- Subject: Re: macros/2564: 'p siginfo->si_addr' doesn't work anymore
- Reply-to: tromey at redhat dot com, gdb-prs at sources dot redhat dot com, nobody at sources dot redhat dot com, pedro at codesourcery dot com, tromey at redhat dot com, gdb-gnats at sources dot redhat dot com
Synopsis: 'p siginfo->si_addr' doesn't work anymore
Responsible-Changed-From-To: unassigned->tromey
Responsible-Changed-By: tromey
Responsible-Changed-When: Thu Dec 11 01:14:13 2008
Responsible-Changed-Why:
I'll fix this.
State-Changed-From-To: open->analyzed
State-Changed-By: tromey
State-Changed-When: Thu Dec 11 01:14:13 2008
State-Changed-Why:
Thanks for the valgrind trace.
I've looked into it a bit more. I believe the problem
is due to yacc lookahead. In particular, while expanding
"si_addr", the lexer returns a NAME token for the final
"si_addr". Then the lexer calls finished_macro_expansion,
which frees the expansion string; then it returns an EOF
token. This causes the parser to reduce the final rule,
resulting in a call to write_exp_string, which reads
from the freed memory.
My first thought is that the simplest thing to do would
be to make an obstack during parsing, and simply push
all the intermediate macro expansions onto it.
I suspect this is a latent bug in 6.8, but I don't know
how to trigger it. This example does not work, perhaps
because the parser decides to reduce at different times
(I didn't check that theory).
http://sourceware.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=2564