public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/testsuite] Remove path names from error messages in gdb_file_cmd
@ 2020-06-04 15:37 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2020-06-04 15:37 UTC (permalink / raw)
  To: gdb-cvs

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

commit 1c07a73f66382eb0c95132aaf9690621fdce1e78
Author: Tom de Vries <tdevries@suse.de>
Date:   Thu Jun 4 17:37:53 2020 +0200

    [gdb/testsuite] Remove path names from error messages in gdb_file_cmd
    
    In gdb_file_cmd, perror is called with error message strings using $arg and
    $GDB, both of which contain path names, which makes comparison of gdb.sum
    files more difficult.
    
    Fix this by using:
    - [file tail $arg] instead of $arg
    - GDB instead of $GDB.
    
    Tested on x86_64-linux.
    
    gdb/testsuite/ChangeLog:
    
    2020-06-04  Tom de Vries  <tdevries@suse.de>
    
            * lib/gdb.exp (gdb_file_cmd): Avoid path names in error messages.

Diff:
---
 gdb/testsuite/ChangeLog   |  4 ++++
 gdb/testsuite/lib/gdb.exp | 18 +++++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 9d979382c36..cfdd6a6efef 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2020-06-04  Tom de Vries  <tdevries@suse.de>
+
+	* lib/gdb.exp (gdb_file_cmd): Avoid path names in error messages.
+
 2020-06-04  Tom de Vries  <tdevries@suse.de>
 
 	* lib/gdb.exp (gdb_file_cmd): Replace incomplete gdb_expect by
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 3cdaefaa9cd..9a0620a2bf1 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1762,6 +1762,7 @@ proc gdb_file_cmd { arg } {
 
     send_gdb "file $arg\n"
     set new_symbol_table 0
+    set basename [file tail $arg]
     gdb_expect 120 {
 	-re "Reading symbols from.*LZMA support was disabled.*$gdb_prompt $" {
 	    verbose "\t\tLoaded $arg into $GDB; .gnu_debugdata found but no LZMA available"
@@ -1780,36 +1781,39 @@ proc gdb_file_cmd { arg } {
         }
         -re "Load new symbol table from \".*\".*y or n. $" {
 	    if { $new_symbol_table > 0 } {
-		perror "Couldn't load $arg, interactive prompt loop detected."
+		perror [join [list "Couldn't load $basename,"
+			      "interactive prompt loop detected."]]
 		return -1
 	    }
             send_gdb "y\n" answer
 	    incr new_symbol_table
-	    set arg "$arg -- with new symbol table"
+	    set suffix "-- with new symbol table"
+	    set arg "$arg $suffix"
+	    set basename "$basename $suffix"
 	    exp_continue
 	}
         -re "No such file or directory.*$gdb_prompt $" {
-            perror "($arg) No such file or directory"
+            perror "($basename) No such file or directory"
 	    return -1
         }
 	-re "A problem internal to GDB has been detected" {
-	    perror "Couldn't load $arg into $GDB (GDB internal error)."
+	    perror "Couldn't load $basename into GDB (GDB internal error)."
 	    gdb_internal_error_resync
 	    return -1
 	}
         -re "$gdb_prompt $" {
-            perror "Couldn't load $arg into $GDB."
+            perror "Couldn't load $basename into GDB."
 	    return -1
             }
         timeout {
-            perror "Couldn't load $arg into $GDB (timeout)."
+            perror "Couldn't load $basename into GDB (timeout)."
 	    return -1
         }
         eof {
             # This is an attempt to detect a core dump, but seems not to
             # work.  Perhaps we need to match .* followed by eof, in which
             # gdb_expect does not seem to have a way to do that.
-            perror "Couldn't load $arg into $GDB (eof)."
+            perror "Couldn't load $basename into GDB (eof)."
 	    return -1
         }
     }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-04 15:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-04 15:37 [binutils-gdb] [gdb/testsuite] Remove path names from error messages in gdb_file_cmd Tom de Vries

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).