a8f077dc25
This patch updates tests for fork and exec events in target remote mode. In the majority of cases this was a simple matter of removing some code that disabled the test for target remote. In a few cases the test needed to be disabled; in those cases the gdb_protocol was checked instead of using the [is_remote target] etc. In a couple of cases we needed to use clean_restart, since target remote doesn't support the run command, and in one case we had to modify an expect expression to allow for a "multiprocess-style" ptid. Tested with the patch that implemented target remote mode fork and exec event support. gdb/testsuite/ChangeLog: * gdb.base/execl-update-breakpoints.exp (main): Enable for target remote. * gdb.base/foll-exec-mode.exp (main): Disable for target remote. * gdb.base/foll-exec.exp (main): Enable for target remote. * gdb.base/foll-fork.exp (main): Likewise. * gdb.base/foll-vfork.exp (main): Likewise. * gdb.base/multi-forks.exp (main): Likewise, and use clean_restart. (proc continue_to_exit_bp_loc): Use clean_restart. * gdb.base/pie-execl.exp (main): Disable for target remote. * gdb.base/watch-vfork.exp (main): Enable for target remote. * gdb.mi/mi-nsthrexec.exp (main): Likewise. * gdb.threads/execl.exp (main): Likewise. * gdb.threads/fork-child-threads.exp (main): Likewise. * gdb.threads/fork-plus-threads.exp (main): Disable for target remote. * gdb.threads/fork-thread-pending.exp (main): Enable for target remote. * gdb.threads/linux-dp.exp (check_philosopher_stack): Allow pid.tid style ptids, instead of just tid. * gdb.threads/thread-execl.exp (main): Enable for target remote. * gdb.threads/watchpoint-fork.exp (main): Likewise. * gdb.trace/report.exp (use_collected_data): Allow pid.tid style ptids, instead of just tid.
122 lines
3.4 KiB
Text
122 lines
3.4 KiB
Text
# Copyright 2014-2015 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/>.
|
|
|
|
# Test that when following an exec, we don't try to insert breakpoints
|
|
# in the new image at the addresses the symbols had before the exec.
|
|
|
|
standard_testfile
|
|
|
|
# Build two copies of the program, each linked at a different address.
|
|
# The address of "main" in the first binary should end up being an
|
|
# unmapped address in the second binary.
|
|
|
|
set objfile ${binfile}.o
|
|
set exec1 ${binfile}1
|
|
set exec2 ${binfile}2
|
|
|
|
if { [gdb_compile [file join $srcdir $subdir $srcfile] $objfile \
|
|
object [list debug]] != "" } {
|
|
untested "compile failed"
|
|
return -1
|
|
}
|
|
|
|
set opts1_ld [list debug ldflags=-Wl,-Ttext-segment=0x1000000]
|
|
set opts1_gold [list debug ldflags=-Wl,-Ttext=0x1000000]
|
|
set opts2_ld [list debug ldflags=-Wl,-Ttext-segment=0x2000000]
|
|
set opts2_gold [list debug ldflags=-Wl,-Ttext=0x2000000]
|
|
|
|
if { [gdb_compile $objfile $exec1 executable $opts1_ld] != "" } {
|
|
# Old gold linker versions don't support -Ttext-segment. Fall
|
|
# back to -Ttext.
|
|
if { [gdb_compile $objfile $exec1 executable $opts1_gold] != ""
|
|
|| [gdb_compile $objfile $exec2 executable $opts2_gold] != ""} {
|
|
untested "link failed"
|
|
return -1
|
|
}
|
|
} elseif { [gdb_compile $objfile $exec2 executable $opts2_ld] != "" } {
|
|
untested "link failed"
|
|
return -1
|
|
}
|
|
|
|
# First check whether the address of "main" in exec1 is readable in
|
|
# exec2. If it is, then skip the test as unsupported.
|
|
|
|
clean_restart ${exec1}
|
|
if ![runto_main] then {
|
|
fail "Couldn't run to main"
|
|
return -1
|
|
}
|
|
|
|
set addr ""
|
|
set test "main address first"
|
|
gdb_test_multiple "p/x &main" $test {
|
|
-re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
|
|
set addr $expect_out(1,string)
|
|
pass $test
|
|
}
|
|
}
|
|
|
|
clean_restart ${exec2}
|
|
if ![runto_main] then {
|
|
fail "Couldn't run to main"
|
|
return -1
|
|
}
|
|
|
|
set cannot_access 0
|
|
set test "probe memory access"
|
|
gdb_test_multiple "x $addr" $test {
|
|
-re "Cannot access memory at address .*$gdb_prompt $" {
|
|
set cannot_access 1
|
|
pass $test
|
|
}
|
|
-re ".*$gdb_prompt $" {
|
|
pass $test
|
|
}
|
|
}
|
|
|
|
if {!$cannot_access} {
|
|
unsupported "main address is readable in second binary"
|
|
return
|
|
}
|
|
|
|
# The test proper. ALWAYS_INSERTED indicates whether testing in
|
|
# "breakpoint always-inserted" mode.
|
|
|
|
proc test { always_inserted } {
|
|
global exec1
|
|
|
|
clean_restart ${exec1}
|
|
|
|
gdb_test_no_output "set breakpoint always-inserted $always_inserted"
|
|
|
|
if ![runto_main] then {
|
|
fail "Couldn't run to main"
|
|
return -1
|
|
}
|
|
|
|
# On a buggy GDB, with always-inserted on, we'd see:
|
|
# (gdb) continue
|
|
# Continuing.
|
|
# Warning:
|
|
# Cannot insert breakpoint 1.
|
|
# Cannot access memory at address 0x10000ff
|
|
gdb_test "continue" "Breakpoint 1, main.*" "continue across exec"
|
|
}
|
|
|
|
foreach always_inserted { "off" "on" } {
|
|
with_test_prefix "always-inserted $always_inserted" {
|
|
test $always_inserted
|
|
}
|
|
}
|