diff options
author | Tom Tromey <tromey@redhat.com> | 2011-03-31 19:59:26 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2011-03-31 19:59:26 +0000 |
commit | a4c8e8068824062a43759f22ff0d22efe8996b82 (patch) | |
tree | 872b7851c93ed4310172483496fc607fbd33014c /gdb/testsuite | |
parent | df5c6c503133136c5d6e5c5eea6f43d276a8eda0 (diff) | |
download | gdb-a4c8e8068824062a43759f22ff0d22efe8996b82.zip gdb-a4c8e8068824062a43759f22ff0d22efe8996b82.tar.gz gdb-a4c8e8068824062a43759f22ff0d22efe8996b82.tar.bz2 |
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.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-mi.exp | 9 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-prettyprint.c | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-prettyprint.py | 5 |
4 files changed, 24 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6cc7444..58f2a21 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2011-03-31 Tom Tromey <tromey@redhat.com> + + * 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. + 2011-03-29 Tom Tromey <tromey@redhat.com> * gdb.cp/anon-struct.cc: New file. diff --git a/gdb/testsuite/gdb.python/py-mi.exp b/gdb/testsuite/gdb.python/py-mi.exp index 02763f1..629417b 100644 --- a/gdb/testsuite/gdb.python/py-mi.exp +++ b/gdb/testsuite/gdb.python/py-mi.exp @@ -274,4 +274,13 @@ mi_gdb_test "-var-set-visualizer nscont gdb.default_visualizer" \ "\\^done" \ "choose default visualizer" +mi_gdb_test "python exception_flag = True" "" + +mi_create_dynamic_varobj nstype2 nstype2 \ + "create nstype2 varobj" + +mi_list_varobj_children nstype2 { + { {nstype2.<error at 0>} {<error at 0>} 6 {char \[6\]} } +} "list children after setting exception flag" + remote_file host delete ${remote_python_file} diff --git a/gdb/testsuite/gdb.python/py-prettyprint.c b/gdb/testsuite/gdb.python/py-prettyprint.c index 35c7500..5f98433 100644 --- a/gdb/testsuite/gdb.python/py-prettyprint.c +++ b/gdb/testsuite/gdb.python/py-prettyprint.c @@ -212,7 +212,7 @@ main () const struct string_repr cstring = { { "const string" } }; /* Clearing by being `static' could invoke an other GDB C++ bug. */ struct nullstr nullstr; - nostring_type nstype; + nostring_type nstype, nstype2; struct ns ns, ns2; struct lazystring estring, estring2; @@ -283,5 +283,7 @@ main () nstype.elements[1] = 42; nstype.len = 2; + nstype2 = nstype; + return 0; /* break to inspect struct and union */ } diff --git a/gdb/testsuite/gdb.python/py-prettyprint.py b/gdb/testsuite/gdb.python/py-prettyprint.py index 873039a..831a163 100644 --- a/gdb/testsuite/gdb.python/py-prettyprint.py +++ b/gdb/testsuite/gdb.python/py-prettyprint.py @@ -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()) |