This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Array of short values
- From: Daniel Jacobowitz <drow at false dot org>
- To: Christoph Bartoschek <bartoschek at or dot uni-bonn dot de>
- Cc: gdb at sourceware dot org
- Date: Wed, 14 Feb 2007 10:42:22 -0500
- Subject: Re: Array of short values
- References: <200702141632.08219.bartoschek@or.uni-bonn.de>
On Wed, Feb 14, 2007 at 04:32:08PM +0100, Christoph Bartoschek wrote:
> Hi,
>
> is it possible to easily set an array of short as a convenience variable?
>
> set $arr = (short *) {1, 2, 3}
>
> Currently I have to use:
>
> set $arr = (short *) {0x00020001, 0x00000003}
I don't think so. { (short) 1, (short) 2 } should work, though.
Maybe someone will add C99 support to the C parser some day, and
improve this along the way.
Just so you know: this is probably not doing what you expect. Try
"print $arr". In fact it's probably calling malloc() in the program,
allocating memory, and stuffing your shorts there. I did some
experimenting with this but got too confused by the parser - I'll be
back to it, since it's related to my recent Python project.
--
Daniel Jacobowitz
CodeSourcery