]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-print-class.patch
- typo
[packages/gdb.git] / gdb-print-class.patch
1 http://sourceware.org/ml/gdb-cvs/2012-09/msg00169.html
2
3 ### src/gdb/ChangeLog   2012/09/27 12:53:57     1.14718
4 ### src/gdb/ChangeLog   2012/09/27 16:04:18     1.14719
5 ## -1,3 +1,8 @@
6 +2012-09-27  Tom Tromey  <tromey@redhat.com>
7 +
8 +       Fix https://bugzilla.redhat.com/show_bug.cgi?id=849357
9 +       * cp-valprint.c (cp_print_value_fields): Use get_vptr_fieldno.
10 +
11  2012-09-27  Joel Brobecker  <brobecker@adacore.com>
12  
13         * sol-thread.c (sol_thread_fetch_registers)
14 --- src/gdb/cp-valprint.c       2012/07/06 05:36:07     1.85
15 +++ src/gdb/cp-valprint.c       2012/09/27 16:04:22     1.86
16 @@ -210,7 +210,9 @@
17      {
18        int statmem_obstack_initial_size = 0;
19        int stat_array_obstack_initial_size = 0;
20 -      
21 +      struct type *vptr_basetype = NULL;
22 +      int vptr_fieldno;
23 +
24        if (dont_print_statmem == 0)
25         {
26           statmem_obstack_initial_size =
27 @@ -225,6 +227,7 @@
28             }
29         }
30  
31 +      vptr_fieldno = get_vptr_fieldno (type, &vptr_basetype);
32        for (i = n_baseclasses; i < len; i++)
33         {
34           /* If requested, skip printing of static fields.  */
35 @@ -358,7 +361,7 @@
36                                            v, stream, recurse + 1,
37                                            options);
38                 }
39 -             else if (i == TYPE_VPTR_FIELDNO (type))
40 +             else if (i == vptr_fieldno && type == vptr_basetype)
41                 {
42                   int i_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
43                   struct type *i_type = TYPE_FIELD_TYPE (type, i);
44 ### src/gdb/testsuite/ChangeLog 2012/09/26 19:50:12     1.3396
45 ### src/gdb/testsuite/ChangeLog 2012/09/27 16:04:22     1.3397
46 ## -1,3 +1,10 @@
47 +2012-09-27  Tom Tromey  <tromey@redhat.com>
48 +
49 +       * gdb.cp/derivation.exp: Add regression test.
50 +       * gdb.cp/derivation.cc (class V_base, class V_inter, class
51 +       V_derived): New.
52 +       (vderived): New global.
53 +
54  2012-09-26  Tom Tromey  <tromey@redhat.com>
55  
56         * gdb.dwarf2/dw2-common-block.S: New file.
57 --- src/gdb/testsuite/gdb.cp/derivation.cc      2011/12/13 17:22:08     1.2
58 +++ src/gdb/testsuite/gdb.cp/derivation.cc      2012/09/27 16:04:23     1.3
59 @@ -118,8 +118,37 @@
60      
61  };
62  
63 +class V_base
64 +{
65 +public:
66 +  virtual void m();
67 +  int base;
68 +};
69  
70 +void
71 +V_base::m()
72 +{
73 +}
74 +
75 +class V_inter : public virtual V_base
76 +{
77 +public:
78 +  virtual void f();
79 +  int inter;
80 +};
81 +
82 +void
83 +V_inter::f()
84 +{
85 +}
86 +
87 +class V_derived : public V_inter
88 +{
89 +public:
90 +  double x;
91 +};
92  
93 +V_derived vderived;
94  
95  int A::afoo() {
96      return 1;
97 --- src/gdb/testsuite/gdb.cp/derivation.exp     2012/07/10 15:18:18     1.19
98 +++ src/gdb/testsuite/gdb.cp/derivation.exp     2012/09/27 16:04:23     1.20
99 @@ -176,3 +176,11 @@
100  
101  gdb_test "print g_instance.bfoo()" "\\$\[0-9\]+ = 2" "print value of g_instance.bfoo()"
102  gdb_test "print g_instance.cfoo()" "\\$\[0-9\]+ = 3" "print value of g_instance.cfoo()"
103 +
104 +# This is a regression test for a bug that caused a crash when trying
105 +# to print the vtbl pointer.  We don't care about the output so much
106 +# here (it is tested elsewhere), just that gdb doesn't crash.  We test
107 +# "ptype" first because, before the gdb fix, that was the only code
108 +# path calling get_vptr_fieldno.
109 +gdb_test "ptype vderived" "type = .*"
110 +gdb_test "print vderived" " = {.* inter = 0.*x = 0}"
This page took 0.050405 seconds and 3 git commands to generate.