PR python/14386:
* varobj.c (update_dynamic_varobj_children): Don't call PyIter_Check. gdb/testsuite * 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.
This commit is contained in:
parent
4979d7f0a6
commit
2c12abee48
6 changed files with 40 additions and 3 deletions
|
@ -174,6 +174,18 @@ class pp_hint_error:
|
|||
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"
|
||||
|
||||
|
@ -282,6 +294,9 @@ def register_pretty_printers ():
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue