2015-01-01 09:32:14 +00:00
|
|
|
# Copyright 2005-2015 Free Software Foundation, Inc.
|
2008-02-05 22:20:51 +00:00
|
|
|
#
|
|
|
|
# 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"
|
|
|
|
|
2012-07-26 18:43:02 +00:00
|
|
|
standard_ada_testfile foo
|
2008-02-05 22:20:51 +00:00
|
|
|
|
|
|
|
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
|
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
[testsuite/gdb.ada] simplify some testcases by using clean_restart.
gdb/testsuite/ChangeLog:
* gdb.ada/array_bounds.exp, gdb.ada/array_return.exp,
gdb.ada/array_subscript_addr.exp, gdb.ada/arrayidx.exp,
gdb.ada/arrayparam.exp, gdb.ada/arrayptr.exp,
gdb.ada/atomic_enum.exp, gdb.ada/call_pn.exp,
gdb.ada/catch_ex.exp, gdb.ada/char_param.exp,
gdb.ada/complete.exp, gdb.ada/exprs.exp, gdb.ada/fixed_cmp.exp,
gdb.ada/fixed_points.exp, gdb.ada/formatted_ref.exp,
gdb.ada/frame_args.exp, gdb.ada/fun_addr.exp,
gdb.ada/fun_in_declare.exp, gdb.ada/funcall_param.exp,
gdb.ada/homonym.exp, gdb.ada/int_deref.exp,
gdb.ada/interface.exp, gdb.ada/lang_switch.exp,
gdb.ada/mod_from_name.exp, gdb.ada/nested.exp,
gdb.ada/null_array.exp, gdb.ada/null_record.exp,
gdb.ada/packed_array.exp, gdb.ada/packed_tagged.exp,
gdb.ada/print_chars.exp, gdb.ada/print_pc.exp,
gdb.ada/ptype_field.exp, gdb.ada/ptype_tagged_param.exp,
gdb.ada/rec_return.exp, gdb.ada/ref_param.exp,
gdb.ada/ref_tick_size.exp, gdb.ada/start.exp,
gdb.ada/str_ref_cmp.exp, gdb.ada/sym_print_name.exp,
gdb.ada/taft_type.exp, gdb.ada/tagged.exp, gdb.ada/tasks.exp,
gdb.ada/tick_last_segv.exp, gdb.ada/type_coercion.exp,
gdb.ada/uninitialized_vars.exp,
gdb.ada/variant_record_packed_array.exp, gdb.ada/watch_arg.exp:
Simplify by using clean_restart.
2011-01-06 10:35:00 +00:00
|
|
|
clean_restart ${testfile}
|
2008-02-05 22:20:51 +00:00
|
|
|
|
|
|
|
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 } {
|
|
|
|
gdb_test "complete p $expr" \
|
|
|
|
"$expected_output" \
|
|
|
|
"complete p $expr"
|
|
|
|
}
|
|
|
|
|
|
|
|
# A convenience function that verifies that the "complete EXPR" command
|
2013-05-16 10:13:33 +00:00
|
|
|
# does not generate any output.
|
2008-02-05 22:20:51 +00:00
|
|
|
|
|
|
|
proc test_gdb_no_completion { expr } {
|
2013-05-16 10:13:33 +00:00
|
|
|
gdb_test_no_output "complete p $expr"
|
2008-02-05 22:20:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# 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"
|
|
|
|
|
|
|
|
# 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>"
|
|
|
|
|
|
|
|
# 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"
|
|
|
|
|
|
|
|
# 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.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.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>"
|
|
|
|
|
2013-05-16 07:02:43 +00:00
|
|
|
# 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.
|
2014-03-19 02:16:35 +00:00
|
|
|
|
|
|
|
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"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-05-16 07:02:43 +00:00
|
|
|
}
|
|
|
|
}
|