binutils-gdb/gdb/testsuite/gdb.ada/complete.exp
Pedro Alves 7a82e90312 Add skip_ada_tests to more Ada testcases
This adds missing skip_ada_tests checks to Ada testcases, using the
exact same pattern the existing files that do check it use.

gdb/testsuite/ChangeLog:

	* gdb.ada/access_tagged_param.exp: Check skip_ada_tests.
	* gdb.ada/access_to_packed_array.exp: Likewise.
	* gdb.ada/access_to_unbounded_array.exp: Likewise.
	* gdb.ada/addr_arith.exp: Likewise.
	* gdb.ada/arr_acc_idx_w_gap.exp: Likewise.
	* gdb.ada/arr_arr.exp: Likewise.
	* gdb.ada/arr_enum_idx_w_gap.exp: Likewise.
	* gdb.ada/array_bounds.exp: Likewise.
	* gdb.ada/array_of_variable_length.exp: Likewise.
	* gdb.ada/array_ptr_renaming.exp: Likewise.
	* gdb.ada/array_subscript_addr.exp: Likewise.
	* gdb.ada/arraydim.exp: Likewise.
	* gdb.ada/arrayparam.exp: Likewise.
	* gdb.ada/arrayptr.exp: Likewise.
	* gdb.ada/assign_1.exp: Likewise.
	* gdb.ada/assign_arr.exp: Likewise.
	* gdb.ada/atomic_enum.exp: Likewise.
	* gdb.ada/attr_ref_and_charlit.exp: Likewise.
	* gdb.ada/bad-task-bp-keyword.exp: Likewise.
	* gdb.ada/bias.exp: Likewise.
	* gdb.ada/boolean_expr.exp: Likewise.
	* gdb.ada/bp_c_mixed_case.exp: Likewise.
	* gdb.ada/bp_enum_homonym.exp: Likewise.
	* gdb.ada/bp_inlined_func.exp: Likewise.
	* gdb.ada/bp_on_var.exp: Likewise.
	* gdb.ada/bp_range_type.exp: Likewise.
	* gdb.ada/bp_reset.exp: Likewise.
	* gdb.ada/call_pn.exp: Likewise.
	* gdb.ada/catch_assert_if.exp: Likewise.
	* gdb.ada/catch_ex.exp: Likewise.
	* gdb.ada/catch_ex_std.exp: Likewise.
	* gdb.ada/char_enum.exp: Likewise.
	* gdb.ada/char_param.exp: Likewise.
	* gdb.ada/complete.exp: Likewise.
	* gdb.ada/cond_lang.exp: Likewise.
	* gdb.ada/convvar_comp.exp: Likewise.
	* gdb.ada/dgopt.exp: Likewise.
	* gdb.ada/disc_arr_bound.exp: Likewise.
	* gdb.ada/display_nested.exp: Likewise.
	* gdb.ada/dot_all.exp: Likewise.
	* gdb.ada/dyn_loc.exp: Likewise.
	* gdb.ada/dyn_stride.exp: Likewise.
	* gdb.ada/excep_handle.exp: Likewise.
	* gdb.ada/expr_delims.exp: Likewise.
	* gdb.ada/expr_with_funcall.exp: Likewise.
	* gdb.ada/exprs.exp: Likewise.
	* gdb.ada/fin_fun_out.exp: Likewise.
	* gdb.ada/fixed_cmp.exp: Likewise.
	* gdb.ada/formatted_ref.exp: Likewise.
	* gdb.ada/frame_arg_lang.exp: Likewise.
	* gdb.ada/frame_args.exp: Likewise.
	* gdb.ada/fullname_bp.exp: Likewise.
	* gdb.ada/fun_addr.exp: Likewise.
	* gdb.ada/fun_in_declare.exp: Likewise.
	* gdb.ada/fun_overload_menu.exp: Likewise.
	* gdb.ada/fun_renaming.exp: Likewise.
	* gdb.ada/funcall_char.exp: Likewise.
	* gdb.ada/funcall_param.exp: Likewise.
	* gdb.ada/funcall_ptr.exp: Likewise.
	* gdb.ada/funcall_ref.exp: Likewise.
	* gdb.ada/homonym.exp: Likewise.
	* gdb.ada/info_addr_mixed_case.exp: Likewise.
	* gdb.ada/info_auto_lang.exp: Likewise.
	* gdb.ada/info_exc.exp: Likewise.
	* gdb.ada/info_types.exp: Likewise.
	* gdb.ada/int_deref.exp: Likewise.
	* gdb.ada/interface.exp: Likewise.
	* gdb.ada/iwide.exp: Likewise.
	* gdb.ada/lang_switch.exp: Likewise.
	* gdb.ada/length_cond.exp: Likewise.
	* gdb.ada/maint_with_ada.exp: Likewise.
	* gdb.ada/mi_catch_assert.exp: Likewise.
	* gdb.ada/mi_catch_ex.exp: Likewise.
	* gdb.ada/mi_catch_ex_hand.exp: Likewise.
	* gdb.ada/mi_dyn_arr.exp: Likewise.
	* gdb.ada/mi_ex_cond.exp: Likewise.
	* gdb.ada/mi_exc_info.exp: Likewise.
	* gdb.ada/mi_interface.exp: Likewise.
	* gdb.ada/mi_prot.exp: Likewise.
	* gdb.ada/mi_ref_changeable.exp: Likewise.
	* gdb.ada/mi_string_access.exp: Likewise.
	* gdb.ada/mi_task_arg.exp: Likewise.
	* gdb.ada/mi_task_info.exp: Likewise.
	* gdb.ada/mi_var_array.exp: Likewise.
	* gdb.ada/mi_var_union.exp: Likewise.
	* gdb.ada/mi_variant.exp: Likewise.
	* gdb.ada/minsyms.exp: Likewise.
	* gdb.ada/mod_from_name.exp: Likewise.
	* gdb.ada/nested.exp: Likewise.
	* gdb.ada/null_array.exp: Likewise.
	* gdb.ada/optim_drec.exp: Likewise.
	* gdb.ada/out_of_line_in_inlined.exp: Likewise.
	* gdb.ada/packed_array_assign.exp: Likewise.
	* gdb.ada/packed_tagged.exp: Likewise.
	* gdb.ada/pp-rec-component.exp: Likewise.
	* gdb.ada/print_chars.exp: Likewise.
	* gdb.ada/print_pc.exp: Likewise.
	* gdb.ada/ptr_typedef.exp: Likewise.
	* gdb.ada/ptype_arith_binop.exp: Likewise.
	* gdb.ada/ptype_array.exp: Likewise.
	* gdb.ada/ptype_field.exp: Likewise.
	* gdb.ada/ptype_tagged_param.exp: Likewise.
	* gdb.ada/ptype_union.exp: Likewise.
	* gdb.ada/py_range.exp: Likewise.
	* gdb.ada/py_taft.exp: Likewise.
	* gdb.ada/rdv_wait.exp: Likewise.
	* gdb.ada/rec_comp.exp: Likewise.
	* gdb.ada/rec_return.exp: Likewise.
	* gdb.ada/ref_param.exp: Likewise.
	* gdb.ada/ref_tick_size.exp: Likewise.
	* gdb.ada/rename_subscript_param.exp: Likewise.
	* gdb.ada/repeat_dyn.exp: Likewise.
	* gdb.ada/same_component_name.exp: Likewise.
	* gdb.ada/same_enum.exp: Likewise.
	* gdb.ada/scalar_storage.exp: Likewise.
	* gdb.ada/set_wstr.exp: Likewise.
	* gdb.ada/small_reg_param.exp: Likewise.
	* gdb.ada/str_binop_equal.exp: Likewise.
	* gdb.ada/str_ref_cmp.exp: Likewise.
	* gdb.ada/str_uninit.exp: Likewise.
	* gdb.ada/sub_variant.exp: Likewise.
	* gdb.ada/sym_print_name.exp: Likewise.
	* gdb.ada/taft_type.exp: Likewise.
	* gdb.ada/tagged.exp: Likewise.
	* gdb.ada/tagged_access.exp: Likewise.
	* gdb.ada/task_bp.exp: Likewise.
	* gdb.ada/task_switch_in_core.exp: Likewise.
	* gdb.ada/tasks.exp: Likewise.
	* gdb.ada/tick_last_segv.exp: Likewise.
	* gdb.ada/tick_length_array_enum_idx.exp: Likewise.
	* gdb.ada/type_coercion.exp: Likewise.
	* gdb.ada/unc_arr_ptr_in_var_rec.exp: Likewise.
	* gdb.ada/unchecked_union.exp: Likewise.
	* gdb.ada/uninitialized_vars.exp: Likewise.
	* gdb.ada/var_arr_attrs.exp: Likewise.
	* gdb.ada/var_arr_typedef.exp: Likewise.
	* gdb.ada/var_rec_arr.exp: Likewise.
	* gdb.ada/variant-record.exp: Likewise.
	* gdb.ada/variant.exp: Likewise.
	* gdb.ada/variant_record_packed_array.exp: Likewise.
	* gdb.ada/varsize_limit.exp: Likewise.
	* gdb.ada/whatis_array_val.exp: Likewise.
	* gdb.ada/widewide.exp: Likewise.
	* gdb.ada/win_fu_syms.exp: Likewise.
