i'm trying write simple python extension gdb outputs file whenever breakpoint hit. according documentation, "the gdb.breakpoint class can sub-classed" (see http://sourceware.org/gdb/onlinedocs/gdb/breakpoints-in-python.html)
however when try following code error "typeerror: error when calling metaclass bases. type 'gdb.breakpoint' not acceptable base type"
class mybreakpoint(gdb.breakpoint): def stop (self): print "break" return false i'm running ubuntu 11.04 , gdb 7.2. or links better documentation appreciated. thanks!
my exact steps:
$ 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> free software: free change , redistribute it. there no warranty, extent permitted law. type "show copying" , "show warranty" details. gdb configured "i686-linux-gnu". 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 metaclass bases type 'gdb.breakpoint' not acceptable base type (gdb)
the appropriate gdb 7.2 documentation here:
http://sourceware.org/gdb/download/onlinedocs/gdb/breakpoints-in-python.html#breakpoints-in-python
i'm assuming employedrussian using relatively recent gdb 7.2 (7.2.90 or equivalent seems contain these patches)
this not official release of 7.2 , in many ways more 7.3 pre-release, having been created 2 weeks before 7.3 branched (the new feature cut off of gdb 7.3).
so worked on merely gdb uses 'branch 7.3 before release', rather 'branch 7.3 after 7.2 release' model.
so 7.2 might have resort to
break foo commands python print "break" end
Comments
Post a Comment