From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11037 invoked by alias); 12 Mar 2007 10:31:04 -0000 Received: (qmail 11029 invoked by uid 22791); 12 Mar 2007 10:31:03 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 12 Mar 2007 10:30:54 +0000 Received: from kahikatea.snap.net.nz (76.60.255.123.dynamic.snap.net.nz [123.255.60.76]) by viper.snap.net.nz (Postfix) with ESMTP id E379F3DAFD6; Mon, 12 Mar 2007 23:30:49 +1300 (NZDT) Received: by kahikatea.snap.net.nz (Postfix, from userid 500) id 883E14F72C; Mon, 12 Mar 2007 23:30:48 +1300 (NZDT) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17909.11222.663337.476821@kahikatea.snap.net.nz> Date: Mon, 12 Mar 2007 10:31:00 -0000 To: "Sascha" Cc: Subject: Re: Assigning values to type casted vars In-Reply-To: <000001c76478$30c5a1e0$02b2a8c0@insanenotebook> References: <000001c76478$30c5a1e0$02b2a8c0@insanenotebook> X-Mailer: VM 7.19 under Emacs 22.0.95.3 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-03/txt/msg00163.txt.bz2 > Eclipse CDT supports casting variables to a different type. This is done by > creating an MI var like this: > > 1466-var-create - * (int)myValue > 1466^done,name="var35",numchild="0",value="1",type="int" > > 1467-var-show-attributes var35 > 1467^done,attr="editable" > > The var is "editable". But in most cases GDB does report an error when > assigning a value to the var: > > 1472-var-assign var35 0x1234 > 1472^error,msg="mi_cmd_var_assign: Could not assign expression to varible > object" The fact that the var has the attribute "editable" is a bit of a red herring. A value can't be assigned because (int)myValue isn't an lvalue. You get the same error if you do: -var-create - * 2*myValue ^done,name="var36",numchild="0",value="2",type="int" -var-assign var36 0x1234 I think it only makes sense to watch such values. -- Nick http://www.inet.net.nz/~nickrob