[binutils-gdb] [gdb/testsuite] Remove superfluous pid in temp files

Tom de Vries vries@sourceware.org
Mon Mar 27 09:35:30 GMT 2023


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=16fbc917fa85a89c733ffa896b6612333bd3b50f

commit 16fbc917fa85a89c733ffa896b6612333bd3b50f
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Mar 27 11:35:26 2023 +0200

    [gdb/testsuite] Remove superfluous pid in temp files
    
    While trying to use gdb_can_simple_compile with a d program, I ran into:
    ...
    /data/vries/gdb/f37/build/gdb/testsuite/temp/105856/can_compile_d-105856.d: \
      error: module 'can_compile_d-105856' has non-identifier characters in \
      filename, use module declaration instead
    ...
    
    The d compiler has a problem with the filename can_compile_d-105856.d, which
    contains the pid.  The pid is added by gdb_simple_compile:
    ...
        set obj [standard_temp_file $name-[pid].$postfix]
    ...
    but it's unnecessary because standard_temp_file already uses the pid.
    
    Fix this by removing "[pid]" in all calls to standard_temp_file.
    
    Tested on x86_64-linux.

Diff:
---
 gdb/testsuite/lib/dwarf.exp |  2 +-
 gdb/testsuite/lib/gdb.exp   | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index 8b0cf77412d..434495df24a 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -294,7 +294,7 @@ proc shared_gdb_start_use { src options } {
     }
 
     if { $do_start } {
-	set exe [standard_temp_file func_addr[pid].x]
+	set exe [standard_temp_file func_addr.x]
 
 	gdb_compile $src $exe executable $options
 
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 3cfe22b32cd..f8046ffe84d 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4579,8 +4579,8 @@ gdb_caching_proc universal_compile_options {} {
     set me "universal_compile_options"
     set options {}
 
-    set src [standard_temp_file ccopts[pid].c]
-    set obj [standard_temp_file ccopts[pid].o]
+    set src [standard_temp_file ccopts.c]
+    set obj [standard_temp_file ccopts.o]
 
     gdb_produce_source $src {
 	int foo(void) { return 0; }
@@ -4635,8 +4635,8 @@ proc gdb_simple_compile {name code {type object} {compile_flags {}} {object obj}
 	    break
 	}
     }
-    set src [standard_temp_file $name-[pid].$ext]
-    set obj [standard_temp_file $name-[pid].$postfix]
+    set src [standard_temp_file $name.$ext]
+    set obj [standard_temp_file $name.$postfix]
     set compile_flags [concat $compile_flags {debug nowarnings quiet}]
 
     gdb_produce_source $src $code
@@ -7011,8 +7011,8 @@ gdb_caching_proc allow_float_test {} {
 
 	# Set up, compile, and execute a test program having VFP
 	# operations.
-	set src [standard_temp_file arm_vfp[pid].c]
-	set exe [standard_temp_file arm_vfp[pid].x]
+	set src [standard_temp_file arm_vfp.c]
+	set exe [standard_temp_file arm_vfp.x]
 
 	gdb_produce_source $src {
 	    int main() {


More information about the Gdb-cvs mailing list