gdb
* varobj.c (update_dynamic_varobj_children): Properly handle errors from iterator. gdb/testsuite * gdb.python/py-prettyprint.py (exception_flag): New global. (NoStringContainerPrinter._iterator.next): Check it. * gdb.python/py-prettyprint.c (main): New variable nstype2. * gdb.python/py-mi.exp: Set exception_flag and do more tests.
This commit is contained in:
parent
df5c6c5031
commit
a4c8e80688
6 changed files with 79 additions and 3 deletions
|
@ -53,6 +53,9 @@ class ContainerPrinter:
|
|||
def children(self):
|
||||
return self._iterator(self.val['elements'], self.val['len'])
|
||||
|
||||
# Flag to make NoStringContainerPrinter throw an exception.
|
||||
exception_flag = False
|
||||
|
||||
# Test a printer where to_string is None
|
||||
class NoStringContainerPrinter:
|
||||
class _iterator:
|
||||
|
@ -67,6 +70,8 @@ class NoStringContainerPrinter:
|
|||
def next(self):
|
||||
if self.pointer == self.end:
|
||||
raise StopIteration
|
||||
if exception_flag:
|
||||
raise gdb.MemoryError, 'hi bob'
|
||||
result = self.pointer
|
||||
self.pointer = self.pointer + 1
|
||||
return ('[%d]' % int (result - self.start), result.dereference())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue