From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id F2750385DC28 for ; Wed, 23 Aug 2023 11:36:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F2750385DC28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from r6.localdomain (82-217-174-174.cable.dynamic.v4.ziggo.nl [82.217.174.174]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id D64FF302BBEC; Wed, 23 Aug 2023 13:36:48 +0200 (CEST) Received: by r6.localdomain (Postfix, from userid 1000) id 98D7D3403E4; Wed, 23 Aug 2023 13:36:48 +0200 (CEST) Message-ID: <5d8bcfd72f5ea3382ddc7794b4f5a9346c71d003.camel@klomp.org> Subject: Re: [PATCH 03/10] gdb: improve show text and help text for 'remote exec-file' From: Mark Wielaard To: Andrew Burgess , gdb-patches@sourceware.org Date: Wed, 23 Aug 2023 13:36:48 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 X-Spam-Status: No, score=-3034.4 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Andrew, On Wed, 2023-08-16 at 16:54 +0100, Andrew Burgess wrote: > The current behaviour for 'show remote exec-file' is this: >=20 > (gdb) show remote exec-file >=20 > (gdb) set remote exec-file /abc > (gdb) show remote exec-file > /abc > (gdb) >=20 > The first output, the blank line, is just GDB showing the default > empty value. >=20 > This output is not really inline with GDB's more full sentence style > output, so in this commit I've updated things, the output is now: >=20 > (gdb) show remote exec-file > The remote exec-file is unset, the default remote executable will be us= ed. > (gdb) set remote exec-file /abc > (gdb) show remote exec-file > The remote exec-file is "/abc". > (gdb) >=20 > Which I think is more helpful to the user. >=20 > I have also updated the help text for this setting. Previously we had > a set/show header line, but no body text, now we have: >=20 > (gdb) help show remote exec-file > Show the remote pathname for starting inferiors. > This is the path, on the remote target, used when starting an inferior, > for example with the "run", "start", or "starti" commands. > This setting is only useful when debugging a remote target, otherwise, > this setting is not used. > (gdb) >=20 > Which is hopefully more helpful. Yes, I like this, much more helpful to the user. Reviewed-by: Mark Wielaard Tested-by: Mark Wielaard > --- > gdb/remote.c | 15 ++++++++++++--- > gdb/testsuite/gdb.base/remote-exec-file.exp | 7 +++++-- > gdb/testsuite/gdb.multi/gdb-settings.exp | 2 +- > 3 files changed, 18 insertions(+), 6 deletions(-) >=20 > diff --git a/gdb/remote.c b/gdb/remote.c > index dc5dd24797e..6a61a0e41ac 100644 > --- a/gdb/remote.c > +++ b/gdb/remote.c > @@ -1705,7 +1705,12 @@ static void > show_remote_exec_file (struct ui_file *file, int from_tty, > struct cmd_list_element *cmd, const char *value) > { > - gdb_printf (file, "%s\n", get_remote_exec_file ().c_str ()); > + const std::string &filename =3D get_remote_exec_file (); > + if (filename.empty ()) > + gdb_printf (file, _("The remote exec-file is unset, the default remo= te " > + "executable will be used.\n")); > + else > + gdb_printf (file, "The remote exec-file is \"%s\".\n", filename.c_st= r ()); > } OK. > static int > @@ -15475,8 +15480,12 @@ Transfer files to and from the remote target sys= tem."), > =20 > add_setshow_string_noescape_cmd ("exec-file", class_files, > _("\ > -Set the remote pathname for \"run\"."), _("\ > -Show the remote pathname for \"run\"."), NULL, > +Set the remote pathname for starting inferiors."), _("\ > +Show the remote pathname for starting inferiors."), _("\ > +This is the path, on the remote target, used when starting an inferior,\= n\ > +for example with the \"run\", \"start\", or \"starti\" commands.\n\ > +This setting is only useful when debugging a remote target, otherwise,\n= \ > +this setting is not used."), > set_remote_exec_file_cb, > get_remote_exec_file_cb, > show_remote_exec_file, OK. > diff --git a/gdb/testsuite/gdb.base/remote-exec-file.exp b/gdb/testsuite/= gdb.base/remote-exec-file.exp > index 0b198630a07..1411f9636be 100644 > --- a/gdb/testsuite/gdb.base/remote-exec-file.exp > +++ b/gdb/testsuite/gdb.base/remote-exec-file.exp > @@ -37,10 +37,13 @@ with_test_prefix "set inf 2" { > =20 > with_test_prefix "show inf 1" { > gdb_test "inferior 1" "Switching to inferior 1.*" > - gdb_test "show remote exec-file" "prog1" > + gdb_test "show remote exec-file" \ > + "The remote exec-file is \"prog1\"\\." > + > } > =20 > with_test_prefix "show inf 2" { > gdb_test "inferior 2" "Switching to inferior 2.*" > - gdb_test "show remote exec-file" "prog2" > + gdb_test "show remote exec-file" \ > + "The remote exec-file is \"prog2\"\\." > } OK. New expected ouput. > diff --git a/gdb/testsuite/gdb.multi/gdb-settings.exp b/gdb/testsuite/gdb= .multi/gdb-settings.exp > index e5922221d47..2432192ca9a 100644 > --- a/gdb/testsuite/gdb.multi/gdb-settings.exp > +++ b/gdb/testsuite/gdb.multi/gdb-settings.exp > @@ -90,7 +90,7 @@ foreach_with_prefix inf $inferiors { > gdb_test "show inferior-tty" "/inf${inf}-tty.*" > =20 > gdb_test "with remote exec-file tmp-value -- print 1" " =3D 1" > - gdb_test "show remote exec-file" "/inf${inf}-remote-exec" > + gdb_test "show remote exec-file" "/inf${inf}-remote-exec.*" > =20 > # If the inferiors are running check $_gdb_setting_str and > # $_gdb_setting return the correct values. OK. the .* is necessary because there is extra text to match now.