[committed,obvious] gdb/testsuite: Adjust gdb.mi/mi-sym-info.exp filename patterns.

Message ID 6683aac8-243b-b2cc-c476-c69c0f888cba@codesourcery.com
State New
Headers show
Series
  • [committed,obvious] gdb/testsuite: Adjust gdb.mi/mi-sym-info.exp filename patterns.
Related show

Commit Message

Sandra Loosemore June 21, 2020, 3:01 a.m.
When we're running tests on a remote host, the source file gets copied 
to some location on the host file system and is compiled there, and it 
might happen that this all happens in the user's home directory (or 
whatever) on the remote host, so that no pathname prefix is present in 
the filename on the GCC command line or encoded in the debug information 
for the file.

gdb.mi/mi-sym-info.exp was written to require the filename= MI output to 
include a pathname prefix.  This patch looks a little frightening 
because of the length and complexity of the regexps, but all it's doing 
is changing the "+" to a "*" in this context to permit a bare filename. 
The fullname= part of the regexp is unchanged since we do expect a 
complete pathname there.

I've fixed this same issue in a bunch of other testcases in the past so 
I consider this one obvious enough to commit directly.

-Sandra

Patch

commit 160f8a8f32f5566077e4a4b13943bc7c70bc5da2
Author: Sandra Loosemore <sandra@codesourcery.com>
Date:   Sat Jun 20 19:37:49 2020 -0700

    Adjust gdb.mi/mi-sym-info.exp filename patterns.
    
    2020-06-20  Sandra Loosemore  <sandra@codesourcery.com>
    
    	* gdb.mi/mi-sym-info.exp: Adjust filename patterns to make directory
    	prefix optional.

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 5ae3ffa..713ec37 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@ 
 2020-06-20  Sandra Loosemore  <sandra@codesourcery.com>
 
+	* gdb.mi/mi-sym-info.exp: Adjust filename patterns to make directory
+	prefix optional.
+
+2020-06-20  Sandra Loosemore  <sandra@codesourcery.com>
+
 	* gdb.base/list-missing-source.exp: Correct $srcfile manipulation
 	for remote host.
 
