4ec7020176
A few months ago semicolons after "return" were removed throughout the testsuite. However, as I pointed out in review, they're unnecessary not just after "return", but pretty much after any tcl command. ';' is the command separator, and you only need it if there's another command on the same line afterwards. This patch was written by running: $ find . -name "*.exp" | xargs grep -l ";\s*$" | xargs sed -i 's/\([^#][^\s*;]*\)\s*;\s*$/\1/' and then undoing changes to comments, and lib/future.exp. Tested on x86_64 Fedora 17. gdb/testsuite/ 2013-06-07 Pedro Alves <palves@redhat.com> * boards/native-extended-gdbserver.exp: Remove semicolon. * config/arm-ice.exp: Likewise. * config/bfin.exp: Likewise. * config/cygmon.exp: Likewise. * config/h8300.exp: Likewise. * config/monitor.exp: Likewise. * config/sid.exp: Likewise. * config/sim.exp: Likewise. * config/slite.exp: Likewise. * config/vx.exp: Likewise. * gdb.arch/i386-bp_permanent.exp: Likewise. * gdb.asm/asm-source.exp: Likewise. * gdb.base/args.exp: Likewise. * gdb.base/attach-pie-misread.exp: Likewise. * gdb.base/auxv.exp: Likewise. * gdb.base/bigcore.exp: Likewise. * gdb.base/bitfields2.exp: Likewise. * gdb.base/bitfields.exp: Likewise. * gdb.base/break.exp: Likewise. * gdb.base/break-interp.exp: Likewise. * gdb.base/callfuncs.exp: Likewise. * gdb.base/call-sc.exp: Likewise. * gdb.base/commands.exp: Likewise. * gdb.base/corefile.exp: Likewise. * gdb.base/dbx.exp: Likewise. * gdb.base/ending-run.exp: Likewise. * gdb.base/exprs.exp: Likewise. * gdb.base/funcargs.exp: Likewise. * gdb.base/hbreak2.exp: Likewise. * gdb.base/huge.exp: Likewise. * gdb.base/list.exp: Likewise. * gdb.base/memattr.exp: Likewise. * gdb.base/overlays.exp: Likewise. * gdb.base/printcmds.exp: Likewise. * gdb.base/recurse.exp: Likewise. * gdb.base/remotetimeout.exp: Likewise. * gdb.base/reread.exp: Likewise. * gdb.base/savedregs.exp: Likewise. * gdb.base/scope.exp: Likewise. * gdb.base/sepdebug.exp: Likewise. * gdb.base/setshow.exp: Likewise. * gdb.base/setvar.exp: Likewise. * gdb.base/sigaltstack.exp: Likewise. * gdb.base/siginfo-addr.exp: Likewise. * gdb.base/siginfo.exp: Likewise. * gdb.base/siginfo-obj.exp: Likewise. * gdb.base/sigrepeat.exp: Likewise. * gdb.base/sigstep.exp: Likewise. * gdb.base/structs.exp: Likewise. * gdb.base/testenv.exp: Likewise. * gdb.base/twice.exp: Likewise. * gdb.base/valgrind-db-attach.exp: Likewise. * gdb.base/valgrind-infcall.exp: Likewise. * gdb.base/varargs.exp: Likewise. * gdb.base/watchpoint.exp: Likewise. * gdb.cp/gdb1355.exp: Likewise. * gdb.cp/misc.exp: Likewise. * gdb.disasm/hppa.exp: Likewise. * gdb.disasm/t01_mov.exp: Likewise. * gdb.disasm/t02_mova.exp: Likewise. * gdb.disasm/t03_add.exp: Likewise. * gdb.disasm/t04_sub.exp: Likewise. * gdb.disasm/t05_cmp.exp: Likewise. * gdb.disasm/t06_ari2.exp: Likewise. * gdb.disasm/t07_ari3.exp: Likewise. * gdb.disasm/t08_or.exp: Likewise. * gdb.disasm/t09_xor.exp: Likewise. * gdb.disasm/t10_and.exp: Likewise. * gdb.disasm/t11_logs.exp: Likewise. * gdb.disasm/t12_bit.exp: Likewise. * gdb.disasm/t13_otr.exp: Likewise. * gdb.gdb/selftest.exp: Likewise. * gdb.hp/gdb.base-hp/callfwmall.exp: Likewise. * gdb.mi/mi-reverse.exp: Likewise. * gdb.pascal/floats.exp: Likewise. * gdb.python/py-inferior.exp: Likewise. * gdb.threads/attach-into-signal.exp: Likewise. * gdb.threads/pthreads.exp: Likewise. * gdb.threads/thread_events.exp: Likewise. * gdb.threads/watchthreads.exp: Likewise. * gdb.trace/actions-changed.exp: Likewise. * gdb.trace/actions.exp: Likewise. * gdb.trace/ax.exp: Likewise. * gdb.trace/backtrace.exp: Likewise. * gdb.trace/change-loc.exp: Likewise. * gdb.trace/deltrace.exp: Likewise. * gdb.trace/disconnected-tracing.exp: Likewise. * gdb.trace/ftrace.exp: Likewise. * gdb.trace/infotrace.exp: Likewise. * gdb.trace/passc-dyn.exp: Likewise. * gdb.trace/passcount.exp: Likewise. * gdb.trace/pending.exp: Likewise. * gdb.trace/qtro.exp: Likewise. * gdb.trace/range-stepping.exp: Likewise. * gdb.trace/report.exp: Likewise. * gdb.trace/save-trace.exp: Likewise. * gdb.trace/status-stop.exp: Likewise. * gdb.trace/strace.exp: Likewise. * gdb.trace/tfile.exp: Likewise. * gdb.trace/tfind.exp: Likewise. * gdb.trace/trace-break.exp: Likewise. * gdb.trace/tracecmd.exp: Likewise. * gdb.trace/trace-mt.exp: Likewise. * gdb.trace/tspeed.exp: Likewise. * gdb.trace/tsv.exp: Likewise. * gdb.trace/while-stepping.exp: Likewise. * lib/gdb.exp: Likewise. * lib/gdbserver-support.exp: Likewise. * lib/java.exp: Likewise. * lib/mi-support.exp: Likewise. * lib/pascal.exp: Likewise. * lib/prompt.exp: Likewise. * lib/trace-support.exp: Likewise.
308 lines
10 KiB
Text
308 lines
10 KiB
Text
# Copyright 1997-2013 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/>.
|
|
#
|
|
# This file was written by Michael Snyder (msnyder@cygnus.com)
|
|
|
|
#
|
|
# test running programs
|
|
#
|
|
|
|
|
|
set data_overlays 1
|
|
|
|
if [istarget "d10v-*-*"] then {
|
|
set linker_script "${srcdir}/${subdir}/d10v.ld"
|
|
} elseif [istarget "m32r-*-*"] then {
|
|
set linker_script "${srcdir}/${subdir}/m32r.ld"
|
|
} elseif [istarget "spu-*-*"] then {
|
|
set linker_script "${srcdir}/${subdir}/spu.ld"
|
|
set data_overlays 0
|
|
} else {
|
|
verbose "Skipping overlay test -- not implemented for this target."
|
|
return
|
|
}
|
|
|
|
if [istarget "*-*-linux*"] then {
|
|
verbose "Skipping overlay test -- Linux doesn't support overlayed programs."
|
|
return
|
|
}
|
|
|
|
set testfile "overlays"
|
|
set binfile ${objdir}/${subdir}/${testfile}
|
|
set srcfile ${testfile}.c
|
|
|
|
if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${testfile}.o" object {debug}] != ""} then {
|
|
untested overlays.exp
|
|
return -1
|
|
}
|
|
if {[gdb_compile "${srcdir}/${subdir}/ovlymgr.c" ovlymgr.o object {debug}] != ""} then {
|
|
untested overlays.exp
|
|
return -1
|
|
}
|
|
if {[gdb_compile "${srcdir}/${subdir}/foo.c" foo.o object {debug} ] != ""} then {
|
|
untested overlays.exp
|
|
return -1
|
|
}
|
|
|
|
if {[gdb_compile "${srcdir}/${subdir}/bar.c" bar.o object {debug}] != ""} then {
|
|
untested overlays.exp
|
|
return -1
|
|
}
|
|
if {[gdb_compile "${srcdir}/${subdir}/baz.c" baz.o object {debug}] != ""} then {
|
|
untested overlays.exp
|
|
return -1
|
|
}
|
|
if {[gdb_compile "${srcdir}/${subdir}/grbx.c" grbx.o object {debug}] != ""} then {
|
|
untested overlays.exp
|
|
return -1
|
|
}
|
|
if {[gdb_compile "${testfile}.o ovlymgr.o foo.o bar.o baz.o grbx.o" ${binfile} executable "ldscript=-Wl,-T$linker_script"] != "" } {
|
|
untested overlays.exp
|
|
return -1
|
|
}
|
|
|
|
remote_exec build "mv ${testfile}.o foo.o bar.o baz.o grbx.o ovlymgr.o ${objdir}/${subdir}"
|
|
|
|
|
|
gdb_start
|
|
gdb_reinitialize_dir $srcdir/$subdir
|
|
gdb_load ${binfile}
|
|
|
|
#
|
|
# set it up at a breakpoint so we can play with the variable values
|
|
#
|
|
|
|
if ![runto_main] then {
|
|
gdb_suppress_tests
|
|
}
|
|
|
|
# couple of convenience variables
|
|
set fptrcast [string_to_regexp "{int (int)}"]
|
|
set iptrcast [string_to_regexp "(int *)"]
|
|
set hexx "0x\[0-9abcdefABCDEF\]+"
|
|
|
|
gdb_test_no_output "overlay manual"
|
|
gdb_test "overlay list" "No sections are mapped." "List with none mapped"
|
|
|
|
# capture the LMA addresses of [foo bar baz grbx foox barx bazx grbxx]
|
|
|
|
proc get_func_address { func func_sym msg } {
|
|
global gdb_prompt
|
|
global fptrcast
|
|
global hexx
|
|
|
|
set func_addr 0
|
|
send_gdb "print $func\n"
|
|
gdb_expect {
|
|
-re "\\$\[0-9\]+ = $fptrcast (${hexx}) <$func_sym>.*$gdb_prompt $" {
|
|
set func_addr $expect_out(1,string)
|
|
pass "get $msg"
|
|
}
|
|
-re ".*$gdb_prompt $" {
|
|
fail "get $msg"
|
|
}
|
|
default {
|
|
fail "get $msg (timeout)"
|
|
}
|
|
}
|
|
return $func_addr
|
|
}
|
|
|
|
set foo_lma [get_func_address "foo" "\\*foo\\*" "foo load address"]
|
|
set bar_lma [get_func_address "bar" "\\*bar\\*" "bar load address"]
|
|
set baz_lma [get_func_address "baz" "\\*baz\\*" "baz load address"]
|
|
set grbx_lma [get_func_address "grbx" "\\*grbx\\*" "grbx load address"]
|
|
|
|
if $data_overlays then {
|
|
gdb_test "print \$foox_lma = &foox" \
|
|
".* $iptrcast 0x.*" "foox load addr"
|
|
gdb_test "print \$barx_lma = &barx" \
|
|
".* $iptrcast 0x.*" "barx load addr"
|
|
gdb_test "print \$bazx_lma = &bazx" \
|
|
".* $iptrcast 0x.*" "bazx load addr"
|
|
gdb_test "print \$grbxx_lma = &grbxx" \
|
|
".* $iptrcast 0x.*" "grbxx load addr"
|
|
}
|
|
|
|
# map each overlay successively, and
|
|
# capture the VMA addresses of [foo bar baz grbx foox barx bazx grbxx]
|
|
|
|
gdb_test "overlay map .ovly0" ""
|
|
gdb_test "overlay list" "Section .ovly0, loaded at.*, mapped at.*" "List ovly0"
|
|
set foo_vma [get_func_address "foo" "foo" "foo runtime address"]
|
|
|
|
gdb_test "overlay map .ovly1" ""
|
|
gdb_test "overlay list" "Section .ovly1, loaded at.*, mapped at.*" "List ovly1"
|
|
set bar_vma [get_func_address "bar" "bar" "bar runtime address"]
|
|
|
|
gdb_test "overlay map .ovly2" ""
|
|
gdb_test "overlay list" "Section .ovly2, loaded at.*, mapped at.*" "List ovly2"
|
|
set baz_vma [get_func_address "baz" "baz" "baz runtime address"]
|
|
|
|
gdb_test "overlay map .ovly3" ""
|
|
gdb_test "overlay list" "Section .ovly3, loaded at.*, mapped at.*" "List ovly3"
|
|
set grbx_vma [get_func_address "grbx" "grbx" "grbx runtime address"]
|
|
|
|
if $data_overlays then {
|
|
gdb_test "overlay map .data00" ""
|
|
gdb_test "overlay list" "Section .data00, loaded .*, mapped .*" "List data00"
|
|
gdb_test "print \$foox_vma = &foox" \
|
|
".* $iptrcast 0x.*" "foox runtime addr"
|
|
|
|
gdb_test "overlay map .data01" ""
|
|
gdb_test "overlay list" "Section .data01, loaded .*, mapped .*" "List data01"
|
|
gdb_test "print \$barx_vma = &barx" \
|
|
".* $iptrcast 0x.*" "barx runtime addr"
|
|
|
|
gdb_test "overlay map .data02" ""
|
|
gdb_test "overlay list" "Section .data02, loaded .*, mapped .*" "List data02"
|
|
gdb_test "print \$bazx_vma = &bazx" \
|
|
".* $iptrcast 0x.*" "bazx runtime addr"
|
|
|
|
gdb_test "overlay map .data03" ""
|
|
gdb_test "overlay list" "Section .data03, loaded .*, mapped .*" "List data03"
|
|
gdb_test "print \$grbxx_vma = &grbxx" \
|
|
".* $iptrcast 0x.*" "grbxx runtime addr"
|
|
}
|
|
# Verify that LMA != VMA
|
|
|
|
gdb_test "print $foo_lma != $foo_vma" ".* = 1" "foo's LMA != VMA"
|
|
gdb_test "print $bar_lma != $bar_vma" ".* = 1" "bar's LMA != VMA"
|
|
gdb_test "print $baz_lma != $baz_vma" ".* = 1" "baz's LMA != VMA"
|
|
gdb_test "print $grbx_lma != $grbx_vma" ".* = 1" "grbx's LMA != VMA"
|
|
if $data_overlays then {
|
|
gdb_test "print \$foox_lma != \$foox_vma" ".* = 1" "foox's LMA != VMA"
|
|
gdb_test "print \$barx_lma != \$barx_vma" ".* = 1" "barx's LMA != VMA"
|
|
gdb_test "print \$bazx_lma != \$bazx_vma" ".* = 1" "bazx's LMA != VMA"
|
|
gdb_test "print \$grbxx_lma != \$grbxx_vma" ".* = 1" "grbxx's LMA != VMA"
|
|
}
|
|
|
|
# Verify that early-mapped overlays have been bumped out
|
|
# by later-mapped overlays layed over in the same VMA range.
|
|
|
|
send_gdb "overlay list\n"
|
|
gdb_expect {
|
|
-re ".*ovly0, " { fail ".ovly0 not unmapped by .ovly1" }
|
|
-re ".*ovly2, " { fail ".ovly2 not unmapped by .ovly3" }
|
|
-re ".*data00," { fail ".data00 not unmapped by .data01" }
|
|
-re ".*data02," { fail ".data02 not unmapped by .data03" }
|
|
-re ".*$gdb_prompt $" { pass "Automatic unmapping" }
|
|
timeout { fail "(timeout) Automatic unmapping" }
|
|
}
|
|
|
|
# Verify that both sec1 and sec2 can be loaded simultaneously.
|
|
proc simultaneous_pair { sec1 sec2 } {
|
|
global gdb_prompt
|
|
|
|
set pairname "$sec1 and $sec2 mapped simultaneously"
|
|
gdb_test "overlay map $sec1" "" "$pairname: map $sec1"
|
|
gdb_test "overlay map $sec2" "" "$pairname: map $sec2"
|
|
|
|
set seen_sec1 0
|
|
set seen_sec2 0
|
|
|
|
send_gdb "overlay list\n"
|
|
gdb_expect {
|
|
-re ".*[string_to_regexp $sec1], " { set seen_sec1 1; exp_continue }
|
|
-re ".*[string_to_regexp $sec2], " { set seen_sec2 1; exp_continue }
|
|
-re ".*$gdb_prompt $" {
|
|
if {$seen_sec1 && $seen_sec2} {
|
|
pass "$pairname"
|
|
} else {
|
|
fail "$pairname"
|
|
}
|
|
}
|
|
timeout { fail "(timeout) $pairname" }
|
|
}
|
|
}
|
|
|
|
simultaneous_pair .ovly0 .ovly2
|
|
simultaneous_pair .ovly0 .ovly3
|
|
simultaneous_pair .ovly1 .ovly2
|
|
simultaneous_pair .ovly1 .ovly3
|
|
|
|
if $data_overlays then {
|
|
simultaneous_pair .data00 .data02
|
|
simultaneous_pair .data00 .data03
|
|
simultaneous_pair .data01 .data02
|
|
simultaneous_pair .data01 .data03
|
|
}
|
|
|
|
# test automatic mode
|
|
|
|
gdb_test_no_output "overlay auto"
|
|
gdb_test "overlay list" "No sections are mapped." "List none mapped (auto)"
|
|
gdb_test "break foo" "Breakpoint .*at .*file .*foo.c.*" "break foo"
|
|
gdb_test "break bar" "Breakpoint .*at .*file .*bar.c.*" "break bar"
|
|
gdb_test "break baz" "Breakpoint .*at .*file .*baz.c.*" "break baz"
|
|
gdb_test "break grbx" "Breakpoint .*at .*file .*grbx.c.*" "break grbx"
|
|
|
|
send_gdb "continue\n"
|
|
gdb_expect {
|
|
-re "Breakpoint .* foo .x=1. at .*$gdb_prompt $" { pass "hit foo" }
|
|
-re ".*$gdb_prompt $" { fail "hit foo" }
|
|
timeout { fail "(timeout) hit foo" }
|
|
}
|
|
|
|
send_gdb "backtrace\n"
|
|
gdb_expect {
|
|
-re "#0 .*foo .*#1 .*main .*$gdb_prompt $" { pass "BT foo" }
|
|
-re ".*$gdb_prompt $" { fail "BT foo" }
|
|
timeout { fail "(timeout) BT foo" }
|
|
}
|
|
|
|
|
|
send_gdb "continue\n"
|
|
gdb_expect {
|
|
-re "Breakpoint .* bar .x=1. at .*$gdb_prompt $" { pass "hit bar" }
|
|
-re ".*$gdb_prompt $" { fail "hit bar" }
|
|
timeout { fail "(timeout) hit bar" }
|
|
}
|
|
|
|
send_gdb "backtrace\n"
|
|
gdb_expect {
|
|
-re "#0 .*bar .*#1 .*main .*$gdb_prompt $" { pass "BT bar" }
|
|
-re ".*$gdb_prompt $" { fail "BT bar" }
|
|
timeout { fail "(timeout) BT bar" }
|
|
}
|
|
|
|
send_gdb "continue\n"
|
|
gdb_expect {
|
|
-re "Breakpoint .* baz .x=1. at .*$gdb_prompt $" { pass "hit baz" }
|
|
-re ".*$gdb_prompt $" { fail "hit baz" }
|
|
timeout { fail "(timeout) hit baz" }
|
|
}
|
|
|
|
send_gdb "backtrace\n"
|
|
gdb_expect {
|
|
-re "#0 .*baz .*#1 .*main .*$gdb_prompt $" { pass "BT baz" }
|
|
-re ".*$gdb_prompt $" { fail "BT baz" }
|
|
timeout { fail "(timeout) BT baz" }
|
|
}
|
|
|
|
send_gdb "continue\n"
|
|
gdb_expect {
|
|
-re "Breakpoint .* grbx .x=1. at .*$gdb_prompt $" { pass "hit grbx" }
|
|
-re ".*$gdb_prompt $" { fail "hit grbx" }
|
|
timeout { fail "(timeout) hit grbx" }
|
|
}
|
|
|
|
send_gdb "backtrace\n"
|
|
gdb_expect {
|
|
-re "#0 .*grbx .*#1 .*main .*$gdb_prompt $" { pass "BT grbx" }
|
|
-re ".*$gdb_prompt $" { fail "BT grbx" }
|
|
timeout { fail "(timeout) BT grbx" }
|
|
}
|
|
|