[rtems-tools commit] Catch nonvalid indexes.
Chris Johns
chrisj at rtems.org
Sun Aug 24 23:45:34 UTC 2014
Module: rtems-tools
Branch: master
Commit: b743d63fde73cde72ddd80f5cd654e369e7d7bf0
Changeset: http://git.rtems.org/rtems-tools/commit/?id=b743d63fde73cde72ddd80f5cd654e369e7d7bf0
Author: Dhananjay Balan <mb.dhananjay at gmail.com>
Date: Fri Aug 9 18:04:37 2013 +0530
Catch nonvalid indexes.
Catch IndexErrors generated while referancing non existant indexes.
---
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()
More information about the vc
mailing list