diff --git a/gdb/testsuite/gdb.mi/mi-sym-info.exp b/gdb/testsuite/gdb.mi/mi-sym-info.exp
index 290fb46..859dabd 100644
--- a/gdb/testsuite/gdb.mi/mi-sym-info.exp
+++ b/gdb/testsuite/gdb.mi/mi-sym-info.exp
@@ -222,31 +222,31 @@  with_timeout_factor 2 {
 # Filter functions by name and type.
 set lineno [gdb_get_line_number "f3 (another_int_t arg)" ${srcfile2}]
 mi_gdb_test "116-symbol-info-functions --name ^f3$" \
-    "116\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]+$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"39\",name=\"f3\",type=\"int \\(another_int_t\\)\",description=\"int f3\\(another_int_t\\);\"\}\\\]\}\\\]\}" \
+    "116\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"39\",name=\"f3\",type=\"int \\(another_int_t\\)\",description=\"int f3\\(another_int_t\\);\"\}\\\]\}\\\]\}" \
     "List all functions matching pattern f3"
 
 set lineno [gdb_get_line_number "f4 (int *arg)" ${srcfile}]
 mi_gdb_test "117-symbol-info-functions --type void --name ^f4$" \
-    "117\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]+$srcfile\",fullname=\"\[^\"\]+$srcfile\",symbols=\\\[\{line=\"36\",name=\"f4\",type=\"void \\(int \\*\\)\",description=\"void f4\\(int \\*\\);\"\}\\\]\}\\\]\}" \
+    "117\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile\",fullname=\"\[^\"\]+$srcfile\",symbols=\\\[\{line=\"36\",name=\"f4\",type=\"void \\(int \\*\\)\",description=\"void f4\\(int \\*\\);\"\}\\\]\}\\\]\}" \
     "List all functions matching type void"
 
 # Filter variables by name and type.
 set lineno [gdb_get_line_number "int global_f2;" ${srcfile2}]
 mi_gdb_test "118-symbol-info-variables --name global_f2" \
-    "118\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]+$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"21\",name=\"global_f2\",type=\"int\",description=\"int global_f2;\"\}\\\]\}\\\]\}" \
+    "118\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"21\",name=\"global_f2\",type=\"int\",description=\"int global_f2;\"\}\\\]\}\\\]\}" \
     "List all variables matching pattern global_f2"
 
 set lineno1 [gdb_get_line_number "static float global_f1;" ${srcfile}]
 set lineno2 [gdb_get_line_number "static float global_f1;" ${srcfile2}]
 mi_gdb_test "119-symbol-info-variables --type float --name ^global_" \
-    "119\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]+$srcfile\",fullname=\"\[^\"\]+$srcfile\",symbols=\\\[\{line=\"25\",name=\"global_f1\",type=\"float\",description=\"static float global_f1;\"\}\\\]\},\{filename=\"\[^\"\]+$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"19\",name=\"global_f1\",type=\"float\",description=\"static float global_f1;\"\}\\\]\}\\\]\}" \
+    "119\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile\",fullname=\"\[^\"\]+$srcfile\",symbols=\\\[\{line=\"25\",name=\"global_f1\",type=\"float\",description=\"static float global_f1;\"\}\\\]\},\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"19\",name=\"global_f1\",type=\"float\",description=\"static float global_f1;\"\}\\\]\}\\\]\}" \
     "List all variables matching type float"
 
 # Fetch types, filtering by name.
 set lineno1 [gdb_get_line_number "typedef int my_int_t;" ${srcfile}]
 set lineno2 [gdb_get_line_number "typedef int another_int_t;" ${srcfile2}]
 mi_gdb_test "120-symbol-info-types --name _int_" \
-    "120\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]+$srcfile\",fullname=\"\[^\"\]+$srcfile\",symbols=\\\[\{line=\"27\",name=\"my_int_t\"\}\\\]\},\{filename=\"\[^\"\]+$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"23\",name=\"another_int_t\"\}\\\]\}\\\]\}" \
+    "120\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile\",fullname=\"\[^\"\]+$srcfile\",symbols=\\\[\{line=\"27\",name=\"my_int_t\"\}\\\]\},\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"23\",name=\"another_int_t\"\}\\\]\}\\\]\}" \
     "List all types matching _int_"
 
 # Test the --max-results parameter.
@@ -255,20 +255,20 @@  mi_gdb_test "121-symbol-info-functions --max-results 0" \
     "-symbol-info-functions --max-results 0"
 
 mi_gdb_test "122-symbol-info-functions --max-results 1 --name ^\[^_\]" \
-    "122\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]+$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"39\",name=\"f3\",type=\"int \\(another_int_t\\)\",description=\"int f3\\(another_int_t\\);\"\}\\\]\}\\\]\}" \
+    "122\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"39\",name=\"f3\",type=\"int \\(another_int_t\\)\",description=\"int f3\\(another_int_t\\);\"\}\\\]\}\\\]\}" \
     "-symbol-info-functions --max-results 1"
 
 mi_gdb_test "123-symbol-info-functions --max-results 2 --name ^\[^_\]" \
-    "123\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]+$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"33\",name=\"f2\",type=\"float \\(another_float_t\\)\",description=\"float f2\\(another_float_t\\);\"\},\{line=\"39\",name=\"f3\",type=\"int \\(another_int_t\\)\",description=\"int f3\\(another_int_t\\);\"\}\\\]\}\\\]\}" \
+    "123\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"33\",name=\"f2\",type=\"float \\(another_float_t\\)\",description=\"float f2\\(another_float_t\\);\"\},\{line=\"39\",name=\"f3\",type=\"int \\(another_int_t\\)\",description=\"int f3\\(another_int_t\\);\"\}\\\]\}\\\]\}" \
     "-symbol-info-functions --max-results 2"
 
 mi_gdb_test "124-symbol-info-variables --max-results 3 --name ^\[^_\]" \
-    "124\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]+$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"21\",name=\"global_f2\",type=\"int\",description=\"int global_f2;\"\},\{line=\"20\",name=\"global_i2\",type=\"int\",description=\"int global_i2;\"\},\{line=\"19\",name=\"global_f1\",type=\"float\",description=\"static float global_f1;\"\}\\\]\}\\\]\}" \
+    "124\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"21\",name=\"global_f2\",type=\"int\",description=\"int global_f2;\"\},\{line=\"20\",name=\"global_i2\",type=\"int\",description=\"int global_i2;\"\},\{line=\"19\",name=\"global_f1\",type=\"float\",description=\"static float global_f1;\"\}\\\]\}\\\]\}" \
 
 set s1 "\{line=\"44\",name=\"another_char_t\"\}"
 set s2 "\{line=\"24\",name=\"another_float_t\"\}"
 set s3 "\{line=\"23\",name=\"another_int_t\"\}"
 set s4 "\{line=\"45\",name=\"another_short_t\"\}"
 mi_gdb_test "125-symbol-info-types --max-results 4 --name another_" \
-    "125\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]+$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[$s1,$s2,$s3,$s4\\\]\}\\\]\}" \
+    "125\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[$s1,$s2,$s3,$s4\\\]\}\\\]\}" \
     "-symbol-info-types --max-results 4"