summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDhananjay Balan <mb.dhananjay@gmail.com>2013-08-09 17:46:37 +0530
committerChris Johns <chrisj@rtems.org>2014-08-25 09:52:41 +1000
commitb743d63fde73cde72ddd80f5cd654e369e7d7bf0 (patch)
tree68ba0713ec19c151554a4a49a93d55fc14a67a8c
parentAdd task subcommand (diff)
downloadrtems-tools-b743d63fde73cde72ddd80f5cd654e369e7d7bf0.tar.bz2
Catch nonvalid indexes.
Catch IndexErrors generated while referancing non existant indexes.
-rw-r--r--tools/gdb/python/rtems.py10
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()