[gdb/contrib] cc-with-tweaks.sh: Create .dwz file in .tmp subdir
authorTom de Vries <tdevries@suse.de>
Sun, 29 Sep 2019 21:58:21 +0000 (23:58 +0200)
committerTom de Vries <tdevries@suse.de>
Sun, 29 Sep 2019 21:58:21 +0000 (23:58 +0200)
When running a test-case gdb.base/foo.exp with cc-with-dwz-m, a file
build/gdb/testsuite/outputs/gdb.base/foo/foo.dwz will be created, alongside
executable build/gdb/testsuite/outputs/gdb.base/foo/foo.

This can cause problems in f.i. test-cases that test file name completion.

Make these problems less likely by moving foo.dwz to a .tmp subdir:
build/gdb/testsuite/outputs/gdb.base/foo/.tmp/foo.dwz.

Tested on x86_64-linux.

gdb/ChangeLog:

2019-09-29  Tom de Vries  <tdevries@suse.de>

* contrib/cc-with-tweaks.sh (get_tmpdir): New function.
Use $tmpdir/$(basename "$output_file").dwz instead of
"${output_file}.dwz".

gdb/testsuite/ChangeLog:

2019-09-29  Tom de Vries  <tdevries@suse.de>

        * gdb.dwarf2/gdb-index.exp: Handle new location of .dwz file.

gdb/ChangeLog
gdb/contrib/cc-with-tweaks.sh
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/gdb-index.exp

index 99e4373fc22840f522116de84dae341e2f3dcc12..077b74963233b2a2e5df7c246c1e2c89bfa9b287 100644 (file)
@@ -1,3 +1,9 @@
+2019-09-29  Tom de Vries  <tdevries@suse.de>
+
+       * contrib/cc-with-tweaks.sh (get_tmpdir): New function.
+       Use $tmpdir/$(basename "$output_file").dwz instead of
+       "${output_file}.dwz".
+
 2019-09-28  Simon Marchi  <simon.marchi@polymtl.ca>
 
        PR gdb/25045
index 7df16bc6c1ca03d7acc502b81752d6bbfe5e9a4e..98c4f89afc9be60f45b44045802a9b9589bc6ca0 100755 (executable)
@@ -163,6 +163,12 @@ then
     exit 1
 fi
 
+get_tmpdir ()
+{
+    tmpdir=$(dirname "$output_file")/.tmp
+    mkdir -p "$tmpdir"
+}
+
 if [ "$want_objcopy_compress" = true ]; then
     $OBJCOPY --compress-debug-sections "$output_file"
     rc=$?
@@ -202,17 +208,19 @@ if [ "$want_dwz" = true ]; then
        ;;
     esac
 elif [ "$want_multi" = true ]; then
+    get_tmpdir
+    dwz_file=$tmpdir/$(basename "$output_file").dwz
     # Remove the dwz output file if it exists, so we don't mistake it for a
     # new file in case dwz fails.
-    rm -f "${output_file}.dwz"
+    rm -f "$dwz_file"
 
     cp $output_file ${output_file}.alt
-    $DWZ -m ${output_file}.dwz "$output_file" ${output_file}.alt > /dev/null
+    $DWZ -m "$dwz_file" "$output_file" ${output_file}.alt > /dev/null
     rm -f ${output_file}.alt
 
     # Validate dwz's work by checking if the expected output file exists.
-    if [ ! -f "${output_file}.dwz" ]; then
-       echo "$myname: dwz file ${output_file}.dwz missing."
+    if [ ! -f "$dwz_file" ]; then
+       echo "$myname: dwz file $dwz_file missing."
        exit 1
     fi
 fi
index 3dec82464555e650444cb54cc8aa586d14b71988..104303ffcafdbaab2acaa8b0e4b2ffb011813247 100644 (file)
@@ -1,3 +1,7 @@
+2019-09-29  Tom de Vries  <tdevries@suse.de>
+
+        * gdb.dwarf2/gdb-index.exp: Handle new location of .dwz file.
+
 2019-09-29  Tom de Vries  <tdevries@suse.de>
 
        * gdb.dwarf2/gdb-index.exp: Use with_test_prefix for second objcopy.
index b14e07fa55dab3ef0db3fe7314441845925d31c7..1fe993accf8c3ba804a92e262a76b97a4a33ee0f 100644 (file)
@@ -34,8 +34,10 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" \
 
 proc add_gdb_index { program } {
     set index_file ${program}.gdb-index
-    set dwz ${program}.dwz
-    set dwz_index_file ${dwz}.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
     verbose -log "index_file: ${index_file}"
     remote_file host delete ${index_file}
     remote_file host delete ${dwz_index_file}