diff options
author | Dhananjay Balan <mb.dhananjay@gmail.com> | 2013-08-09 17:46:37 +0530 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2014-08-25 09:52:41 +1000 |
commit | b743d63fde73cde72ddd80f5cd654e369e7d7bf0 (patch) | |
tree | 68ba0713ec19c151554a4a49a93d55fc14a67a8c /tools | |
parent | a71368892a2010c9a2b8e9ae3ce1c23742b296c3 (diff) |
Catch nonvalid indexes.
Catch IndexErrors generated while referancing non existant indexes.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gdb/python/rtems.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/gdb/python/rtems.py b/tools/gdb/python/rtems.py index 8eb49c9..dbfd7c7 100644 --- a/tools/gdb/python/rtems.py +++ b/tools/gdb/python/rtems.py @@ -130,10 +130,14 @@ class rtems_semaphore(gdb.Command): except ValueError: print "error: %s is not an index" % (val) return + try: + obj = objects.information.object_return( self.api, + self._class, + index ).dereference() + except IndexError: + print "error: index %s is invalid" % (index) + return - obj = objects.information.object_return( self.api, - self._class, - int(index)).dereference() instance = classic.semaphore(obj) instance.show(from_tty) objects.information.invalidate() |