From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28825 invoked by alias); 15 Feb 2007 01:03:02 -0000 Received: (qmail 28816 invoked by uid 22791); 15 Feb 2007 01:03:01 -0000 X-Spam-Check-By: sourceware.org Received: from mx2.palmsource.com (HELO mx2.palmsource.com) (12.7.175.14) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 15 Feb 2007 01:02:57 +0000 Received: from localhost (localhost [127.0.0.1]) by localhost.domain.tld (Postfix) with ESMTP id 73F3111DB92; Wed, 14 Feb 2007 17:02:56 -0800 (PST) Received: from mx2.palmsource.com ([127.0.0.1]) by localhost (mx2.palmsource.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 11059-03-31; Wed, 14 Feb 2007 17:02:55 -0800 (PST) Received: from ussunex01.palmsource.com (unknown [192.168.101.9]) by mx2.palmsource.com (Postfix) with ESMTP id 58CA111D486; Wed, 14 Feb 2007 17:02:55 -0800 (PST) Received: from 192.168.92.92 ([192.168.92.92]) by ussunex01.palmsource.com ([192.168.101.9]) via Exchange Front-End Server owa.palmsource.com ([10.0.20.17]) with Microsoft Exchange Server HTTP-DAV ; Thu, 15 Feb 2007 01:02:55 +0000 Received: from svmsnyderlnx by owa.palmsource.com; 14 Feb 2007 17:02:54 -0800 Subject: Re: Array of short values From: Michael Snyder To: Christoph Bartoschek Cc: gdb@sourceware.org In-Reply-To: <200702141706.04815.bartoschek@or.uni-bonn.de> References: <200702141632.08219.bartoschek@or.uni-bonn.de> <20070214154222.GA6588@caradoc.them.org> <200702141706.04815.bartoschek@or.uni-bonn.de> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Thu, 15 Feb 2007 08:53:00 -0000 Message-Id: <1171501374.14623.91.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 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/msg00153.txt.bz2 On Wed, 2007-02-14 at 17:06 +0100, Christoph Bartoschek wrote: > 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. For good or ill, gdb relies heavily on target malloc(). Any time you create a string or an array, gdb gets the target memory by calling malloc. set var mycharptr = "hello" will call malloc.