I want to cast in python code a gdb.value which is a complicated type variable to int (this is not general type, but defined in the our code - a kind of bitfield). When I promped in the gdb shell itself:
"p var"
it prints it as int, i.e. the gdb know how to cast that bitfield to int.
(Strange thing, in addition, I got when I try this command:
int(var.cast(i.type))
When "i" is gdb.value that its type is int. The var indeed becomes int, but its value become same as the value of i).
So is someone know how to cast this gdb.value by use the knowledge of the gdb. (Or by other way..)
Thanks. This is my first question in StackOverFlow, sorry on the confusion and my weak English.
What you want is:
int(value.cast(gdb.lookup_type('long')))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With