如何从gdb的内置python向gdb便利变量赋值?我认为它应该很简单,因为它是在尝试实现用户定义函数时自然产生的。但是我什么也没找到。在
UPD:添加了一个简化示例。但我的实际功能更复杂。不管怎样,将一个变量从python转移到gdb的方法会有很大帮助。在
用法示例(achtung!-它会引发一个错误):
#accept a string, return it's lenght
define RetLenOfArg
py arg0 = gdb.parse_and_eval("$arg0")
set $Retrn = py len(arg0)
end
Tags:
exist gdb的python API来获取/设置便利变量:来自documentation
如果确实需要strlen,可以使用
$_strlen
-一个内置的gdb便利函数,用于计算字符串长度:你可以用gdb.执行公司名称:
^{pr2}$这是一个测试:
相关问题 更多 >
编程相关推荐