]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-test-pp-hint-error.patch
- up to 7.3.1
[packages/gdb.git] / gdb-test-pp-hint-error.patch
1 http://sourceware.org/ml/gdb-patches/2011-01/msg00016.html
2 Subject: [patch] New testcase: py-prettyprint.exp: print hint_error
3
4 Hi,
5
6 PASS: gdb.python/py-prettyprint.exp: print hint_error
7 for
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
11
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.
14
15
16 Thanks,
17 Jan
18
19
20 gdb/testsuite/
21 2011-01-01  Jan Kratochvil  <jan.kratochvil@redhat.com>
22
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
26         "print hint_error".
27         * gdb.python/py-prettyprint.py (class pp_hint_error): New.
28         (register_pretty_printers): Register it.
29
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 {
35    const char *lazy_str;
36  };
37  
38 +struct hint_error {
39 +  int x;
40 +};
41 +
42  #ifdef __cplusplus
43  struct S : public s {
44    int zs;
45 @@ -215,6 +219,7 @@ main ()
46    nostring_type nstype, nstype2;
47    struct ns ns, ns2;
48    struct lazystring estring, estring2;
49 +  struct hint_error hint_error;
50  
51    nstype.elements = narray;
52    nstype.len = 0;
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>"
60  
61 +    gdb_test "print hint_error" "Exception: hint failed\r\nhint_error_val"
62 +
63      gdb_test "print c" " = container \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}"
64  
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):
72          return 'string'
73  
74 +class pp_hint_error:
75 +    "Throw error from display_hint"
76 +
77 +    def __init__(self, val):
78 +        self.val = val
79 +
80 +    def to_string(self):
81 +        return 'hint_error_val'
82 +
83 +    def display_hint (self):
84 +        raise Exception("hint failed")
85 +
86  class pp_outer:
87      "Print struct outer"
88  
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
92  
93 +    pretty_printers_dict[re.compile ('^struct hint_error$')]  = pp_hint_error
94 +    pretty_printers_dict[re.compile ('^hint_error$')]  = pp_hint_error
95 +
96  pretty_printers_dict = {}
97  
98  register_pretty_printers ()
This page took 0.0384 seconds and 3 git commands to generate.