title: Getting address from gdb.Value
body: <p>I'm creating a command for gdb using python integration and trying to get the address of a variable. I've got the value already using:</p>
  
  <pre><code>v = gdb.parse_and_eval("var_name")
  </code></pre>
  
  <p>But that <code>v</code> can serialise in a number of ways depending on the type. For example if it's a <code>char*</code>, it will be displayed as:</p>
  
  <pre><code>&gt;&gt;&gt; print v
  0x7f06a2cfd320 "x"
  &gt;&gt;&gt; print v.address
  None
  </code></pre>
  
  <p>Ok, so this doesn't work as expected. I tried first dereferencing, then getting the address, but that gives me back the original value:</p>
  
  <pre><code>&gt;&gt;&gt; print v.dereference().address
  0x7f06a2cfd320 "x"
  </code></pre>
  
  <p>How can I get the address part only? The only way I could find so far looks a bit long:</p>
  
  <pre><code>&gt;&gt;&gt; vptr = gdb.lookup_type("void").pointer()
  &gt;&gt;&gt; print v.cast(vptr)
  0x7f06a2cfd320
  </code></pre>
  
  <p>Is there some more direct way?</p>