title: gdb python: How to do arithmetic operation on a gdb.value?
body: <p>why i am getting wrong answer while doing arithmetic operation:</p>
  
  <pre><code>(gdb) python address = gdb.parse_and_eval('&amp;(((struct my_struct *)next-&gt;priv).wait_list)')
  (gdb) python print address
  0x410027a00728
  (gdb) python offset = gdb.parse_and_eval('&amp;((struct wait_list_t *)0)-&gt;list')
  (gdb) python print offset
  0x0
  (gdb) python diff = address - offset
  gdb) python print diff
  0x410027a0072
  </code></pre>
  
  <p>while output should be <code>0x410027a00728</code>. 
  i checked the type of address and offset by</p>
  
  <pre><code>(gdb) python print address.type
  struct list_head *
  (gdb) python print offset.type
  struct list_head *
  </code></pre>
  
  <p>I tried this also</p>
  
  <pre><code>(gdb) python y = hex(long(address))
  (gdb) python print y
  0x410027A14FF0L
  (gdb) python z = hex(long(offset))
  (gdb) python print z
  0x0L
  (gdb) python diff = y - z
  Traceback (most recent call last):
  File "&lt;string&gt;", line 1, in ?
  TypeError: unsupported operand type(s) for -: 'str' and 'str'
  Error while executing Python code.
  </code></pre>
  
  <p>Is there any alternative to do this ?</p>