From: Tom Tromey Date: Thu, 15 Mar 2012 15:49:42 +0000 (+0000) Subject: * cp-valprint.c (cp_print_value_fields): Use X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=410528f093e41d8d8ca5eae37d4bb57c98a3122b;p=binutils-gdb.git * cp-valprint.c (cp_print_value_fields): Use 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1a10f373b60..01b9efd3c02 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2012-03-15 Tom Tromey + + * cp-valprint.c (cp_print_value_fields): Use + print_function_pointer_address for vtable slot. + 2012-03-15 Tom Tromey * gnu-v3-abi.c (struct value_and_voffset): New. diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 169700660f0..cb85b0b18bc 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -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; diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 9aee852ced0..5829950ec0f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2012-03-15 Tom Tromey + + * 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 * gdb.cp/virtfunc.exp (make_one_vtable_result): New proc. diff --git a/gdb/testsuite/gdb.cp/casts.exp b/gdb/testsuite/gdb.cp/casts.exp index 84569ab58a1..7272a290ddd 100644 --- a/gdb/testsuite/gdb.cp/casts.exp +++ b/gdb/testsuite/gdb.cp/casts.exp @@ -137,7 +137,7 @@ gdb_test "print dynamic_cast (&doublyderived)" \ "dynamic_cast upcast to unique base" gdb_test "print dynamic_cast (derived)" \ - " = \\(Alpha \\&\\) @$nonzero_hex: {.* = $nonzero_hex}" \ + " = \\(Alpha \\&\\) @$nonzero_hex: {.* = ${nonzero_hex}( )?}" \ "dynamic_cast simple upcast to reference" gdb_test "print dynamic_cast (ad)" \ diff --git a/gdb/testsuite/gdb.cp/inherit.exp b/gdb/testsuite/gdb.cp/inherit.exp index 74e758b830c..7e2e871e9e0 100644 --- a/gdb/testsuite/gdb.cp/inherit.exp +++ b/gdb/testsuite/gdb.cp/inherit.exp @@ -670,7 +670,7 @@ proc test_print_mvi_classes { } { # gcc 2.95.3 -gstabs+ pass $name } - -re "$vhn = \{ = \{ = \{va = 19, vx = 20\}, $re_vbptr_3_vB = $hex, vb = 21, vx = 22\}, = \{$re_vbptr_3_vC = $hex, vc = 23, vx = 24\}, $re_vbptr_3_vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" { + -re "$vhn = \{ = \{ = \{va = 19, vx = 20\}, $re_vbptr_3_vB = ${hex}( )?, vb = 21, vx = 22\}, = \{$re_vbptr_3_vC = ${hex}( )?, vc = 23, vx = 24\}, $re_vbptr_3_vD = ${hex}( )?, 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 = \{ = \{ = \{ = \{va = 0, vx = 0\}, $re_vbptr_3_vB = $hex, vb = 0, vx = 0\}, = \{$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 = \{ = \{ = \{ = \{va = 0, vx = 0\}, $re_vbptr_3_vB = ${hex}( )?, vb = 0, vx = 0\}, = \{$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 $" { # gcc 3.3.4 -gdwarf-2 # gcc 3.3.4 -gstabs+ # gcc 3.4.1 -gdwarf-2 diff --git a/gdb/testsuite/gdb.cp/member-ptr.exp b/gdb/testsuite/gdb.cp/member-ptr.exp index 7eb237d7555..d4a9b13ae2d 100644 --- a/gdb/testsuite/gdb.cp/member-ptr.exp +++ b/gdb/testsuite/gdb.cp/member-ptr.exp @@ -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}( )?, 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}( ), 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 $" { diff --git a/gdb/testsuite/gdb.cp/pr9631.exp b/gdb/testsuite/gdb.cp/pr9631.exp index 7da31831922..ececc985816 100644 --- a/gdb/testsuite/gdb.cp/pr9631.exp +++ b/gdb/testsuite/gdb.cp/pr9631.exp @@ -45,4 +45,4 @@ gdb_continue_to_breakpoint "after bar tender is initialized" gdb_test \ "print tender" \ - "\\\$1 = { = {_vptr.vbase = $hex}, = {}, }" + "\\\$1 = { = {_vptr.vbase = ${hex}( )?}, = {}, }" diff --git a/gdb/testsuite/gdb.cp/virtbase.exp b/gdb/testsuite/gdb.cp/virtbase.exp index 191cf9030da..6bc0076bad5 100644 --- a/gdb/testsuite/gdb.cp/virtbase.exp +++ b/gdb/testsuite/gdb.cp/virtbase.exp @@ -78,5 +78,5 @@ gdb_test "print $" \ " = \\(Virtual \\*\\) $hex" \ "print same pointer from history value" gdb_test "print *$$" \ - " = \\(Virtual\\) { = { = {_vptr.VirtualBase = $hex, x = 0}, _vptr.VirtualMiddleA = $hex, y = \\{0 \\}}, = {_vptr.VirtualMiddleB = $hex, y = 0}, _vptr.Virtual = $hex, z = 0}" \ + " = \\(Virtual\\) { = { = {_vptr.VirtualBase = ${hex}( )?, x = 0}, _vptr.VirtualMiddleA = ${hex}( )?, y = \\{0 \\}}, = {_vptr.VirtualMiddleB = ${hex}( )?, y = 0}, _vptr.Virtual = ${hex}( )?, z = 0}" \ "print whole pointed-to object, starting from the virtual base pointer" diff --git a/gdb/testsuite/gdb.cp/virtfunc2.exp b/gdb/testsuite/gdb.cp/virtfunc2.exp index 0039692a4d6..d3fb8c5e301 100644 --- a/gdb/testsuite/gdb.cp/virtfunc2.exp +++ b/gdb/testsuite/gdb.cp/virtfunc2.exp @@ -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" " = { = {.*_vptr.interface = $hex }, }" gdb_exit return 0