python: get string of gdb.value

André Pönitz andre.poenitz@nokia.com
Fri May 6 17:20:00 GMT 2011


On Friday 06 May 2011 17:04:53 ext Klaus Rudolph wrote:
> Hi all,
> 
> I have a gdb.value object, which is of a type my_enum_type_t and holds a value of 'ONE' which is int 6.
> 
> if I write 
> print var
> the output is 'ONE'
> bit if I try to do:
> 
> if var == 'ONE':

enum E { ONE = 6 };

E e = ONE;

python print str(gdb.parse_and_eval("e")) == "ONE"

   -> True

Regards
Andre'



More information about the Gdb mailing list