Skip to content

Commit 81a7a72

Browse files
committed
[gdb/testsuite] Fix gdb.arch/amd64*.exp with local-remote-host-native.exp
There's a number of gdb.arch/amd64*.exp test-cases that fail with host+target board local-remote-host-native.exp because of using a .S file, generated from a .c file. If a test-case compiles the .S file when executing on remote host, the .S file is already copied from build to host, such that it's available for the compiler. But that's not the case for the .c file, which is needed by gdb to show a source line: ... (gdb) continue^M Continuing.^M ^M Breakpoint 2, fn2 (y=y@entry=25, x=x@entry=6) at amd64-entry-value-inline.c:32^M 32 in gdb.arch/amd64-entry-value-inline.c^M (gdb) FAIL: gdb.arch/amd64-entry-value-inline.exp: continue to breakpoint: \ break-here ... Fix this by using "gdb_remote_download host <.c file>". Tested on x86_64-linux, with host+target board local-remote-host-native.
1 parent 2d5783f commit 81a7a72

File tree

5 files changed

+35
-14
lines changed

5 files changed

+35
-14
lines changed

gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,21 @@
1414
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

1616
set opts {}
17-
standard_testfile .S
17+
standard_testfile .S .c
1818

1919
if [info exists COMPILE] {
2020
# make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-inline.exp COMPILE=1"
21-
standard_testfile
21+
standard_testfile .c .c
2222
lappend opts debug optimize=-O2
2323
} else {
2424
require is_x86_64_m64_target
2525
}
2626

27+
# Make .c available on the host.
28+
if [is_remote host] {
29+
gdb_remote_download host $srcdir/$subdir/$srcfile2
30+
}
31+
2732
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
2833
return -1
2934
}
@@ -32,8 +37,7 @@ if ![runto_main] {
3237
return -1
3338
}
3439

35-
set srcfile $testfile.c
36-
gdb_breakpoint [gdb_get_line_number "break-here"]
40+
gdb_breakpoint [gdb_get_line_number "break-here" $srcfile2]
3741

3842
gdb_continue_to_breakpoint "break-here" ".* break-here .*"
3943
gdb_test "p y" " = 25"

gdb/testsuite/gdb.arch/amd64-entry-value-param-dwarf5.exp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@ set opts {}
1818

1919
if [info exists COMPILE] {
2020
# make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-param-dwarf5.exp COMPILE=1"
21-
set srcfile ${srcfile2}
21+
standard_testfile .c .c
2222
lappend opts optimize=-O2 additional_flags=-gdwarf-5
2323
} else {
2424
require is_x86_64_m64_target
2525
}
2626

27+
# Make .c available on the host.
28+
if [is_remote host] {
29+
gdb_remote_download host $srcdir/$subdir/$srcfile2
30+
}
31+
2732
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
2833
return -1
2934
}
@@ -32,8 +37,7 @@ if ![runto_main] {
3237
return -1
3338
}
3439

35-
set srcfile $srcfile2
36-
gdb_breakpoint [gdb_get_line_number "break-here"]
40+
gdb_breakpoint [gdb_get_line_number "break-here" $srcfile2]
3741

3842
with_test_prefix "call 1" {
3943
gdb_continue_to_breakpoint "break-here" ".* break-here .*"

gdb/testsuite/gdb.arch/amd64-entry-value-param.exp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@ set opts {}
1818

1919
if [info exists COMPILE] {
2020
# make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-param.exp COMPILE=1"
21-
set srcfile ${srcfile2}
21+
standard_testfile .c .c
2222
lappend opts debug optimize=-O2
2323
} else {
2424
require is_x86_64_m64_target
2525
}
2626

27+
# Make .c available on the host.
28+
if [is_remote host] {
29+
remote_download host $srcdir/$subdir/$srcfile2
30+
}
31+
2732
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
2833
return -1
2934
}
@@ -32,8 +37,7 @@ if ![runto_main] {
3237
return -1
3338
}
3439

35-
set srcfile $srcfile2
36-
gdb_breakpoint [gdb_get_line_number "break-here"]
40+
gdb_breakpoint [gdb_get_line_number "break-here" $srcfile2]
3741

3842
with_test_prefix "call 1" {
3943
gdb_continue_to_breakpoint "break-here" ".* break-here .*"

gdb/testsuite/gdb.arch/amd64-entry-value-paramref.exp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ standard_testfile .S .cc
1717

1818
require is_x86_64_m64_target
1919

20+
# Make .cc available on the host.
21+
if [is_remote host] {
22+
gdb_remote_download host $srcdir/$subdir/$srcfile2
23+
}
24+
2025
if { [prepare_for_testing_full "failed to prepare" \
2126
[list $testfile "c++" $srcfile {}]] } {
2227
return -1
@@ -26,8 +31,7 @@ if ![runto_main] {
2631
return -1
2732
}
2833

29-
set srcfile $srcfile2
30-
gdb_breakpoint [gdb_get_line_number "break-here"]
34+
gdb_breakpoint [gdb_get_line_number "break-here" $srcfile2]
3135

3236
gdb_continue_to_breakpoint "break-here" ".* break-here .*"
3337
gdb_test "frame" {bar \(ref=@0x[0-9a-f]+: 10, ref@entry=@0x[0-9a-f]+: <optimized out>\) at .*}

gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,21 @@
1414
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

1616
set opts {}
17-
standard_testfile .S
17+
standard_testfile .S .c
1818

1919
if [info exists COMPILE] {
2020
# make check RUNTESTFLAGS="gdb.arch/amd64-tailcall-ret.exp COMPILE=1"
21-
standard_testfile
21+
standard_testfile .c .c
2222
lappend opts debug optimize=-O2
2323
} else {
2424
require is_x86_64_m64_target
2525
}
2626

27+
# Make .c available on the host.
28+
if [is_remote host] {
29+
gdb_remote_download host $srcdir/$subdir/$srcfile2
30+
}
31+
2732
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
2833
return -1
2934
}

0 commit comments

Comments
 (0)