]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* cp-valprint.c (cp_print_value_fields): Use
authorTom Tromey <tromey@redhat.com>
Thu, 15 Mar 2012 15:49:42 +0000 (15:49 +0000)
committerTom Tromey <tromey@redhat.com>
Thu, 15 Mar 2012 15:49:42 +0000 (15:49 +0000)
print_function_pointer_address for vtable slot.
gdb/testsuite
* gdb.cp/virtfunc2.exp: Update expected output.
* gdb.cp/pr9631.exp: Update expected output.
* gdb.cp/member-ptr.exp: Update expected output.
* gdb.cp/inherit.exp (test_print_mvi_classes): Update expected
output.
* gdb.cp/casts.exp: Update expected output.

gdb/ChangeLog
gdb/cp-valprint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.cp/casts.exp
gdb/testsuite/gdb.cp/inherit.exp
gdb/testsuite/gdb.cp/member-ptr.exp
gdb/testsuite/gdb.cp/pr9631.exp
gdb/testsuite/gdb.cp/virtbase.exp
gdb/testsuite/gdb.cp/virtfunc2.exp

index 1a10f373b60fa70bf74aa2321dfac3e27e6266ca..01b9efd3c02baa9930f112563c3c803a9bcc977c 100644 (file)
@@ -1,3 +1,8 @@
+2012-03-15  Tom Tromey  <tromey@redhat.com>
+
+       * cp-valprint.c (cp_print_value_fields): Use
+       print_function_pointer_address for vtable slot.
+
 2012-03-15  Tom Tromey  <tromey@redhat.com>
 
        * gnu-v3-abi.c (struct value_and_voffset): New.
index 169700660f096e540ce99c7698d70b4cab6a314c..cb85b0b18bc52fc9a475c78b8f0a8fdd509b1b56 100644 (file)
@@ -358,6 +358,17 @@ cp_print_value_fields (struct type *type, struct type *real_type,
                                           v, stream, recurse + 1,
                                           options);
                }
+             else if (i == TYPE_VPTR_FIELDNO (type))
+               {
+                 CORE_ADDR addr
+                   = extract_typed_address (valaddr + offset
+                                            + TYPE_FIELD_BITSIZE (type, i) / 8,
+                                            TYPE_FIELD_TYPE (type, i));
+
+                 print_function_pointer_address (get_type_arch (type),
+                                                 addr, stream,
+                                                 options->addressprint);
+               }
              else
                {
                  struct value_print_options opts = *options;
index 9aee852ced0352e13c952b5d2f97b400a5cf57fe..5829950ec0f7a09f614ccca6979698bb349c7c23 100644 (file)
@@ -1,3 +1,12 @@
+2012-03-15  Tom Tromey  <tromey@redhat.com>
+
+       * gdb.cp/virtfunc2.exp: Update expected output.
+       * gdb.cp/pr9631.exp: Update expected output.
+       * gdb.cp/member-ptr.exp: Update expected output.
+       * gdb.cp/inherit.exp (test_print_mvi_classes): Update expected
+       output.
+       * gdb.cp/casts.exp: Update expected output.
+
 2012-03-15  Tom Tromey  <tromey@redhat.com>
 
        * gdb.cp/virtfunc.exp (make_one_vtable_result): New proc.
index 84569ab58a1d6586700587fff395540318c9c8a5..7272a290dddb9b58dc09395eeb549e4a95c34b51 100644 (file)
@@ -137,7 +137,7 @@ gdb_test "print dynamic_cast<Alpha *> (&doublyderived)" \
     "dynamic_cast upcast to unique base"
 
 gdb_test "print dynamic_cast<Alpha &> (derived)" \
-    " = \\(Alpha \\&\\) @$nonzero_hex: {.* = $nonzero_hex}" \
+    " = \\(Alpha \\&\\) @$nonzero_hex: {.* = ${nonzero_hex}( <vtable for Derived.*>)?}" \
     "dynamic_cast simple upcast to reference"
 
 gdb_test "print dynamic_cast<Derived *> (ad)" \
index 74e758b830c1342dffbce4edc51429bae434c867..7e2e871e9e0abe1aa97d6ee81de1661e09bbcb5b 100644 (file)
@@ -670,7 +670,7 @@ proc test_print_mvi_classes { } {
            # gcc 2.95.3 -gstabs+
            pass $name
        }
-       -re "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_3_vB = $hex, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_3_vC = $hex, vc = 23, vx = 24\}, $re_vbptr_3_vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" {
+       -re "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_3_vB = ${hex}( <vtable for vD.*>)?, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_3_vC = ${hex}( <vtable for vC.*>)?, vc = 23, vx = 24\}, $re_vbptr_3_vD = ${hex}( <vtable for vD.*>)?, vd = 25, vx = 26\}$nl$gdb_prompt $" {
            # gcc 3.3.2 -gdwarf-2
            # gcc HEAD 2004-01-21 -gdwarf-2
            # gcc HEAD 2004-01-21 -gstabs+
@@ -691,7 +691,7 @@ proc test_print_mvi_classes { } {
            # gcc 2.95.3 -gstabs+
            pass $name
        }
-       -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_vB = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = $hex, vc = 0, vx = 0\}, $re_vbptr_3_vD = $hex, vd = 0, vx = 0\}, $re_vbptr_3_vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" {
+       -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_vB = ${hex}( <vtable for vE.*>)?, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = ${hex}( <vtable for vE.*>)?, vc = 0, vx = 0\}, $re_vbptr_3_vD = ${hex}( <vtable for vE.*>)?, vd = 0, vx = 0\}, $re_vbptr_3_vE = ${hex}( <vtable for vE.*>)?, ve = 27, vx = 28\}$nl$gdb_prompt $" {
            # gcc 3.3.4 -gdwarf-2
            # gcc 3.3.4 -gstabs+
            # gcc 3.4.1 -gdwarf-2
