From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id F29E63858CDA for ; Mon, 27 Mar 2023 11:59:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F29E63858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0C8FB21E7E for ; Mon, 27 Mar 2023 11:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1679918340; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MOv++fAwtXSfLqnFNk8QA9ATUf5e65tpDB4y+ME2UZw=; b=auhUmhbOOGvphXwC0aWwgHVkOfaIhIdzAXI3/n6wyanXsR0m8f+vruDrtpbYoXJCC2PmH6 E12/cUEcOsIJMaDG7sw7Q0N4MGWGOnKv+jE41PKfpSvrYZoZm1JoQUPVCptjfcSvB59QSq xYvonPE2Wq4M6PzqBJzXAh7SPC69o9c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1679918340; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MOv++fAwtXSfLqnFNk8QA9ATUf5e65tpDB4y+ME2UZw=; b=bidW4CJu0u/24rGRFNx7tUX4FuqR6Zi4u24lt3iZsqDQOT5Ice67v3UBSptb4L+vDHoJEp E7V7uGbA46ZGIVBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id ECEEE138ED for ; Mon, 27 Mar 2023 11:58:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gCu8OAOFIWTCOgAAMHmgww (envelope-from ) for ; Mon, 27 Mar 2023 11:58:59 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [pushed 06/10] [gdb/testsuite] Fix gdb.dwarf2/gdb-index.exp on remote host Date: Mon, 27 Mar 2023 13:58:54 +0200 Message-Id: <20230327115858.5950-7-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230327115858.5950-1-tdevries@suse.de> References: <20230327115858.5950-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Fix test-case gdb.dwarf2/gdb-index.exp on remote host using gdb_remote_download and host_standard_output_file. Also declare the test-case unsupported with readnow. Tested on x86_64-linux. --- gdb/testsuite/gdb.dwarf2/gdb-index.exp | 36 +++++++++++++++++++------- gdb/testsuite/lib/gdb.exp | 7 ++++- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/gdb/testsuite/gdb.dwarf2/gdb-index.exp b/gdb/testsuite/gdb.dwarf2/gdb-index.exp index 8a12e35f353..c28f45c5e5c 100644 --- a/gdb/testsuite/gdb.dwarf2/gdb-index.exp +++ b/gdb/testsuite/gdb.dwarf2/gdb-index.exp @@ -18,6 +18,9 @@ load_lib dwarf.exp # This test can only be run on targets which support DWARF-2. require dwarf2_support +# Can't save an index with readnow. +require !readnow + standard_testfile main.c if { [prepare_for_testing "failed to prepare" "${testfile}" \ @@ -32,16 +35,17 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" \ # Use local prefix to prevent overriding add_gdb_index from lib/gdb.exp. proc local_add_gdb_index { program } { - set index_file ${program}.gdb-index - set dir [file dirname ${program}] set filename [file tail ${program}] - set dwz $dir/.tmp/${filename}.dwz - set dwz_index_file $program.dwz.gdb-index + set host_program [gdb_remote_download host $program] + set index_file [host_standard_output_file $filename.gdb-index] + set tmpdir [host_standard_output_file .tmp] + set dwz $tmpdir/$filename.dwz + set dwz_index_file [host_standard_output_file $filename.dwz.gdb-index] verbose -log "index_file: ${index_file}" remote_file host delete ${index_file} remote_file host delete ${dwz_index_file} gdb_test_no_output "save gdb-index [file dirname ${index_file}]" \ - "save gdb-index for file [file tail ${program}]" + "save gdb-index for file $filename" # No point in continuing if generating the index failed. # N.B.: There are times when gdb won't create an index, and it's not a @@ -55,8 +59,16 @@ proc local_add_gdb_index { program } { return "" } - set program_with_index ${program}.with-index - if {[run_on_host "objcopy" [gdb_find_objcopy] "--remove-section .gdb_index --add-section .gdb_index=$index_file --set-section-flags .gdb_index=readonly ${program} ${program_with_index}"]} { + set host_program_with_index $host_program.with-index + set program_with_index $program.with-index + if {[run_on_host "objcopy" [gdb_find_objcopy] \ + [join \ + [list \ + "--remove-section .gdb_index" \ + "--add-section .gdb_index=$index_file" \ + "--set-section-flags .gdb_index=readonly" \ + "$host_program" \ + "$host_program_with_index"]]]} { return "" } @@ -73,7 +85,9 @@ proc local_add_gdb_index { program } { } } - return ${program_with_index} + return [list \ + [remote_upload host $host_program_with_index $program_with_index] \ + $host_program_with_index] } # Build a copy of the program with an index (.gdb_index/.debug_names). @@ -84,12 +98,14 @@ set test "check if index present" gdb_test_multiple "mt print objfiles ${testfile}" $test { -re "gdb_index.*${gdb_prompt} $" { set binfile_with_index $binfile + set host_binfile_with_index [gdb_remote_download host $binfile] } -re "debug_names.*${gdb_prompt} $" { set binfile_with_index $binfile + set host_binfile_with_index [gdb_remote_download host $binfile] } -re "(Psymtabs|Cooked).*${gdb_prompt} $" { - set binfile_with_index [local_add_gdb_index $binfile] + lassign [local_add_gdb_index $binfile] binfile_with_index host_binfile_with_index if { ${binfile_with_index} == "" } { return -1 } @@ -114,7 +130,7 @@ gdb_test "mt print objfiles ${testfile}" \ # Is touch portable enough? # First make sure enough time has passed, file mtime resolution is seconds. gdb_test_no_output "shell sleep 1" -if {[run_on_host "touch binary" touch ${binfile_with_index}]} { +if {[run_on_host "touch binary" touch $host_binfile_with_index]} { return -1 } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 2cf128fdd68..39ed5ad761b 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -6412,7 +6412,12 @@ proc standard_output_file {basename} { proc host_standard_output_file { basename } { if { [is_remote host] } { - return $basename + set remotedir [board_info host remotedir] + if { $remotedir == "" } { + return $basename + } else { + return [join [list $remotedir $basename] "/"] + } } else { return [standard_output_file $basename] } -- 2.35.3