2020-08-13 17:34:21 +01:00

236 lines
8.1 KiB
Plaintext

# Copyright 2005-2020 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 <http://www.gnu.org/licenses/>.
load_lib "ada.exp"
if { [skip_ada_tests] } { return -1 }
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
return -1
}
clean_restart ${testfile}
set bp_location [gdb_get_line_number "START" ${testdir}/foo.adb]
runto "foo.adb:$bp_location"
set eol "\[\r\n\]*"
# A convenience function that verifies that the "complete EXPR" command
# returns the EXPECTED_OUTPUT.
proc test_gdb_complete { expr expected_output {msg ""} } {
set cmd "complete p $expr"
if {$msg == ""} {
set msg $cmd
}
gdb_test "complete p $expr" \
"$expected_output" $msg
}
# A convenience function that verifies that the "complete EXPR" command
# does not generate any output.
proc test_gdb_no_completion { expr } {
gdb_test_no_output "complete p $expr"
}
# Try a global variable, only one match should be found:
test_gdb_complete "my_glob" \
"p my_global_variable"
# A global variable, inside a nested package:
test_gdb_complete "insi" \
"p inside_variable"
# A global variable inside a nested package, but only giving part of
# the fully qualified name (top level package name missing):
test_gdb_no_completion "inner.insi"
# An incomplete nested package name, were lies a single symbol:
test_gdb_complete "pck.inne" \
"p pck.inner.inside_variable" \
"complete nested package name"
# A fully qualified symbol name, mangled...
test_gdb_complete "pck__inner__ins" \
"p pck__inner__inside_variable"
# A fully qualified symbol name...
test_gdb_complete "pck.inner.ins" \
"p pck.inner.inside_variable"
# Make sure that "inside" is not returned as a possible completion
# for "side"...
test_gdb_no_completion "side"
# Verify that "Exported_Capitalized" is not returned as a match for
# "exported", since its symbol name contains capital letters.
test_gdb_no_completion "exported"
# check the "<...>" notation.
test_gdb_complete "<Exported" \
"p <Exported_Capitalized>"
# While at it, make sure we can print the symbol too, using the '<'
# notation.
gdb_test "p <Exported_Capitalized>" " = 2"
# Confirm that we can't print the symbol without the '<' notation.
gdb_test "p Exported_Capitalized" \
"No definition of \"exported_capitalized\" in current context."
gdb_test "p exported_capitalized" \
"No definition of \"exported_capitalized\" in current context."
# A global symbol, created by the binder, that starts with __gnat...
test_gdb_complete "__gnat_ada_main_progra" \
"p __gnat_ada_main_program_name"
# A global symbol, created by the binder, that starts with __gnat,
# and using the '<' notation.
test_gdb_complete "<__gnat_ada_main_prog" \
"p <__gnat_ada_main_program_name>"
# A local variable
test_gdb_complete "some" \
"p some_local_variable"
# A local variable variable, but in a different procedure. No match
# should be returned.
test_gdb_no_completion "not_in_sco"
# A fully qualified variable name that doesn't exist...
test_gdb_no_completion "pck.ins"
# A fully qualified variable name that does exist...
test_gdb_complete "pck.my" \
"p pck.my_global_variable"
# A fully qualified package name
test_gdb_complete "pck.inne" \
"p pck.inner.inside_variable" \
"complete fully qualified package name"
# A fully qualified package name, with a dot at the end
test_gdb_complete "pck.inner." \
"p pck.inner.inside_variable"
# Two matches, from the global scope:
test_gdb_complete "local_ident" \
[multi_line "p local_identical_one" \
"p local_identical_two" ]
# Two matches, from the global scope, but using fully qualified names:
test_gdb_complete "pck.local_ident" \
[multi_line "p pck.local_identical_one" \
"p pck.local_identical_two" ]
# Two matches, from the global scope, but using mangled fully qualified
# names:
test_gdb_complete "pck__local_ident" \
[multi_line "p pck__local_identical_one" \
"p pck__local_identical_two" ]
# Two matches, one from the global scope, the other from the local scope:
test_gdb_complete "external_ident" \
[multi_line "p external_identical_one" \
"p external_identical_two" ]
# Complete on the name of package.
test_gdb_complete "pck" \
[multi_line "(p pck\\.ad\[sb\])?" \
"(p pck\\.ad\[sb\])?" \
"p pck.ambiguous_func" \
"p pck.external_identical_one" \
"p pck.inner.inside_variable" \
"p pck.local_identical_one" \
"p pck.local_identical_two" \
"p pck.my_global_variable" \
"p pck.proc" ]
# Complete on the name of a package followed by a dot:
test_gdb_complete "pck." \
[multi_line "(p pck\\.ad\[sb\])?" \
"(p pck\\.ad\[sb\])?" \
"p pck.ambiguous_func" \
"p pck.external_identical_one" \
"p pck.inner.inside_variable" \
"p pck.local_identical_one" \
"p pck.local_identical_two" \
"p pck.my_global_variable" \
"p pck.proc" ]
# Complete a mangled symbol name, but using the '<...>' notation.
test_gdb_complete "<pck__my" \
"p <pck__my_global_variable>"
# Very simple completion, but using the interactive form, this time.
# The verification we are trying to make involves the event loop,
# and using the "complete" command is not sufficient to reproduce
# the original problem.
if { [readline_is_used] } {
set test "interactive complete 'print some'"
send_gdb "print some\t"
gdb_test_multiple "" "$test" {
-re "^print some_local_variable $" {
send_gdb "\n"
gdb_test_multiple "" "$test" {
-re " = 1$eol$gdb_prompt $" {
pass "$test"
}
}
}
}
}
# Usually, parsing a function name that is ambiguous yields a menu through
# which users can select a specific function. This should not happen during
# completion, though.
test_gdb_complete "ambig" \
[multi_line "p ambiguous_func" \
"p ambiguous_proc" ]
test_gdb_complete "ambiguous_f" \
"p ambiguous_func"
test_gdb_complete "ambiguous_func" \
"p ambiguous_func"
# Perform a test intented to verify the behavior where the number
# of possible completions is very large. The goal is not to verify
# precisely the list returned by the complete command (this depends
# on too many parameters -- targets, compiler version, runtime, etc).
# However, we want to sanity-check each one of them, knowing that
# each result should start with "break ada" and that the proposed
# completion should look like a valid symbol name (in particular,
# no uppercase letters...). See gdb/22670. File names are OK as
# well, which is why "/" and "-" appear in the regexp.
gdb_test_no_output "set max-completions unlimited"
set test "complete break ada"
gdb_test_multiple "$test" $test {
-re "^$test$eol\(break ada\[-a-z0-9._@/\]*$eol\)+$gdb_prompt $" {
pass $test
}
-re "\[A-Z\].*$gdb_prompt $" {
fail "$test (gdb/22670)"
}
}