Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
To: "Sascha" <sascha@pasalacqua.de>
Cc: <gdb@sourceware.org>
Subject: Re: Assigning values to type casted vars
Date: Mon, 12 Mar 2007 10:31:00 -0000	[thread overview]
Message-ID: <17909.11222.663337.476821@kahikatea.snap.net.nz> (raw)
In-Reply-To: <000001c76478$30c5a1e0$02b2a8c0@insanenotebook>

 > 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


      reply	other threads:[~2007-03-12 10:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-12  7:29 Sascha
2007-03-12 10:31 ` Nick Roberts [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17909.11222.663337.476821@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=gdb@sourceware.org \
    --cc=sascha@pasalacqua.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox