gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
if ![runto_main] then { fail "environment command tests suppressed" }
# (No, this is not really related to the environment commands. But it's
# a convenient place to verify that this command works.)
#
send_gdb "info program\n"
gdb_expect {
-re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped at breakpoint 1..*$gdb_prompt $"\
{pass "info program"}
-re "$gdb_prompt $"\
{fail "info program"}
timeout {fail "(timeout) info program"}
}
# We don't really care where this step lands, so long as it gets
# the inferior pushed off the breakpoint it's currently on...
#
send_gdb "next\n"
gdb_expect {
-re ".*$gdb_prompt $"\
{pass "step before info program"}
timeout {fail "(timeout) step before info program"}
}
send_gdb "info program\n"
gdb_expect {
-re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped after being stepped..*$gdb_prompt $"\
{pass "info program after step"}
-re "$gdb_prompt $"\
{fail "info program after step"}
timeout {fail "(timeout) info program after step"}
}
if ![runto_main] then { fail "environment command tests suppressed" }
send_gdb "delete\n"
gdb_expect {
-re ".*y or n. $"\
{send_gdb "y\n"
gdb_expect {
-re ".*$gdb_prompt $"\
{pass "delete breakpoint before info program"}
timeout {fail "(timeout) delete breakpoint before info program"}
}
}
-re "$gdb_prompt $"\
{fail "delete breakpoint before info program"}
timeout {fail "(timeout) delete breakpoint before info program"}
}
send_gdb "info program\n"
gdb_expect {
-re ".*Using the running image of child process \[0-9\]*.\r\nProgram stopped at 0x\[0-9a-fA-F\]*.\r\nIt stopped at a breakpoint that has since been deleted..*$gdb_prompt $"\
{pass "info program after deleted breakpoint"}
-re "$gdb_prompt $"\
{fail "info program after deleted breakpoint"}
timeout {fail "(timeout) info program after deleted breakpoint"}
}
# Verify that we can show all currently-set environment variables.
# (It's a bit hacky, but nonetheless probably safe to check for at
# least the SHELL variable.)
#
# need to increase timeout because of very long output
set oldtimeout $timeout
set timeout [expr "$timeout + 300"]
send_gdb "show environment\n"
gdb_expect {
-re ".*SHELL=(\[a-zA-Z0-9\]*).*$gdb_prompt $"\
{pass "show environment"}
-re "$gdb_prompt $"\
{fail "show environment"}
timeout {fail "(timeout) show environment"}
}
set timeout $oldtimeout
# Verify that we can unset a specific environment variable.