Cast to a struct in expressions
Daniel Berlin
dan@cgsoftware.com
Fri Apr 27 08:24:00 GMT 2001
"Eli Zaretskii" <eliz@is.elta.co.il> writes:
> Should the following work?
>
> (gdb) p/x *(struct {long foo; unsigned bar;} *)foobar
>
> It doesn't seem to work for me; GDB complains thusly:
Correct.
>
> A parse error in expression, near `long foo; unsigned bar} *)foobar
>
> Seems like the parser chokes on the struct declaration?
Yes.
> Am I missing something?
Yes, I think. The parser only handles expressions, nothing more.
This is why it's c-exp.y, and not c.y.
:)
If you have a real struct already defined, of course, and di
p/x *(sturct foostruct *)foobar
then *that* should work.
--dan
--
"I couldn't find the remote control to the remote control.
"-Steven Wright
More information about the Gdb
mailing list