gdb的ignore-errors命令
正文
ignore-errors不是gdb的内置命令,可以使用下面的Python扩展为gdb添加该命令:
- snippet.python
class IgnoreErrorsCommand (gdb.Command): """Execute a single command, ignoring all errors. Only one-line commands are supported. This is primarily useful in scripts.""" def __init__ (self): super (IgnoreErrorsCommand, self).__init__ ("ignore-errors", gdb.COMMAND_OBSCURE, # FIXME... gdb.COMPLETE_COMMAND) def invoke (self, arg, from_tty): try: gdb.execute (arg, from_tty) except: pass IgnoreErrorsCommand ()
参考
打赏作者以资鼓励: