From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 67DC83895FF5; Tue, 15 Nov 2022 14:25:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 67DC83895FF5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668522305; bh=bZSr7bvbHpZv5ycWF55rtZM5JBOwfI0U9bvXu7FQEW0=; h=From:To:Subject:Date:From; b=DsIJz1YmFAiGwZeNx4a3P28wz6F2f3ZiJGpAFq7wJUV7nPexoLkt5PaBXEZ1beCw/ 1d4oqHR0cSE/9y20zcMkFvBXbB3tT5/c0D1ZxjwSltYEy90bkmMfmKpNtMwpCxZAdc 0t9w4/jc+cfX4Oo7otTf28wstK//0C1rol1XZJ7g= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix gdb.base/info_sources_2.exp for remote target X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: b108c563f0f8a74813cae6b8e0e2b0089de32ba1 X-Git-Newrev: 9af7a370030a3729da4efbf26b0c746420408b3d Message-Id: <20221115142505.67DC83895FF5@sourceware.org> Date: Tue, 15 Nov 2022 14:25:05 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D9af7a370030a= 3729da4efbf26b0c746420408b3d commit 9af7a370030a3729da4efbf26b0c746420408b3d Author: Tom de Vries Date: Tue Nov 15 15:24:54 2022 +0100 [gdb/testsuite] Fix gdb.base/info_sources_2.exp for remote target =20 With test-case gdb.base/info_sources_2.exp and target board remote-gdbserver-on-localhost (using REMOTE_TARGET_USERNAME) we run int= o some failures. =20 Fix these by adding the missing gdb_load_shlib. =20 Tested on x86_64-linux. Diff: --- gdb/testsuite/gdb.base/info_sources_2.exp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gdb/testsuite/gdb.base/info_sources_2.exp b/gdb/testsuite/gdb.= base/info_sources_2.exp index f9246b8fa96..9fe3d479018 100644 --- a/gdb/testsuite/gdb.base/info_sources_2.exp +++ b/gdb/testsuite/gdb.base/info_sources_2.exp @@ -20,6 +20,8 @@ if { [skip_shlib_tests] } { return 0 } =20 +set is_remote_target [is_remote target] + standard_testfile -test.c -lib.c set solib_name [standard_output_file ${testfile}-lib.so] =20 @@ -37,6 +39,8 @@ if {[gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile= } executable \ =20 clean_restart ${binfile} =20 +set solib_name [gdb_load_shlib $solib_name] + if ![runto foo] { untested "failed to run to function foo" return -1 @@ -55,6 +59,7 @@ if ![runto foo] { # file is NOT listed for the given object file. proc run_info_sources { extra_args args } { global gdb_prompt srcdir subdir + global is_remote_target =20 with_test_prefix "args: ${extra_args}" { =20 @@ -76,6 +81,9 @@ proc run_info_sources { extra_args args } { =20 -re "^(\[^\r\n\]+):\r\n" { set objfile_name $expect_out(1,string) + if { $is_remote_target } { + set objfile_name [file tail $objfile_name] + } exp_continue } =20 @@ -129,6 +137,10 @@ proc run_info_sources { extra_args args } { # Figure out the path for SOURCEFILE that we're looking for. set sourcepath [file normalize ${srcdir}/${subdir}/${sourcefile}] =20 + if { $is_remote_target } { + set objfile [file tail $objfile] + } + # Make sure we handle the case where there are no source files # associated with a particular objfile. set source_list {}