From 4186eb54dd4d57b59d58f470ec0fa9b19b9c9d5e Mon Sep 17 00:00:00 2001 From: Keith Seitz Date: Sat, 7 Jun 2014 10:40:39 -0700 Subject: [PATCH] Revert patchset for c++/16253: it causes a large performance regression. See the bug for further information. --- gdb/ChangeLog | 37 ++++++ gdb/ada-lang.c | 65 +++-------- gdb/cp-namespace.c | 39 ++----- gdb/cp-support.c | 25 +---- gdb/psymtab.c | 15 ++- gdb/symtab.c | 60 +++++----- gdb/symtab.h | 4 + gdb/testsuite/ChangeLog | 11 ++ gdb/testsuite/gdb.cp/var-tag.cc | 44 -------- gdb/testsuite/gdb.cp/var-tag.exp | 105 ------------------ gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.exp | 4 - gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.exp | 2 - .../gdb.dwarf2/dw2-double-set-die-type.exp | 1 - gdb/testsuite/gdb.dwarf2/dw2-inheritance.exp | 1 - 14 files changed, 114 insertions(+), 299 deletions(-) delete mode 100644 gdb/testsuite/gdb.cp/var-tag.cc delete mode 100644 gdb/testsuite/gdb.cp/var-tag.exp diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e6d9040d0eb..dc638635522 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,40 @@ +2014-06-07 Keith Seitz + + Revert: + PR c++/16253 + * ada-lang.c (ada_symbol_matches_domain): Moved here and renamed + from symbol_matches_domain in symtab.c. All local callers + of symbol_matches_domain updated. + (standard_lookup): If DOMAIN is VAR_DOMAIN and no symbol is found, + search STRUCT_DOMAIN. + (ada_find_any_type_symbol): Do not search STRUCT_DOMAIN + independently. standard_lookup will do that automatically. + * cp-namespace.c (cp_lookup_symbol_nonlocal): Explain when/why + VAR_DOMAIN searches may return a STRUCT_DOMAIN match. + (cp_lookup_symbol_in_namespace): Likewise. + If no VAR_DOMAIN symbol is found, search STRUCT_DOMAIN. + (cp_lookup_symbol_exports): Explain when/why VAR_DOMAIN searches + may return a STRUCT_DOMAIN match. + (lookup_symbol_file): Search for the class name in STRUCT_DOMAIN. + * cp-support.c: Include language.h. + (inspect_type): Explicitly search STRUCT_DOMAIN before searching + VAR_DOMAIN. + * psymtab.c (match_partial_symbol): Compare the requested + domain with the symbol's domain directly. + (lookup_partial_symbol): Likewise. + * symtab.c (lookup_symbol_in_language): Explain when/why + VAR_DOMAIN searches may return a STRUCT_DOMAIN match. + If no VAR_DOMAIN symbol is found, search STRUCT_DOMAIN for + appropriate languages. + (symbol_matches_domain): Renamed `ada_symbol_matches_domain' + and moved to ada-lang.c + (lookup_block_symbol): Explain that this function only returns + symbol matching the requested DOMAIN. + Compare the requested domain with the symbol's domain directly. + (iterate_over_symbols): Compare the requested domain with the + symbol's domain directly. + * symtab.h (symbol_matches_domain): Remove. + 2014-06-06 Doug Evans * guile/guile-internal.h (gdbscm_guile_major_version): Declare. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index c12fbb8b687..d7c7e2406a6 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -4393,20 +4393,6 @@ ada_clear_symbol_cache (void) ada_init_symbol_cache (sym_cache); } -/* STRUCT_DOMAIN symbols are also typedefs for the type. This function tests - the equivalency of two Ada symbol domain types. */ - -static int -ada_symbol_matches_domain (domain_enum symbol_domain, domain_enum domain) -{ - if (symbol_domain == domain - || ((domain == VAR_DOMAIN || domain == STRUCT_DOMAIN) - && symbol_domain == STRUCT_DOMAIN)) - return 1; - - return 0; -} - /* Search our cache for an entry matching NAME and NAMESPACE. Return it if found, or NULL otherwise. */ @@ -4508,13 +4494,6 @@ standard_lookup (const char *name, const struct block *block, if (lookup_cached_symbol (name, domain, &sym, NULL)) return sym; sym = lookup_symbol_in_language (name, block, domain, language_c, 0); - - /* STRUCT_DOMAIN symbols also define a typedef for the type. Lookup - a STRUCT_DOMAIN symbol if one is requested for VAR_DOMAIN and not - found. */ - if (sym == NULL && domain == VAR_DOMAIN) - sym = lookup_symbol_in_language (name, block, STRUCT_DOMAIN, language_c, 0); - cache_symbol (name, domain, sym, block_found); return sym; } @@ -5340,29 +5319,13 @@ add_nonlocal_symbols (struct obstack *obstackp, const char *name, data.objfile = objfile; if (is_wild_match) - { - objfile->sf->qf->map_matching_symbols (objfile, name, domain, global, - aux_add_nonlocal_symbols, - &data, wild_match, NULL); - if (domain == VAR_DOMAIN) - objfile->sf->qf->map_matching_symbols (objfile, name, - STRUCT_DOMAIN, global, - aux_add_nonlocal_symbols, - &data, wild_match, NULL); - } + objfile->sf->qf->map_matching_symbols (objfile, name, domain, global, + aux_add_nonlocal_symbols, &data, + wild_match, NULL); else - { - objfile->sf->qf->map_matching_symbols (objfile, name, domain, global, - aux_add_nonlocal_symbols, - &data, full_match, - compare_names); - if (domain == VAR_DOMAIN) - objfile->sf->qf->map_matching_symbols (objfile, name, - STRUCT_DOMAIN, global, - aux_add_nonlocal_symbols, - &data, full_match, - compare_names); - } + objfile->sf->qf->map_matching_symbols (objfile, name, domain, global, + aux_add_nonlocal_symbols, &data, + full_match, compare_names); } if (num_defns_collected (obstackp) == 0 && global && !is_wild_match) @@ -5886,7 +5849,8 @@ ada_add_block_symbols (struct obstack *obstackp, for (sym = block_iter_match_first (block, name, wild_match, &iter); sym != NULL; sym = block_iter_match_next (name, wild_match, &iter)) { - if (ada_symbol_matches_domain (SYMBOL_DOMAIN (sym), domain) + if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), + SYMBOL_DOMAIN (sym), domain) && wild_match (SYMBOL_LINKAGE_NAME (sym), name) == 0) { if (SYMBOL_CLASS (sym) == LOC_UNRESOLVED) @@ -5908,7 +5872,8 @@ ada_add_block_symbols (struct obstack *obstackp, for (sym = block_iter_match_first (block, name, full_match, &iter); sym != NULL; sym = block_iter_match_next (name, full_match, &iter)) { - if (ada_symbol_matches_domain (SYMBOL_DOMAIN (sym), domain)) + if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), + SYMBOL_DOMAIN (sym), domain)) { if (SYMBOL_CLASS (sym) != LOC_UNRESOLVED) { @@ -5940,7 +5905,8 @@ ada_add_block_symbols (struct obstack *obstackp, ALL_BLOCK_SYMBOLS (block, iter, sym) { - if (ada_symbol_matches_domain (SYMBOL_DOMAIN (sym), domain)) + if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), + SYMBOL_DOMAIN (sym), domain)) { int cmp; @@ -7528,12 +7494,11 @@ ada_find_any_type_symbol (const char *name) struct symbol *sym; sym = standard_lookup (name, get_selected_block (NULL), VAR_DOMAIN); - if (sym != NULL - && (SYMBOL_DOMAIN (sym) != VAR_DOMAIN - || SYMBOL_CLASS (sym) == LOC_TYPEDEF)) + if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF) return sym; - return NULL; + sym = standard_lookup (name, NULL, STRUCT_DOMAIN); + return sym; } /* Find a type named NAME. Ignores ambiguity. This routine will look diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index ae7c8527df5..cd573992291 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -221,12 +221,7 @@ cp_is_anonymous (const char *namespace) we're looking for, BLOCK is the block that we're searching within, DOMAIN says what kind of symbols we're looking for, and if SYMTAB is non-NULL, we should store the symtab where we found the symbol - in it. - - Class, union, and enum tag names may be used in C++ without specifying - class-key or enum. If searching for a VAR_DOMAIN symbol fails, - this function will search STRUCT_DOMAIN. [This is actually done in - cp_lookup_symbol_in_namespace.] */ + in it. */ struct symbol * cp_lookup_symbol_nonlocal (const char *name, @@ -247,10 +242,7 @@ cp_lookup_symbol_nonlocal (const char *name, /* Look up NAME in the C++ namespace NAMESPACE. Other arguments are as in cp_lookup_symbol_nonlocal. If SEARCH is non-zero, search - through base classes for a matching symbol. - - If DOMAIN is VAR_DOMAIN and no matching symbol exists in that domain, - this function will search STRUCT_DOMAIN for a match. */ + through base classes for a matching symbol. */ static struct symbol * cp_lookup_symbol_in_namespace (const char *namespace, @@ -260,30 +252,18 @@ cp_lookup_symbol_in_namespace (const char *namespace, { if (namespace[0] == '\0') { - struct symbol *sym = lookup_symbol_file (name, block, domain, 0, search); - - if (sym == NULL && domain == VAR_DOMAIN) - sym = lookup_symbol_file (name, block, STRUCT_DOMAIN, 0, search); - - return sym; + return lookup_symbol_file (name, block, domain, 0, search); } else { - struct symbol *sym; char *concatenated_name = alloca (strlen (namespace) + 2 + strlen (name) + 1); strcpy (concatenated_name, namespace); strcat (concatenated_name, "::"); strcat (concatenated_name, name); - sym = lookup_symbol_file (concatenated_name, block, domain, - cp_is_anonymous (namespace), search); - - if (sym == NULL && domain == VAR_DOMAIN) - sym = lookup_symbol_file (concatenated_name, block, STRUCT_DOMAIN, - cp_is_anonymous (namespace), search); - - return sym; + return lookup_symbol_file (concatenated_name, block, domain, + cp_is_anonymous (namespace), search); } } @@ -536,12 +516,7 @@ cp_lookup_symbol_imports_or_template (const char *scope, /* Searches for NAME in the current namespace, and by applying relevant import statements belonging to BLOCK and its parents. SCOPE is the namespace scope of the context in which the search is - being evaluated. - - Class, union, and enum tag names may be used in C++ without specifying - class-key or enum. If searching for a VAR_DOMAIN symbol fails, - this function will search STRUCT_DOMAIN. [This is done in - cp_lookup_symbol_in_namespace.] */ + being evaluated. */ struct symbol* cp_lookup_symbol_namespace (const char *scope, @@ -718,7 +693,7 @@ lookup_symbol_file (const char *name, /* Lookup a class named KLASS. If none is found, there is nothing more that can be done. */ - klass_sym = lookup_symbol_global (klass, block, STRUCT_DOMAIN); + klass_sym = lookup_symbol_global (klass, block, domain); if (klass_sym == NULL) { do_cleanups (cleanup); diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 91533e8e4ec..2379b54c2b0 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -35,7 +35,6 @@ #include "expression.h" #include "value.h" #include "cp-abi.h" -#include "language.h" #include "safe-ctype.h" @@ -178,29 +177,7 @@ inspect_type (struct demangle_parse_info *info, sym = NULL; TRY_CATCH (except, RETURN_MASK_ALL) { - /* It is not legal to have a typedef and tag name of the same - name in C++. However, anonymous composite types that are defined - with a typedef ["typedef struct {...} anonymous_struct;"] WILL - have symbols for a TYPE_CODE_TYPEDEF (in VAR_DOMAIN) and a - TYPE_CODE_STRUCT (in STRUCT_DOMAIN). - - If VAR_DOMAIN is searched first, it will return the TYPEDEF symbol, - and this function will never output the definition of the typedef, - since type_print is called below with SHOW = -1. [The typedef hash - is never initialized/used when SHOW <= 0 -- and the finder - (find_typedef_for_canonicalize) will always return NULL as a result.] - - Consequently, type_print will eventually keep calling this function - to replace the typedef (via - print_name_maybe_canonical/cp_canonicalize_full). This leads to - infinite recursion. - - This can all be safely avoid by explicitly searching STRUCT_DOMAIN - first to find the structure definition. */ - if (current_language->la_language == language_cplus) - sym = lookup_symbol (name, 0, STRUCT_DOMAIN, 0); - if (sym == NULL) - sym = lookup_symbol (name, 0, VAR_DOMAIN, NULL); + sym = lookup_symbol (name, 0, VAR_DOMAIN, 0); } if (except.reason >= 0 && sym != NULL) diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 8f2de2ae729..2787f4cf8d3 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -594,7 +594,8 @@ match_partial_symbol (struct objfile *objfile, while (top <= real_top && match (SYMBOL_SEARCH_NAME (*top), name) == 0) { - if (SYMBOL_DOMAIN (*top) == domain) + if (symbol_matches_domain (SYMBOL_LANGUAGE (*top), + SYMBOL_DOMAIN (*top), domain)) return *top; top++; } @@ -607,7 +608,8 @@ match_partial_symbol (struct objfile *objfile, { for (psym = start; psym < start + length; psym++) { - if (SYMBOL_DOMAIN (*psym) == domain + if (symbol_matches_domain (SYMBOL_LANGUAGE (*psym), + SYMBOL_DOMAIN (*psym), domain) && match (SYMBOL_SEARCH_NAME (*psym), name) == 0) return *psym; } @@ -723,7 +725,8 @@ lookup_partial_symbol (struct objfile *objfile, while (top <= real_top && SYMBOL_MATCHES_SEARCH_NAME (*top, search_name)) { - if (SYMBOL_DOMAIN (*top) == domain) + if (symbol_matches_domain (SYMBOL_LANGUAGE (*top), + SYMBOL_DOMAIN (*top), domain)) { do_cleanups (cleanup); return (*top); @@ -739,7 +742,8 @@ lookup_partial_symbol (struct objfile *objfile, { for (psym = start; psym < start + length; psym++) { - if (SYMBOL_DOMAIN (*psym) == domain + if (symbol_matches_domain (SYMBOL_LANGUAGE (*psym), + SYMBOL_DOMAIN (*psym), domain) && SYMBOL_MATCHES_SEARCH_NAME (*psym, search_name)) { do_cleanups (cleanup); @@ -1219,7 +1223,8 @@ map_block (const char *name, domain_enum namespace, struct objfile *objfile, for (sym = block_iter_match_first (block, name, match, &iter); sym != NULL; sym = block_iter_match_next (name, match, &iter)) { - if (SYMBOL_DOMAIN (sym) == namespace) + if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), + SYMBOL_DOMAIN (sym), namespace)) { if (callback (block, sym, data)) return 1; diff --git a/gdb/symtab.c b/gdb/symtab.c index 15ac3d1dcea..66d16247ee2 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1310,11 +1310,7 @@ demangle_for_lookup (const char *name, enum language lang, NAME is a field of the current implied argument `this'. If so set *IS_A_FIELD_OF_THIS to 1, otherwise set it to zero. BLOCK_FOUND is set to the block in which NAME is found (in the case of - a field of `this', value_of_this sets BLOCK_FOUND to the proper value.) - - If DOMAIN is VAR_DOMAIN and the language permits using tag names for - elaborated types, such as classes in C++, this function will search - STRUCT_DOMAIN if no matching is found. */ + a field of `this', value_of_this sets BLOCK_FOUND to the proper value.) */ /* This function (or rather its subordinates) have a bunch of loops and it would seem to be attractive to put in some QUIT's (though I'm not really @@ -1337,23 +1333,6 @@ lookup_symbol_in_language (const char *name, const struct block *block, returnval = lookup_symbol_aux (modified_name, block, domain, lang, is_a_field_of_this); - if (returnval == NULL) - { - if (is_a_field_of_this != NULL - && is_a_field_of_this->type != NULL) - return NULL; - - /* Some languages define typedefs of a type equal to its tag name, - e.g., in C++, "struct foo { ... }" also defines a typedef for - "foo". */ - if (domain == VAR_DOMAIN - && (lang == language_cplus || lang == language_java - || lang == language_ada || lang == language_d)) - { - returnval = lookup_symbol_aux (modified_name, block, STRUCT_DOMAIN, - lang, is_a_field_of_this); - } - } do_cleanups (cleanup); return returnval; @@ -1928,6 +1907,27 @@ lookup_symbol_global (const char *name, return lookup_data.result; } +int +symbol_matches_domain (enum language symbol_language, + domain_enum symbol_domain, + domain_enum domain) +{ + /* For C++ "struct foo { ... }" also defines a typedef for "foo". + A Java class declaration also defines a typedef for the class. + Similarly, any Ada type declaration implicitly defines a typedef. */ + if (symbol_language == language_cplus + || symbol_language == language_d + || symbol_language == language_java + || symbol_language == language_ada) + { + if ((domain == VAR_DOMAIN || domain == STRUCT_DOMAIN) + && symbol_domain == STRUCT_DOMAIN) + return 1; + } + /* For all other languages, strict match is required. */ + return (symbol_domain == domain); +} + /* Look up a type named NAME in the struct_domain. The type returned must not be opaque -- i.e., must have at least one field defined. */ @@ -2050,12 +2050,7 @@ basic_lookup_transparent_type (const char *name) binary search terminates, we drop through and do a straight linear search on the symbols. Each symbol which is marked as being a ObjC/C++ symbol (language_cplus or language_objc set) has both the encoded and - non-encoded names tested for a match. - - This function specifically disallows domain mismatches. If a language - defines a typedef for an elaborated type, such as classes in C++, - then this function will need to be called twice, once to search - VAR_DOMAIN and once to search STRUCT_DOMAIN. */ + non-encoded names tested for a match. */ struct symbol * lookup_block_symbol (const struct block *block, const char *name, @@ -2070,7 +2065,8 @@ lookup_block_symbol (const struct block *block, const char *name, sym != NULL; sym = block_iter_name_next (name, &iter)) { - if (SYMBOL_DOMAIN (sym) == domain) + if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), + SYMBOL_DOMAIN (sym), domain)) return sym; } return NULL; @@ -2089,7 +2085,8 @@ lookup_block_symbol (const struct block *block, const char *name, sym != NULL; sym = block_iter_name_next (name, &iter)) { - if (SYMBOL_DOMAIN (sym) == domain) + if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), + SYMBOL_DOMAIN (sym), domain)) { sym_found = sym; if (!SYMBOL_IS_ARGUMENT (sym)) @@ -2123,7 +2120,8 @@ iterate_over_symbols (const struct block *block, const char *name, sym != NULL; sym = block_iter_name_next (name, &iter)) { - if (SYMBOL_DOMAIN (sym) == domain) + if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), + SYMBOL_DOMAIN (sym), domain)) { if (!callback (sym, data)) return; diff --git a/gdb/symtab.h b/gdb/symtab.h index efc3643b3ec..fbe58689c12 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1019,6 +1019,10 @@ extern const char multiple_symbols_cancel[]; const char *multiple_symbols_select_mode (void); +int symbol_matches_domain (enum language symbol_language, + domain_enum symbol_domain, + domain_enum domain); + /* lookup a symbol table by source file name. */ extern struct symtab *lookup_symtab (const char *); diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 9c8da4a203f..35ff0b2a470 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2014-06-07 Keith Seitz + + Revert: + PR c++/16253 + * gdb.cp/var-tag.cc: New file. + * gdb.cp/var-tag.exp: New file. + * gdb.dwarf2/dw2-ada-ffffffff.exp: Set the language to C++. + * gdb.dwarf2/dw2-anon-mptr.exp: Likewise. + * gdb.dwarf2/dw2-double-set-die-type.exp: Likewise. + * gdb.dwarf2/dw2-inheritance.exp: Likewise. + 2014-06-06 Doug Evans * gdb.guile/scm-frame-args.c (foo): Tweak to work with gcc 4.6.3. diff --git a/gdb/testsuite/gdb.cp/var-tag.cc b/gdb/testsuite/gdb.cp/var-tag.cc deleted file mode 100644 index 93b9cafa434..00000000000 --- a/gdb/testsuite/gdb.cp/var-tag.cc +++ /dev/null @@ -1,44 +0,0 @@ -/* This testcase is part of GDB, the GNU debugger. - - Copyright 2014 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -int global = 3; - -class C { -public: - struct C1 {} C1; - enum E1 {a1, b1, c1} E1; - union U1 {int a1; char b1;} U1; - - C () : E1 (b1) {} - void global (void) const {} - int f (void) const { global (); return 0; } -} C; - -struct S {} S; -enum E {a, b, c} E; -union U {int a; char b;} U; - -class CC {} cc; -struct SS {} ss; -enum EE {ea, eb, ec} ee; -union UU {int aa; char bb;} uu; - -int -main (void) -{ - return C.f (); -} diff --git a/gdb/testsuite/gdb.cp/var-tag.exp b/gdb/testsuite/gdb.cp/var-tag.exp deleted file mode 100644 index 9e4628282d8..00000000000 --- a/gdb/testsuite/gdb.cp/var-tag.exp +++ /dev/null @@ -1,105 +0,0 @@ -# Copyright 2014 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# This file is part of the gdb testsuite - -# Test expressions in which variable names shadow tag names. - -if {[skip_cplus_tests]} { continue } - -standard_testfile .cc - -if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { - return -1 -} - -proc do_global_tests {lang} { - if {$lang == "c++"} { - set opt_underlying "(: unsigned int )?" - } else { - set opt_underlying "" - } - - if {$lang == "c"} { - set invalid_print "No symbol \"%s\" in current context." - set ptypefmt $invalid_print - } else { - set invalid_print "Attempt to use a type name as an expression" - set ptypefmt "type = (class|enum|union|struct) %s $opt_underlying{.*}" - } - - with_test_prefix $lang { - gdb_test_no_output "set language $lang" - gdb_test "ptype C" "type = class C {.*}" - gdb_test "print E" "= a" - gdb_test "ptype E" "type = enum E $opt_underlying{.*}" - gdb_test "print S" "= {}" - gdb_test "ptype S" "type = struct S {.*}" - gdb_test "print U" "= {.*}" - gdb_test "ptype U" "type = union U {.*}" - gdb_test "print cc" "= {.*}" - gdb_test "ptype cc" "type = class CC {.*}" - gdb_test "print CC" [format $invalid_print "CC"] - gdb_test "ptype CC" [format $ptypefmt "CC"] - gdb_test "print ss" "= {}" - gdb_test "ptype ss" "type = struct SS {.*}" - gdb_test "print SS" [format $invalid_print "SS"] - gdb_test "ptype SS" [format $ptypefmt "SS"] - gdb_test "print ee" "= .*" - gdb_test "ptype ee" "type = enum EE $opt_underlying{.*}" - gdb_test "print EE" [format $invalid_print "EE"] - gdb_test "ptype EE" [format $ptypefmt "EE"] - gdb_test "print uu" "= {.*}" - gdb_test "ptype uu" "type = union UU {.*}" - gdb_test "print UU" [format $invalid_print "UU"] - gdb_test "ptype UU" [format $ptypefmt "UU"] - } -} - -# First test expressions when there is no context. -with_test_prefix "before start" { - do_global_tests c++ - do_global_tests c -} - -# Run to main and test again. -if {![runto_main]} { - perror "couldn't run to main" - continue -} - -with_test_prefix "in main" { - do_global_tests c++ - do_global_tests c -} - -# Finally run to C::f and test again -gdb_breakpoint "C::f" -gdb_continue_to_breakpoint "continue to C::f" -with_test_prefix "in C::f" { - do_global_tests c++ - do_global_tests c -} - -# Another hard-to-guess-the-users-intent bug... -# It would be really nice if we could query the user! -with_test_prefix "global collision" { - gdb_test_no_output "set language c++" - setup_kfail "c++/16463" "*-*-*" - gdb_test "print global" "= 3" - - # ... with a simple workaround: - gdb_test "print ::global" "= 3" -} diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.exp b/gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.exp index 7936f253c66..1c1d10f93a7 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.exp @@ -28,10 +28,6 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" clean_restart $executable -# Force the language to C++, since we want to treat the type -# defined in the object file like a C++ type, using sizeof. -gdb_test_no_output "set language c++" - # -1 was produced, it is now caught with the complaint: # Suspicious DW_AT_byte_size value treated as zero instead of ... gdb_test "p sizeof (t)" " = 0" diff --git a/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.exp b/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.exp index c9e59ed6624..aef3cb88c83 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-anon-mptr.exp @@ -40,7 +40,5 @@ gdb_test "show cp-abi" {The currently selected C\+\+ ABI is "gnu-v3".*} gdb_load $binfile -gdb_test_no_output "set language c++" - gdb_test "ptype crash" \ "type = class crash {\[\r\n \t\]*public:\[\r\n \t\]*crash\\(int \\(class {\\.\\.\\.}::\\*\\)\\(class {\\.\\.\\.} \\* const\\)\\);\[\r\n \t\]*}" diff --git a/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.exp b/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.exp index 40daed936ff..7aabcfe74e2 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.exp @@ -30,5 +30,4 @@ if { [gdb_compile [file join $srcdir $subdir $srcfile] $binfile \ } clean_restart $testfile -gdb_test_no_output "set language c++" gdb_test "ptype a" "type = class .*" diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inheritance.exp b/gdb/testsuite/gdb.dwarf2/dw2-inheritance.exp index 028a1df86b8..7c954bb128b 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-inheritance.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-inheritance.exp @@ -31,5 +31,4 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $binfile \ clean_restart $testfile -gdb_test_no_output "set language c++" gdb_test "ptype inherited" "type = class inherited .*" -- 2.30.2