public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Fix gdb.dwarf2/fission-relative-dwo.exp with cc-with-gdb-index
Date: Mon, 2 Aug 2021 15:32:39 +0200	[thread overview]
Message-ID: <20210802133237.GA8551@delia> (raw)

Hi,

When running with target board cc-with-gdb-index, we run into:
...
gdb compile failed, warning: Could not find DWO CU \
  fission-relative-dwo.dwo(0x1234) referenced by CU at offset 0xc7 \
  [in module outputs/gdb.dwarf2/fission-relative-dwo/.tmp/fission-relative-dwo]
UNTESTED: gdb.dwarf2/fission-relative-dwo.exp: fission-relative-dwo.exp
ERROR: failed to compile fission-relative-dwo
...

The problem is that:
- the .dwo file is found relative to the executable, and
- cc-with-tweaks.sh moves the executable to a temp dir, but not
  the .dwo file.

Fix this by copying the .dwo file alongside the executable in the temp dir.

Verified changes using shellcheck.

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix gdb.dwarf2/fission-relative-dwo.exp with cc-with-gdb-index

gdb/ChangeLog:

2021-08-02  Tom de Vries  <tdevries@suse.de>

	* contrib/cc-with-tweaks.sh: Copy .dwo files alongside executable.

---
 gdb/contrib/cc-with-tweaks.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gdb/contrib/cc-with-tweaks.sh b/gdb/contrib/cc-with-tweaks.sh
index 8653dfb260e..0d244dbdcb7 100755
--- a/gdb/contrib/cc-with-tweaks.sh
+++ b/gdb/contrib/cc-with-tweaks.sh
@@ -179,6 +179,19 @@ fi
 if [ "$want_index" = true ]; then
     get_tmpdir
     mv "$output_file" "$tmpdir"
+    output_dir=$(dirname "$output_file")
+
+    # Copy .dwo file alongside, to fix gdb.dwarf2/fission-relative-dwo.exp.
+    # Use copy instead of move to not break
+    # rtf=gdb.dwarf2/fission-absolute-dwo.exp.
+    dwo_pattern="$output_dir/*.dwo"
+    for f in $dwo_pattern; do
+	if [ "$f" = "$dwo_pattern" ]; then
+	    break
+	fi
+	cp "$f" "$tmpdir"
+    done
+
     tmpfile="$tmpdir/$(basename $output_file)"
     # Filter out these messages which would stop dejagnu testcase run:
     # echo "$myname: No index was created for $file" 1>&2
@@ -187,6 +200,7 @@ if [ "$want_index" = true ]; then
 	| grep -v "^${GDB_ADD_INDEX##*/}: " >&2
     rc=${PIPESTATUS[0]}
     mv "$tmpfile" "$output_file"
+    rm -f "$tmpdir"/*.dwo
     [ $rc != 0 ] && exit $rc
 fi
 

                 reply	other threads:[~2021-08-02 13:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210802133237.GA8551@delia \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).