This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: python: get string of gdb.value


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'


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]