From b743d63fde73cde72ddd80f5cd654e369e7d7bf0 Mon Sep 17 00:00:00 2001 From: Dhananjay Balan Date: Fri, 9 Aug 2013 17:46:37 +0530 Subject: Catch nonvalid indexes. Catch IndexErrors generated while referancing non existant indexes. --- tools/gdb/python/rtems.py | 10 +++++++--- 1 file 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() -- cgit v1.2.3