开发者

How to assign variable to python using GDB's new python support?

Recently I came across with surprise the the current version of GDB support python scrippting, which very likely means I can plot variables while debugging the program -- something I dreamed about a long time ago. However, I quickly get stuck because I can't get a variable's value "out of" GDB and assign it to a python variable开发者_高级运维. The method should be inside the gdb module, but I don't know which function to call. Anybody knows? Tell me please :) Thank you!


To access the variable x in the currently selected gdb frame, you can use

x = gdb.selected_frame().read_var("x")

This will assign a gdb.Value instance to x.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