From bd69fc683f383772bb8fab43c5d4af8d0cd4a8b4 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 12 Nov 2012 17:37:38 +0000 Subject: * c-typeprint.c (find_typedef_for_canonicalize, print_name_maybe_canonical): New functions. (c_print_type): Look up type name. (cp_type_print_derivation_info): Add flags argument. Use print_name_maybe_canonical. (cp_type_print_method_args): Add wrapping. (c_type_print_varspec_prefix): Use print_name_maybe_canonical. (c_type_print_template_args): New function. (c_type_print_base): Change wrapping. Use print_name_maybe_canonical. : Possibly create a typedef hash, and do type name lookups. * gdbtypes.c (types_equal): No longer static. * gdbtypes.h (types_equal): Declare. * typeprint.c (type_print_raw_options, default_ptype_flags): Update. (struct typedef_hash_table): New. (hash_typedef_field, eq_typedef_field, recursively_update_typedef_hash, add_template_parameters, create_typedef_hash, free_typedef_hash, do_free_typedef_hash, make_cleanup_free_typedef_hash, copy_typedef_hash_element, copy_typedef_hash, find_typedef_in_hash): New functions. * typeprint.h (struct type_print_options) : New field. (recursively_update_typedef_hash, add_template_parameters, create_typedef_hash, free_typedef_hash, make_cleanup_free_typedef_hash, copy_typedef_hash, find_typedef_in_hash): Declare. testsuite * gdb.base/call-sc.exp: Use "ptype/r". * gdb.base/volatile.exp: Don't expect "int". * gdb.cp/ptype-flags.cc: New file. * gdb.cp/ptype-flags.exp: New file. * gdb.cp/templates.exp: Use ptype/r. (test_ptype_of_templates, test_template_typedef): Likewise. * lib/cp-support.exp (cp_test_ptype_class): Add in_ptype_arg argument. Handle template names and template parameters. * gdb.mi/mi-var-cmd.exp: Accept "long". * gdb.mi/mi-var-child.exp: Accept "long". * gdb.mi/mi-var-display.exp: Accept "long". * gdb.mi/mi2-var-child.exp: Accept "long". --- gdb/testsuite/lib/cp-support.exp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'gdb/testsuite/lib') diff --git a/gdb/testsuite/lib/cp-support.exp b/gdb/testsuite/lib/cp-support.exp index 1414ffc..173fc08 100644 --- a/gdb/testsuite/lib/cp-support.exp +++ b/gdb/testsuite/lib/cp-support.exp @@ -100,6 +100,8 @@ proc cp_check_errata { expected_string actual_string errata_table } { # demangler syntax adjustment, so you have to make a bigger table # with lines for each output variation. # +# IN_PTYPE_ARG are arguments to pass to ptype. The default is "/r". +# # gdb can vary the output of ptype in several ways: # # . CLASS/STRUCT @@ -178,15 +180,16 @@ proc cp_check_errata { expected_string actual_string errata_table } { # # -- chastain 2004-08-07 -proc cp_test_ptype_class { in_exp in_testname in_key in_tag in_class_table { in_tail "" } { in_errata_table { } } } { +proc cp_test_ptype_class { in_exp in_testname in_key in_tag in_class_table { in_tail "" } { in_errata_table { } } { in_ptype_arg /r } } { global gdb_prompt set wsopt "\[\r\n\t \]*" - # The test name defaults to the command. + # The test name defaults to the command, but without the + # arguments, for historical reasons. if { "$in_testname" == "" } then { set in_testname "ptype $in_exp" } - set in_command "ptype $in_exp" + set in_command "ptype${in_ptype_arg} $in_exp" # Save class tables in a history array for reuse. @@ -232,13 +235,13 @@ proc cp_test_ptype_class { in_exp in_testname in_key in_tag in_class_table { in_ set parse_okay 0 gdb_test_multiple "$in_command" "$in_testname // parse failed" { - -re "type = (struct|class)${wsopt}(\[A-Za-z0-9_\]*)${wsopt}((:\[^\{\]*)?)${wsopt}\{(.*)\}${wsopt}(\[^\r\n\]*)\[\r\n\]+$gdb_prompt $" { + -re "type = (struct|class)${wsopt}(\[^ \t\]*)${wsopt}(\\\[with .*\\\]${wsopt})?((:\[^\{\]*)?)${wsopt}\{(.*)\}${wsopt}(\[^\r\n\]*)\[\r\n\]+$gdb_prompt $" { set parse_okay 1 set actual_key $expect_out(1,string) set actual_tag $expect_out(2,string) - set actual_base_string $expect_out(3,string) - set actual_body $expect_out(5,string) - set actual_tail $expect_out(6,string) + set actual_base_string $expect_out(4,string) + set actual_body $expect_out(6,string) + set actual_tail $expect_out(7,string) } } if { ! $parse_okay } then { return } -- cgit v1.1