+2012-08-06 Tom Tromey <tromey@redhat.com>
+
+ PR python/14386:
+ * varobj.c (update_dynamic_varobj_children): Don't call
+ PyIter_Check.
+
2012-08-06 Tom Tromey <tromey@redhat.com>
PR cli/14392:
+2012-08-06 Tom Tromey <tromey@redhat.com>
+
+ * gdb.python/py-mi.exp: Add test for printer whose children
+ are a list.
+ * gdb.python/py-prettyprint.c (struct children_as_list): New.
+ (main): New variable children_as_list.
+ * gdb.python/py-prettyprint.py (class pp_children_as_list):
+ New.
+ (register_pretty_printers): Register new printer.
+
2012-08-03 Edjunior Machado <emachado@linux.vnet.ibm.com>
* gdb.base/valgrind-infcall.exp: Expect leading `.' on ppc64's
"\\^done,value=\"<error reading variable: Cannot access memory.>.*\"" \
"evaluate me varobj"
+# Regression test for python/14836.
+mi_create_dynamic_varobj children_as_list children_as_list \
+ "printer whose children are returned as a list"
+
# C++ MI tests
gdb_exit
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}-cxx" \
int x;
};
+struct children_as_list {
+ int x;
+};
+
#ifdef __cplusplus
struct S : public s {
int zs;
struct ns ns, ns2;
struct lazystring estring, estring2;
struct hint_error hint_error;
+ struct children_as_list children_as_list;
nstype.elements = narray;
nstype.len = 0;
def display_hint (self):
raise Exception("hint failed")
+class pp_children_as_list:
+ "Throw error from display_hint"
+
+ def __init__(self, val):
+ self.val = val
+
+ def to_string(self):
+ return 'children_as_list_val'
+
+ def children (self):
+ return [('one', 1)]
+
class pp_outer:
"Print struct outer"
pretty_printers_dict[re.compile ('^struct hint_error$')] = pp_hint_error
pretty_printers_dict[re.compile ('^hint_error$')] = pp_hint_error
+ pretty_printers_dict[re.compile ('^struct children_as_list$')] = pp_children_as_list
+ pretty_printers_dict[re.compile ('^children_as_list$')] = pp_children_as_list
+
pretty_printers_dict[re.compile ('^memory_error$')] = MemoryErrorString
pretty_printers_dict[re.compile ('^eval_type_s$')] = pp_eval_type
make_cleanup_py_decref (children);
- if (!PyIter_Check (children))
- error (_("Returned value is not iterable"));
-
Py_XDECREF (var->child_iter);
var->child_iter = PyObject_GetIter (children);
if (!var->child_iter)