From: Tom de Vries <tdevries@suse.de>
To: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Subject: [PATCH][gdb/testsuite] Remove path names from error messages in gdb_file_cmd
Date: Thu, 4 Jun 2020 17:14:13 +0200 [thread overview]
Message-ID: <664564b0-52b6-d20f-c43e-7ba621b71975@suse.de> (raw)
In-Reply-To: <6bb39ac8-7e7b-a410-2350-40f5aa0cf617@suse.de>
[-- Attachment #1: Type: text/plain, Size: 490 bytes --]
[ was: Re: [committed][gdb/testsuite] Fix use of fail in gdb_cmd_file ]
On 04-06-2020 16:18, Tom de Vries wrote:
> [ was: Re: [PATCH][gdb/testsuite] Fix PATH error in gdb_file_cmd ]
>
> On 04-06-2020 15:22, Pedro Alves wrote:
>> On 6/4/20 2:05 PM, Tom de Vries wrote:
>> (That leaves the open question of whether we want to include the
>> full paths in the ERROR, but that can be seen as an orthogonal issue
>> if you'd like.)
>
> Yes, I'd prefer that.
>
How about this?
Thanks,
- Tom
[-- Attachment #2: 0001-gdb-testsuite-Remove-path-names-from-error-messages-in-gdb_file_cmd.patch --]
[-- Type: text/x-patch, Size: 2845 bytes --]
[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.
---
gdb/testsuite/lib/gdb.exp | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 3cdaefaa9c..9a0620a2bf 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
}
}
next prev parent reply other threads:[~2020-06-04 15:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-04 10:24 [PATCH][gdb/testsuite] Fix PATH error " Tom de Vries
2020-06-04 10:45 ` [gdb/testsuite] Fix error handling " Tom de Vries
2020-06-04 11:51 ` Pedro Alves
2020-06-04 14:38 ` Tom de Vries
2020-06-04 11:43 ` [PATCH][gdb/testsuite] Fix PATH error " Pedro Alves
2020-06-04 11:51 ` Tom de Vries
2020-06-04 12:18 ` Pedro Alves
2020-06-04 13:05 ` Tom de Vries
2020-06-04 13:22 ` Pedro Alves
2020-06-04 14:18 ` [committed][gdb/testsuite] Fix use of fail in gdb_cmd_file Tom de Vries
2020-06-04 15:14 ` Tom de Vries [this message]
2020-06-04 15:27 ` [PATCH][gdb/testsuite] Remove path names from error messages in gdb_file_cmd Pedro Alves
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=664564b0-52b6-d20f-c43e-7ba621b71975@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/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