I am trying to print the value of a member variable of a structure instantiated in the caller function as below. While the read_var on older() frame works for the structure variable itself, it doesn't recognize its members. Is this an expected behaviour or a bug?
typedef struct {
int a;
int b;
} ex_struct;
void first_level_func(ex_struct *ex_s)
{
ex_s->a++;
}
int main(void)
{
ex_struct e_s = {4,5};
first_level_func(&e_s);
}
Breakpoint 2, first_level_func (ex_s=0x7fffffffbff8) at test.c:23
23 ex_s->a++;
(gdb) python print(gdb.newest_frame().older().read_var("e_s"))
{a = 4, b = 5}
(gdb) python print(gdb.newest_frame().older().read_var("e_s.a"))
Traceback (most recent call last):
File "<string>", line 1, in <module>
ValueError: Variable 'e_s.a' not found.
Error while executing Python code.
expecting to see value 4 printed, but got ValueError: Variable 'e_s.a' not found.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744926777a4601485.html
评论列表(0条)