From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23970 invoked by alias); 14 Feb 2007 16:06:23 -0000 Received: (qmail 23959 invoked by uid 22791); 14 Feb 2007 16:06:21 -0000 X-Spam-Check-By: sourceware.org Received: from brical.or.uni-bonn.de (HELO brical.or.uni-bonn.de) (131.220.141.99) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 14 Feb 2007 16:06:07 +0000 Received: from wse04.or.uni-bonn.de (bg-1.or.uni-bonn.de [131.220.141.100]) by brical.or.uni-bonn.de (Postfix) with ESMTP id 7064D3B7D4 for ; Wed, 14 Feb 2007 17:04:46 +0100 (CET) Received: from [131.220.143.130] (wse00.or.uni-bonn.de [131.220.143.130]) by wse04.or.uni-bonn.de (Postfix) with ESMTP id 6BC73E965 for ; Wed, 14 Feb 2007 17:09:03 +0100 (CET) From: Christoph Bartoschek To: gdb@sourceware.org Subject: Re: Array of short values Date: Wed, 14 Feb 2007 17:47:00 -0000 User-Agent: KMail/1.9.6 References: <200702141632.08219.bartoschek@or.uni-bonn.de> <20070214154222.GA6588@caradoc.them.org> In-Reply-To: <20070214154222.GA6588@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200702141706.04815.bartoschek@or.uni-bonn.de> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-02/txt/msg00130.txt.bz2 Am Mittwoch, 14. Februar 2007 schrieb Daniel Jacobowitz: > 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. I would not expect that it calls malloc within the program, because malloc could be broken during a debugging session. But I guess there are not many other possibilities left. Thanks to you and Frederic. Christoph