2015-01-01 09:32:14 +00:00
|
|
|
# Copyright 1998-2015 Free Software Foundation, Inc.
|
1999-04-16 01:35:26 +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
|
2007-08-23 18:14:19 +00:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
1999-04-16 01:35:26 +00:00
|
|
|
# (at your option) any later version.
|
2007-08-23 18:14:19 +00:00
|
|
|
#
|
1999-04-16 01:35:26 +00:00
|
|
|
# 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.
|
2007-08-23 18:14:19 +00:00
|
|
|
#
|
1999-04-16 01:35:26 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
2007-08-23 18:14:19 +00:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
clear_xfail "*-*-*"
|
|
|
|
|
test suite update - gdb.base/[h-m]
Convert files gdb.base/[h-m]*.exp to use standard_output_file et al.
* hook-stop-continue.exp, hook-stop-frame.exp, huge.exp,
included.exp, inferior-died.exp, infnan.exp, info-fun.exp,
info-macros.exp, info-os.exp, info-proc.exp, info-target.exp,
infoline.exp, interp.exp, interrupt.exp, jit-simple.exp,
jit-so.exp, jump.exp, kill-after-signal.exp, label.exp, langs.exp,
lineinc.exp, list.exp, logical.exp, long_long.exp, longjmp.exp,
macscp.exp, maint.exp, memattr.exp, mips_pro.exp, miscexprs.exp,
morestack.exp, moribund-step.exp, multi-forks.exp: Use
standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
2013-06-27 18:51:31 +00:00
|
|
|
standard_testfile .c
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
# Build the test case
|
2006-03-07 15:23:33 +00:00
|
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
|
2006-08-10 05:27:22 +00:00
|
|
|
untested jump.exp
|
|
|
|
return -1
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Start with a fresh gdb
|
|
|
|
|
test suite update - gdb.base/[h-m]
Convert files gdb.base/[h-m]*.exp to use standard_output_file et al.
* hook-stop-continue.exp, hook-stop-frame.exp, huge.exp,
included.exp, inferior-died.exp, infnan.exp, info-fun.exp,
info-macros.exp, info-os.exp, info-proc.exp, info-target.exp,
infoline.exp, interp.exp, interrupt.exp, jit-simple.exp,
jit-so.exp, jump.exp, kill-after-signal.exp, label.exp, langs.exp,
lineinc.exp, list.exp, logical.exp, long_long.exp, longjmp.exp,
macscp.exp, maint.exp, memattr.exp, mips_pro.exp, miscexprs.exp,
morestack.exp, moribund-step.exp, multi-forks.exp: Use
standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
2013-06-27 18:51:31 +00:00
|
|
|
clean_restart ${binfile}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
if ![runto_main] then {
|
|
|
|
perror "Couldn't run to main"
|
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
|
|
|
# Set a breakpoint on the statement that we're about to jump to.
|
|
|
|
# The statement doesn't contain a function call.
|
|
|
|
#
|
|
|
|
set bp_on_non_call 0
|
2014-10-24 11:57:22 +00:00
|
|
|
set non_call_line [gdb_get_line_number "bp-on-non-call"]
|
|
|
|
gdb_test_multiple "break $non_call_line" "break before jump to non-call" {
|
|
|
|
-re "\[Bb\]reakpoint (${decimal}) at ${hex}: file .*${srcfile}, line $non_call_line.*$gdb_prompt $" {
|
2010-05-24 22:06:59 +00:00
|
|
|
set bp_on_non_call $expect_out(1,string)
|
|
|
|
pass "break before jump to non-call"
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Can we jump to the statement? Do we stop there?
|
|
|
|
#
|
2014-10-24 11:57:22 +00:00
|
|
|
gdb_test "jump $non_call_line" "Breakpoint ${decimal}, .*${srcfile}:$non_call_line.*" \
|
2010-05-24 22:06:59 +00:00
|
|
|
"jump to non-call"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
# Set a breakpoint on the statement that we're about to jump to.
|
|
|
|
# The statement does contain a function call.
|
|
|
|
#
|
|
|
|
set bp_on_call 0
|
2014-10-24 11:57:22 +00:00
|
|
|
set call_line [gdb_get_line_number "bp-on-call"]
|
|
|
|
gdb_test_multiple "break $call_line" "break before jump to call" {
|
|
|
|
-re "\[Bb\]reakpoint (${decimal}) at ${hex}: file .*${srcfile}, line $call_line.*$gdb_prompt $" {
|
2010-05-24 22:06:59 +00:00
|
|
|
set bp_on_call $expect_out(1,string)
|
|
|
|
pass "break before jump to call"
|
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Can we jump to the statement? Do we stop there?
|
|
|
|
#
|
2014-10-24 11:57:22 +00:00
|
|
|
gdb_test "jump $call_line" \
|
|
|
|
"Breakpoint ${decimal}, .*${srcfile}:$call_line.*" \
|
2010-05-24 22:06:59 +00:00
|
|
|
"jump to call"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
# If we disable the breakpoint at the function call, and then
|
|
|
|
# if we jump to that statement, do we not stop there, but at
|
|
|
|
# the following breakpoint?
|
|
|
|
#
|
2010-05-24 22:06:59 +00:00
|
|
|
gdb_test_no_output "disable $bp_on_call" "disable breakpoint on call"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2014-10-24 11:57:22 +00:00
|
|
|
gdb_test "jump $call_line" "Breakpoint ${decimal}, .*${srcfile}:$non_call_line.*" \
|
2010-05-24 22:06:59 +00:00
|
|
|
"jump to call with disabled breakpoint"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
# Verify that GDB responds gracefully to the "jump" command without
|
|
|
|
# an argument.
|
|
|
|
#
|
2010-05-24 22:06:59 +00:00
|
|
|
gdb_test "jump" "Argument required .starting address.*" \
|
|
|
|
"jump without argument disallowed"
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
# Verify that GDB responds gracefully to the "jump" command with
|
|
|
|
# trailing junk.
|
|
|
|
#
|
2014-10-24 11:57:22 +00:00
|
|
|
gdb_test "jump $call_line 100" \
|
2012-04-05 18:50:29 +00:00
|
|
|
"malformed linespec error: unexpected number, \"100\"" \
|
2010-05-24 22:06:59 +00:00
|
|
|
"jump with trailing argument junk"
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
# Verify that GDB responds gracefully to a request to jump out of
|
|
|
|
# the current function. (Note that this will very likely cause the
|
|
|
|
# inferior to die. Be prepared to rerun the inferior, if further
|
|
|
|
# testing is desired.)
|
|
|
|
#
|
|
|
|
# Try it both ways: confirming and not confirming the jump.
|
|
|
|
#
|
|
|
|
|
2014-10-24 11:57:22 +00:00
|
|
|
set out_line [gdb_get_line_number "out-of-func"]
|
|
|
|
gdb_test "jump $out_line" \
|
2010-05-24 22:06:59 +00:00
|
|
|
"Not confirmed.*" \
|
|
|
|
"aborted jump out of current function" \
|
2014-10-24 11:57:22 +00:00
|
|
|
"Line $out_line is not in `main'. Jump anyway.*y or n. $" \
|
2010-05-24 22:06:59 +00:00
|
|
|
"n"
|
|
|
|
|
2014-10-24 11:57:22 +00:00
|
|
|
gdb_test "jump $out_line" \
|
2010-05-24 22:06:59 +00:00
|
|
|
"Continuing at.*" \
|
|
|
|
"jump out of current function" \
|
2014-10-24 11:57:22 +00:00
|
|
|
"Line $out_line is not in `main'. Jump anyway.*y or n. $" \
|
2010-05-24 22:06:59 +00:00
|
|
|
"y"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
gdb_exit
|
|
|
|
return 0
|