如何使用 python 接口在 GDB 中查找重载方法?
我有一个类,它有几个名为“el”的方法,其中一个需要两个int
s。GDB 在断点处停止,_Dr
在下级进程的作用域中调用了一个成员变量。我这样做是为了得到一个 Pythongdb.Value
对象,它表示_Dr
:
(gdb) python _Dr = gdb.parse_and_eval('_Dr')
现在我想获取el(int,int)
方法:
(gdb) python el = _Dr['el']
Traceback (most recent call last):
File "<string>", line 1, in <module>
gdb.error: cannot resolve overloaded method `el': no arguments supplied
Error while executing Python code.
我如何告诉它解决重载的参数类型?
我试过这个:
(gdb) python el = _Dr['el(int,int)']
Traceback (most recent call last):
File "<string>", line 1, in <module>
gdb.error: There is no member or method named el(int,int).
Error while executing Python code.
和这个:
(gdb) python el = _Dr['el', 'int', 'int']
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: Could not convert Python object: ('el', 'int', 'int').
Error while executing Python code.
和这个:
(gdb) python el = _Dr['el(1,1)']
Traceback (most recent call last):
File "<string>", line 1, in <module>
gdb.error: There is no member or method named el(1,1).
Error while executing Python code.
这样做的正确方法是什么?