diff options
author | Tom Tromey <tromey@redhat.com> | 2012-03-15 15:43:18 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-03-15 15:43:18 +0000 |
commit | c4aeac856a297bbcf96e565e5bad277bfcff3c1b (patch) | |
tree | 1ef0a5f09b31976672edd7838604cecb63e1d339 /gdb/testsuite/gdb.cp/virtfunc.exp | |
parent | 2479f722a449340bcd8465474090339c1e004e9e (diff) | |
download | ppe42-binutils-c4aeac856a297bbcf96e565e5bad277bfcff3c1b.tar.gz ppe42-binutils-c4aeac856a297bbcf96e565e5bad277bfcff3c1b.zip |
* gnu-v3-abi.c (struct value_and_voffset): New.
(hash_value_and_voffset, eq_value_and_voffset)
(compare_value_and_voffset, compute_vtable_size)
(print_one_vtable, gnuv3_print_vtable): New functions.
(init_gnuv3_ops): Initialize 'print_vtable' field.
* cp-support.c (info_vtbl_command): New function.
(_initialize_cp_support): Add "info vtbl".
* cp-abi.h (cplus_print_vtable): Declare.
(struct cp_abi_ops) <print_vtable>: New field.
* cp-abi.c (cplus_print_vtable): New function.
* NEWS: Update.
gdb/testsuite
* gdb.cp/virtfunc.exp (make_one_vtable_result): New proc.
(test_info_vtbl): Likewise.
(do_tests): Call test_info_vtbl.
* gdb.cp/virtfunc.cc (va): New global.
gdb/doc
* gdb.texinfo (Debugging C Plus Plus): Document "info vtbl".
Diffstat (limited to 'gdb/testsuite/gdb.cp/virtfunc.exp')
-rw-r--r-- | gdb/testsuite/gdb.cp/virtfunc.exp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/virtfunc.exp b/gdb/testsuite/gdb.cp/virtfunc.exp index dd41c6dd98..15a374ca1a 100644 --- a/gdb/testsuite/gdb.cp/virtfunc.exp +++ b/gdb/testsuite/gdb.cp/virtfunc.exp @@ -226,6 +226,54 @@ proc test_virtual_calls {} { } } +# A helper proc that creates a regular expression matching a +# particular vtable. NAME is the type name. Each element of ARGS is +# the name of a function in the vtable. + +proc make_one_vtable_result {name args} { + global hex + + set nls "\[\r\n\]+" + + set result "vtable for '${name}' @ $hex .subobject @ $hex.:$nls" + set count 0 + foreach func $args { + append result ".${count}.: $hex <$func..>${nls}" + incr count + } + + return $result +} + +# Test "info vtbl". + +proc test_info_vtbl {} { + global hex + + set nls "\[\r\n\]+" + + set vt_A [make_one_vtable_result A A::f] + set vt_B [make_one_vtable_result B B::f] + set vt_V [make_one_vtable_result V VB::vvb V::vv] + set vt_V2 [make_one_vtable_result V VB::vvb "virtual thunk to E::vv"] + set vt_D [make_one_vtable_result D D::vg D::vd] + set vt_D2 [make_one_vtable_result D "non-virtual thunk to E::vg" D::vd] + set vt_E [make_one_vtable_result E E::f E::vg E::vv] + + gdb_test "info vtbl a" "${vt_A}${vt_V}" + gdb_test "info vtbl b" "${vt_B}${vt_V}" + gdb_test "info vtbl c" "${vt_V}" + gdb_test "info vtbl d" "${vt_D}${vt_V}" + gdb_test "info vtbl e" "${vt_E}${vt_D2}${vt_V2}" + gdb_test "info vtbl pEe" "${vt_E}${vt_D2}${vt_V2}" + + gdb_test "info vtbl" "Argument required.*" + gdb_test "info vtbl va" \ + "This object does not have a virtual function table.*" + gdb_test "info vtbl all_count" \ + "This object does not have a virtual function table.*" +} + proc do_tests {} { global srcdir subdir binfile global gdb_prompt @@ -244,6 +292,7 @@ proc do_tests {} { return } test_ptype_of_classes + test_info_vtbl gdb_breakpoint test_calls gdb_test "continue" ".*Breakpoint .* test_calls.*" "" |