我正在尝试为 GDB 编写一个简单的 python 扩展,只要遇到断点就会输出到文件中。根据文档,“可以对 gdb.Breakpoint 类进行子分类”(参见http://sourceware.org/gdb/onlinedocs/gdb/Breakpoints-In-Python.html)
但是,当我尝试以下代码时,我收到错误“TypeError:调用元类基时出错。类型'gdb.Breakpoint'不是可接受的基类型”
class MyBreakpoint(gdb.Breakpoint):
def stop (self):
print "break"
return False
我正在运行 Ubuntu 11.04 和 gdb 7.2。任何帮助或更好的文档链接将不胜感激。谢谢!
我的具体步骤:
$ gdb
GNU gdb (Ubuntu/Linaro 7.2-1ubuntu11) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) source t.py
Traceback (most recent call last):
File "t.py", line 3, in <module>
class MyBreakpoint(gdb.Breakpoint):
TypeError: Error when calling the metaclass bases
type 'gdb.Breakpoint' is not an acceptable base type
(gdb)