python gdb frame unwind does not recogonize structure member variables - Stack Overflow

I am trying to print the value of a member variable of a structure instantiated in the caller function

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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信