Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1367154

[PATCHv4 04/12] scripts/gdb: Provide exception catching parser

From Kieran Bingham <kieran.bingham@linaro.org>
Newsgroups linux.kernel
Subject [PATCHv4 04/12] scripts/gdb: Provide exception catching parser
Date 2016-03-30 14:10 +0200
Message-ID <rin6H-57W-39@gated-at.bofh.it> (permalink)
References <rin6G-57W-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Signed-off-by: Kieran Bingham <kieran.bingham@linaro.org>
---
 scripts/gdb/linux/utils.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scripts/gdb/linux/utils.py b/scripts/gdb/linux/utils.py
index 0893b326a28b..dbe2ad78048c 100644
--- a/scripts/gdb/linux/utils.py
+++ b/scripts/gdb/linux/utils.py
@@ -154,3 +154,10 @@ def get_gdbserver_type():
         if gdbserver_type is not None and hasattr(gdb, 'events'):
             gdb.events.exited.connect(exit_handler)
     return gdbserver_type
+
+
+def gdb_eval_or_none(expresssion):
+    try:
+        return gdb.parse_and_eval(expresssion)
+    except:
+        return None
-- 
2.5.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv4 00/12] gdb/scripts: Linux awareness debug commands Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
  [PATCHv4 10/12] scripts/gdb: Add a Radix Tree Parser Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
  [PATCHv4 12/12] scripts/gdb: Add lx_thread_info_by_pid helper Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
  [PATCHv4 05/12] scripts/gdb: Support !CONFIG_MODULES gracefully Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
  [PATCHv4 09/12] scripts/gdb: Add cpu iterators Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
  [PATCHv4 01/12] scripts/gdb: Provide linux constants Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
    Re: [PATCHv4 01/12] scripts/gdb: Provide linux constants Jan Kiszka <jan.kiszka@siemens.com> - 2016-03-30 23:10 +0200
  [PATCHv4 06/12] scripts/gdb: Provide a dentry_name VFS path helper Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
  [PATCHv4 02/12] scripts/gdb: Provide kernel list item generators Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
  [PATCHv4 07/12] scripts/gdb: Add io resource readers Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
  [PATCHv4 08/12] scripts/gdb: Add mount point list command Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
  [PATCHv4 11/12] scripts/gdb: Add documentation example for radix tree Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
  [PATCHv4 04/12] scripts/gdb: Provide exception catching parser Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200
  [PATCHv4 03/12] scripts/gdb: Convert modules usage to lists functions Kieran Bingham <kieran.bingham@linaro.org> - 2016-03-30 14:10 +0200

csiph-web