index 7eb237d75558ddfde3c976f4422616a105f4653f..d4a9b13ae2ded6ea0ce3aaceaed0ecc1b58ba268 100644 (file)
@@ -257,7 +257,7 @@ gdb_test_multiple "print a" $name {
     -re "$vhn = \{c = 120 'x', j = 33, jj = 1331, (static|static int) s = 10, Virtual table at $hex\}\r\n$gdb_prompt $" {
        pass $name
     }
-    -re "$vhn = \{(_vptr.A|_vptr\\$) = $hex, c = 120 'x', j = 33, jj = 1331, (static|static int) s = 10\}\r\n$gdb_prompt $" {
+    -re "$vhn = \{(_vptr.A|_vptr\\$) = ${hex}( <vtable for A.*>)?, c = 120 'x', j = 33, jj = 1331, (static|static int) s = 10\}\r\n$gdb_prompt $" {
        pass $name
     }
     -re "$vhn = \{(_vptr.A|_vptr\\$) = $hex, c = 120 'x', j = 121, jj = 1331, (static|static int) s = 10\}\r\n$gdb_prompt $" {
@@ -305,7 +305,7 @@ gdb_test_multiple "print a" $name {
     -re "$vhn = \{c = 120 'x', j = 44, jj = 1331, (static|static int) s = 10, Virtual table at $hex\}\r\n$gdb_prompt $" {
        pass $name
     }
-    -re "$vhn = \{(_vptr.A|_vptr\\$) = $hex, c = 120 'x', j = 44, jj = 1331, (static|static int) s = 10\}\r\n$gdb_prompt $" {
+    -re "$vhn = \{(_vptr.A|_vptr\\$) = ${hex}( <vtable for A.*>), c = 120 'x', j = 44, jj = 1331, (static|static int) s = 10\}\r\n$gdb_prompt $" {
        pass $name
     }
     -re "$vhn = \{(_vptr.A|_vptr\\$) = $hex, c = 120 'x', j = 121, jj = 1331, (static|static int) s = 10\}\r\n$gdb_prompt $" {
index 7da31831922eadf572d69e4c188a1eea226e0e20..ececc98581652bb119416d922cbe9e03e4a07b87 100644 (file)
@@ -45,4 +45,4 @@ gdb_continue_to_breakpoint "after bar tender is initialized"
 
 gdb_test \
   "print tender" \
-  "\\\$1 = {<foo::vbase> = {_vptr.vbase = $hex}, <empty_base> = {<No data fields>}, <No data fields>}"
+  "\\\$1 = {<foo::vbase> = {_vptr.vbase = ${hex}( <vtable for bar.*>)?}, <empty_base> = {<No data fields>}, <No data fields>}"
index 191cf9030da5f3be207014d612fd723cdf724bb8..6bc0076bad5d04d58beb4e289837e5cae197193b 100644 (file)
@@ -78,5 +78,5 @@ gdb_test "print $" \
     " = \\(Virtual \\*\\) $hex" \
     "print same pointer from history value"
 gdb_test "print *$$" \
-    " = \\(Virtual\\) {<VirtualMiddleA> = {<VirtualBase> = {_vptr.VirtualBase = $hex, x = 0}, _vptr.VirtualMiddleA = $hex, y = \\{0 <repeats 300 times>\\}}, <VirtualMiddleB> = {_vptr.VirtualMiddleB = $hex, y = 0}, _vptr.Virtual = $hex, z = 0}" \
+    " = \\(Virtual\\) {<VirtualMiddleA> = {<VirtualBase> = {_vptr.VirtualBase = ${hex}( <vtable for Virtual.*>)?, x = 0}, _vptr.VirtualMiddleA = ${hex}( <vtable for Virtual.*>)?, y = \\{0 <repeats 300 times>\\}}, <VirtualMiddleB> = {_vptr.VirtualMiddleB = ${hex}( <vtable for Virtual.*>)?, y = 0}, _vptr.Virtual = ${hex}( <vtable for Virtual.*>)?, z = 0}" \
     "print whole pointed-to object, starting from the virtual base pointer"
index 0039692a4d697f3aeef5eea8dcc7afd4026417ec..d3fb8c5e301debb89a15706d71e181ec7502027c 100644 (file)
@@ -53,6 +53,7 @@ gdb_test "print o2.do_print()"  "\\$\[0-9\]+ = 123456"
 gdb_test "print o2.do_print2()"  "\\$\[0-9\]+ = 654321"
 gdb_test "print o2.do_print3()"  "\\$\[0-9\]+ = 111111"
 
+gdb_test "print o" " = {<interface> = {.*_vptr.interface = $hex <vtable for Obj.*>}, <No data fields>}"
 
 gdb_exit
 return 0