2015-01-01 09:32:14 +00:00
|
|
|
# Copyright 2011-2015 Free Software Foundation, Inc.
|
2011-10-05 14:23:37 +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/>.
|
|
|
|
|
|
|
|
# This file was written by Pierre Muller <muller@ics.u-strasbg.fr>
|
|
|
|
#
|
|
|
|
# Check if environment variables are correctly passed to inferiors
|
|
|
|
#
|
|
|
|
|
2011-11-30 08:25:17 +00:00
|
|
|
# There's no support for passing environment variables in the remote protocol.
|
|
|
|
if { [is_remote target] } {
|
|
|
|
return 0
|
|
|
|
}
|
2011-10-05 14:23:37 +00:00
|
|
|
|
test suite update - gdb.base/[t-z]
Convert files gdb.base/[t-z]*.exp to use standard_output_file et al.
* gdb.base/testenv.exp, gdb.base/tui-layout.exp,
gdb.base/twice.exp, gdb.base/type-opaque.exp, gdb.base/unload.exp,
gdb.base/unwindonsignal.exp, gdb.base/valgrind-db-attach.exp,
gdb.base/valgrind-infcall.exp, gdb.base/value-double-free.exp,
gdb.base/varargs.exp, gdb.base/watch-cond-infcall.exp,
gdb.base/watch-cond.exp, gdb.base/watch-non-mem.exp,
gdb.base/watch-read.exp, gdb.base/watch-vfork.exp,
gdb.base/watch_thread_num.exp, gdb.base/watchpoint-cond-gone.exp,
gdb.base/watchpoint-delete.exp, gdb.base/watchpoint-hw.exp,
gdb.base/watchpoint-solib.exp, gdb.base/watchpoint.exp,
gdb.base/watchpoints.exp, gdb.base/wchar.exp, gdb.base/whatis.exp:
Use standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
2013-06-27 19:00:47 +00:00
|
|
|
standard_testfile .c
|
2011-10-05 14:23:37 +00:00
|
|
|
|
|
|
|
# Compile binary
|
|
|
|
# and start with a fresh gdb
|
|
|
|
|
|
|
|
if { [prepare_for_testing ${testfile}.exp ${binfile} ${srcfile}] } {
|
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
|
|
|
# make sure $pc is sane, in case we're talking to a board.
|
|
|
|
if { ![runto_main] } {
|
2013-06-07 17:31:09 +00:00
|
|
|
gdb_suppress_tests
|
2011-10-05 14:23:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set bp_line [gdb_get_line_number "set breakpoint here"]
|
|
|
|
gdb_breakpoint $bp_line
|
|
|
|
|
|
|
|
#
|
|
|
|
# Test gdb set/unset environment commands.
|
|
|
|
# Executable lists and counts all environment variables
|
|
|
|
# starting with TEST_GDB.
|
|
|
|
|
|
|
|
|
|
|
|
# First test with no TEST_GDB_VAR
|
|
|
|
gdb_test "continue" \
|
|
|
|
".*Program found 0 variables starting with TEST_GDB.*" \
|
|
|
|
"Test no TEST_GDB var"
|
|
|
|
|
|
|
|
gdb_test_no_output "set env TEST_GDB_VAR1 test1" \
|
|
|
|
"Set TEST_GDB_VAR1"
|
|
|
|
|
|
|
|
runto_main
|
|
|
|
gdb_breakpoint $bp_line
|
|
|
|
|
|
|
|
# Second test with one TEST_GDB_VAR
|
|
|
|
gdb_test "continue" \
|
|
|
|
".*Program found 1 variables starting with TEST_GDB.*" \
|
|
|
|
"Test with one TEST_GDB var"
|
|
|
|
|
|
|
|
gdb_test_no_output "set env TEST_GDB_VAR2 test2" \
|
|
|
|
"Set TEST_GDB_VAR2"
|
|
|
|
|
|
|
|
runto_main
|
|
|
|
gdb_breakpoint $bp_line
|
|
|
|
|
|
|
|
# Third test with two TEST_GDB_VAR
|
|
|
|
gdb_test "continue" \
|
|
|
|
".*Program found 2 variables starting with TEST_GDB.*" \
|
|
|
|
"Test with two TEST_GDB var"
|
|
|
|
|
|
|
|
gdb_test_no_output "unset env TEST_GDB_VAR1" \
|
|
|
|
"Unset TEST_GDB_VAR1"
|
|
|
|
|
|
|
|
runto_main
|
|
|
|
gdb_breakpoint $bp_line
|
|
|
|
|
|
|
|
# Fourth test with one TEST_GDB_VAR left, after one was removed
|
|
|
|
# with unset command.
|
|
|
|
gdb_test "continue" \
|
|
|
|
".*Program found 1 variables starting with TEST_GDB.*" \
|
|
|
|
"Test with one TEST_GDB var, after unset"
|
|
|
|
|
|
|
|
gdb_exit
|
|
|
|
|
|
|
|
set env(TEST_GDB_GLOBAL) "Global environment value"
|
|
|
|
|
|
|
|
clean_restart $binfile
|
|
|
|
|
|
|
|
# make sure $pc is sane, in case we're talking to a board.
|
|
|
|
if { ![runto_main] } {
|
2013-06-07 17:31:09 +00:00
|
|
|
gdb_suppress_tests
|
2011-10-05 14:23:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set bp_line [gdb_get_line_number "set breakpoint here"]
|
|
|
|
gdb_breakpoint $bp_line
|
|
|
|
|
|
|
|
gdb_test "show env" ".*TEST_GDB_GLOBAL=.*" "Test passing TEST_GDB_GLOBAL to GDB"
|
|
|
|
# First test with only inherited TEST_GDB_GLOBAL
|
|
|
|
gdb_test "continue" \
|
|
|
|
".*TEST_GDB_GLOBAL=Global environment value.*Program found 1 variables starting with TEST_GDB.*" \
|
|
|
|
"Test with TEST_GDB_GLOBAL"
|
|
|
|
|
|
|
|
gdb_test_no_output "unset env TEST_GDB_GLOBAL" \
|
|
|
|
"Unset TEST_GDB_GLOBAL"
|
|
|
|
|
|
|
|
runto_main
|
|
|
|
gdb_breakpoint $bp_line
|
|
|
|
|
|
|
|
# Second test with one TEST_GDB_VAR
|
|
|
|
gdb_test "continue" \
|
|
|
|
".*Program found 0 variables starting with TEST_GDB.*" \
|
|
|
|
"Test with TEST_GDB_GLOBAL unset"
|
|
|
|
|
|
|
|
gdb_exit
|
2011-11-30 08:25:17 +00:00
|
|
|
|
|
|
|
# Clear environment in case we're doing multiple runs
|
|
|
|
unset env(TEST_GDB_GLOBAL)
|
|
|
|
|