# 正文 ignore-errors不是gdb的内置命令,可以使用下面的Python扩展为gdb添加该命令: ```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 () ``` # 参考 * [Re: How to ignore errors in user defined commands?](https://sourceware.org/legacy-ml/gdb/2010-06/msg00100.html)