提交 e78f3d70 编写于 作者: K Kieran Bingham 提交者: Linus Torvalds

scripts/gdb: provide exception catching parser

If we attempt to read a value that is not available to GDB, an exception
is raised.  Most of the time, this is a good thing; however on occasion
we will want to be able to determine if a symbol is available.

By catching the exception to simply return None, we can determine if we
tried to read an invalid value, without the exception taking our
execution context away from us

Link: http://lkml.kernel.org/r/c72b25c06fc66e1d68371154097e2cbb112555d8.1462865983.git.jan.kiszka@siemens.comSigned-off-by: NKieran Bingham <kieran.bingham@linaro.org>
Signed-off-by: NJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 619ccaf3
...@@ -154,3 +154,10 @@ def get_gdbserver_type(): ...@@ -154,3 +154,10 @@ def get_gdbserver_type():
if gdbserver_type is not None and hasattr(gdb, 'events'): if gdbserver_type is not None and hasattr(gdb, 'events'):
gdb.events.exited.connect(exit_handler) gdb.events.exited.connect(exit_handler)
return gdbserver_type return gdbserver_type
def gdb_eval_or_none(expresssion):
try:
return gdb.parse_and_eval(expresssion)
except:
return None
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册