c++ - GDB Python APIs: Doesn't .parse_and_eval() make .cast() and .dereference() redundant? -
i not able understand utility of 2 gdb-python apis, value.cast()
, value.dereference()
. feel gdb.parse_and_eval()
can same thing these 2 guys ( , more ).
for example, can achieve value.cast("int*")
gdb.parse_and_eval('(int*)value')
, can achieve value.dereference()
gdb.parse_and_eval(*value)
.
specifically have seen people use .dereference()
dereference struct
pointer some_struct_ptr.dereference()['some_var']
. here feel .dereference()
not needed @ all. some_struct_ptr['some_var']
produces exact same output.
am missing something?
parse_and_eval
not want. unlike other operations, exposed user's current language setting, , other things set print object
. and, if have gdb.value
other computation, using parse_and_eval
means must convert string first -- can pain if pretty-printers involved, instead safety have convert long
, string.
it true dereference
not needed if accessing member via pointer. gdb quirk got exposed via value
. perhaps better.
while still think best use value
api, isn't possible. example there no way assign way; , there other holes well.
that said, can write code like.
Comments
Post a Comment