2011-07-28 Phil Muldoon <pmuldoon@redhat.com>
* varobj.c (value_get_print_value): Move hint check later into the function. Comment function. Free thevalue before reusing it. 2011-07-28 Phil Muldoon <pmuldoon@redhat.com> * gdb.python/py-mi.exp: Test printers returning string hint, and also not returning a value. * gdb.python/py-prettyprint.c: Add testcase for above. * gdb.python/py-prettyprint.py: Add test printer for above.
This commit is contained in:
parent
e89702a8bd
commit
00bd41d6bc
6 changed files with 71 additions and 9 deletions
|
@ -17,6 +17,7 @@
|
|||
# printers.
|
||||
|
||||
import re
|
||||
import gdb
|
||||
|
||||
# Test returning a Value from a printer.
|
||||
class string_print:
|
||||
|
@ -186,6 +187,18 @@ class pp_outer:
|
|||
yield 's', self.val['s']
|
||||
yield 'x', self.val['x']
|
||||
|
||||
class MemoryErrorString:
|
||||
"Raise an error"
|
||||
|
||||
def __init__(self, val):
|
||||
self.val = val
|
||||
|
||||
def to_string(self):
|
||||
raise gdb.MemoryError ("Cannot access memory.");
|
||||
|
||||
def display_hint (self):
|
||||
return 'string'
|
||||
|
||||
def lookup_function (val):
|
||||
"Look-up and return a pretty-printer that can print val."
|
||||
|
||||
|
@ -261,6 +274,8 @@ 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 ('^memory_error$')] = MemoryErrorString
|
||||
|
||||
pretty_printers_dict = {}
|
||||
|
||||
register_pretty_printers ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue