-# Copyright 1997-2018 Free Software Foundation, Inc.
+# Copyright 1997-2019 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
global testfile
global subdir
global timeout
+ global decimal
# Figure out a regular expression that will match the sysroot,
# noting that the default sysroot is "target:", and also noting
# that GDB will strip "target:" from the start of filenames when
- # operating on the local filesystem
- set sysroot ""
- set test "show sysroot"
- gdb_test_multiple $test $test {
- -re "The current system root is \"(.*)\"\..*${gdb_prompt} $" {
- set sysroot $expect_out(1,string)
- }
- }
- regsub "^target:" "$sysroot" "(target:)?" sysroot
+ # operating on the local filesystem. However the default sysroot
+ # can be set via configure option --with-sysroot, which can be "/".
+ # If $binfile is a absolute path, so pattern
+ # "$sysroot$escapedbinfile" below is wrong. Use [^\r\n]* to make
+ # $sysroot simple.
+ set sysroot "\[^\r\n\]*"
# Start the program running and then wait for a bit, to be sure
# that it can be attached to.
set test "set file, before attach1"
gdb_test_multiple "file $binfile" "$test" {
-re "Load new symbol table from.*y or n. $" {
- gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*" \
"$test (re-read)"
}
- -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
+ -re "Reading symbols from $escapedbinfile\.\.\.*$gdb_prompt $" {
pass "$test"
}
}
# Detach the process.
gdb_test "detach" \
- "Detaching from program: .*$escapedbinfile, process $testpid" \
+ "Detaching from program: .*$escapedbinfile, process $testpid\r\n\\\[Inferior $decimal \\(.*\\) detached\\\]" \
"attach1 detach"
# Wait a bit for gdb to finish detaching
# executable's symbol table. This in turn always results in
# asking the user for actually loading the symbol table of the
# executable.
- gdb_test "y" "Reading symbols from $sysroot$escapedbinfile\.\.\.*done." \
+ gdb_test "y" "Reading symbols from $sysroot$escapedbinfile\.\.\.*" \
"$test (reset file)"
set found_exec_file 1
set test "load file manually, after attach2"
gdb_test_multiple "file $binfile" "$test" {
-re "A program is being debugged already..*Are you sure you want to change the file.*y or n. $" {
- gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*" \
"$test (re-read)"
}
- -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
+ -re "Reading symbols from $escapedbinfile\.\.\.*$gdb_prompt $" {
pass "$test"
}
}
gdb_exit
- set res [gdb_spawn_with_cmdline_opts "--pid=$testpid"]
+ set res [gdb_spawn_with_cmdline_opts \
+ "-quiet -iex \"set height 0\" -iex \"set width 0\" --pid=$testpid"]
set test "starting with --pid"
gdb_test_multiple "" $test {
-re "Reading symbols from.*$gdb_prompt $" {
gdb_exit
set res [gdb_spawn_with_cmdline_opts \
- "-iex \"set height 0\" -iex \"set width 0\" --pid=$testpid -ex \"start\""]
+ "-quiet -iex \"set height 0\" -iex \"set width 0\" --pid=$testpid -ex \"start\""]
if { $res != 0} {
fail $test
kill_wait_spawned_process $test_spawn_id