From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Berlin To: Eli Zaretskii Cc: gdb@sources.redhat.com Subject: Re: Cast to a struct in expressions Date: Fri, 27 Apr 2001 08:24:00 -0000 Message-id: References: <8011-Fri27Apr2001111107+0300-eliz@is.elta.co.il> X-SW-Source: 2001-04/msg00201.html "Eli Zaretskii" 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