Commit e78f3d70 authored by Kieran Bingham's avatar Kieran Bingham Committed by 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: default avatarKieran Bingham <kieran.bingham@linaro.org>
Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment