1 http://sourceware.org/ml/gdb-patches/2011-01/msg00016.html
2 Subject: [patch] New testcase: py-prettyprint.exp: print hint_error
6 PASS: gdb.python/py-prettyprint.exp: print hint_error
8 FYI: fix buglet in gdbpy_get_display_hint
9 http://sourceware.org/ml/gdb-patches/2010-07/msg00190.html
10 http://sourceware.org/ml/gdb-cvs/2010-07/msg00061.html
12 I would check it in as obvious but the 2011 ChangeLog move process has to be
13 done first. So to be checked in later.
21 2011-01-01 Jan Kratochvil <jan.kratochvil@redhat.com>
23 * gdb.python/py-prettyprint.c (struct hint_error): New.
24 (main): New variable hint_error.
25 * gdb.python/py-prettyprint.exp (run_lang_tests): New testcase
27 * gdb.python/py-prettyprint.py (class pp_hint_error): New.
28 (register_pretty_printers): Register it.
30 Index: gdb-7.2.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.c
31 ===================================================================
32 --- gdb-7.2.90.20110411.orig/gdb/testsuite/gdb.python/py-prettyprint.c 2011-03-31 21:59:26.000000000 +0200
33 +++ gdb-7.2.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.c 2011-04-11 19:42:10.000000000 +0200
34 @@ -44,6 +44,10 @@ struct lazystring {
45 @@ -215,6 +219,7 @@ main ()
46 nostring_type nstype, nstype2;
48 struct lazystring estring, estring2;
49 + struct hint_error hint_error;
51 nstype.elements = narray;
53 Index: gdb-7.2.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.exp
54 ===================================================================
55 --- gdb-7.2.90.20110411.orig/gdb/testsuite/gdb.python/py-prettyprint.exp 2011-03-07 17:03:03.000000000 +0100
56 +++ gdb-7.2.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.exp 2011-04-11 19:41:56.000000000 +0200
57 @@ -97,6 +97,8 @@ proc run_lang_tests {lang} {
58 gdb_test_no_output "python pp_ls_encoding = 'UTF-8'"
59 gdb_test "print estring2" "\"embedded \", <incomplete sequence \\\\302>"
61 + gdb_test "print hint_error" "Exception: hint failed\r\nhint_error_val"
63 gdb_test "print c" " = container \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}"
65 gdb_test "print nstype" " = {$nl *.0. = 7,$nl *.1. = 42$nl}"
66 Index: gdb-7.2.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.py
67 ===================================================================
68 --- gdb-7.2.90.20110411.orig/gdb/testsuite/gdb.python/py-prettyprint.py 2011-03-31 21:59:26.000000000 +0200
69 +++ gdb-7.2.90.20110411/gdb/testsuite/gdb.python/py-prettyprint.py 2011-04-11 19:41:56.000000000 +0200
70 @@ -161,6 +161,18 @@ class pp_ls:
71 def display_hint (self):
75 + "Throw error from display_hint"
77 + def __init__(self, val):
80 + def to_string(self):
81 + return 'hint_error_val'
83 + def display_hint (self):
84 + raise Exception("hint failed")
89 @@ -246,6 +258,9 @@ def register_pretty_printers ():
90 pretty_printers_dict[re.compile ('^struct outerstruct$')] = pp_outer
91 pretty_printers_dict[re.compile ('^outerstruct$')] = pp_outer
93 + pretty_printers_dict[re.compile ('^struct hint_error$')] = pp_hint_error
94 + pretty_printers_dict[re.compile ('^hint_error$')] = pp_hint_error
96 pretty_printers_dict = {}
98 register_pretty_printers ()