From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 566DE38582BC for ; Fri, 25 Aug 2023 15:34:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 566DE38582BC Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692977694; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QV2LP6x3+Fyy+SMH4Q1llMwc8s4flgz4lR4z/ZzYrpI=; b=C5ugATvYqaS1iQJTdbVZPs0tWyJV3In7wteVuqtynOgZygB2T/LmgE+GjnOXpYdJ0M7WQT XfqBKKCDoJBuDeqGmoIlxaa0EEMa1Zh4PHcdrTbfdyAEGXYXx/vLjImNBuMScg4jWn9jrf 5K2ZEHieGK0JYcMWuqqxjQqCMYqREyg= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-439-QULUqLULNzmz7-FT9RJ8lg-1; Fri, 25 Aug 2023 11:34:53 -0400 X-MC-Unique: QULUqLULNzmz7-FT9RJ8lg-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-3fe4cca36b7so7623705e9.3 for ; Fri, 25 Aug 2023 08:34:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692977692; x=1693582492; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QV2LP6x3+Fyy+SMH4Q1llMwc8s4flgz4lR4z/ZzYrpI=; b=hwZP8DpiRAOEJXENgu7/4OicuRwhTWQg4ml8OVLfUE2q/eh6Ml3KN4jzgr3WimrwlR lk0gWaT6Vl4EycvmOfNaoWC1yeyTMGYXpSAmwwtfzmD6lkrX57GzHAMfYmZOhk9HEFQQ +kkcb3I94hlkCxax4PClaK4fQlq89s3UYGT4O5XzjG1CLYSrlk/BoIDYirVBl6+V4sfb So7kIuJ6OnC4A4ULw48RPhEYtZAoPZ/y5U6d6IJZVlrFwNNsEvuBLwt/XEzln8daYE/K c588+8YLq8Q+LwF2wqg9BaGivaR/GsukKLBS818f1HfjlZitfcc0U0lpEf01DMC0I6Ns ftUA== X-Gm-Message-State: AOJu0Yxeh+Ja5u8hQoiRFY2ri6sjUIUqTPib2M0UIcSNXEVuZA+UbLsq me1JCPDPD5n3k8udsUoWKeDWxUl0ytcchOCJoGfMwOdhpxKsp1O6bdWb/PVCd2gpHJ7cQpgPBr0 Y0GO3Huqg2jY9gL2Av+FtTi45A2HPt9hhecRkFfqoOp6MwSUYwXR3p9RlDxwsyp5b2yz5MzbPos TSg//swg== X-Received: by 2002:a1c:790e:0:b0:3fe:1232:93fa with SMTP id l14-20020a1c790e000000b003fe123293famr15257833wme.22.1692977691968; Fri, 25 Aug 2023 08:34:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHtQXJCnOFcQS7coxql90Bf4G4EQBxEka3QX6ix2gn/qACS1mHGbxrDq3yMTeKyPrpoCFATtQ== X-Received: by 2002:a1c:790e:0:b0:3fe:1232:93fa with SMTP id l14-20020a1c790e000000b003fe123293famr15257814wme.22.1692977691609; Fri, 25 Aug 2023 08:34:51 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id n17-20020a1c7211000000b003feef5b0baesm5657947wmc.26.2023.08.25.08.34.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 08:34:51 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess , Mark Wielaard Subject: [PATCHv2 03/10] gdb: improve show text and help text for 'remote exec-file' Date: Fri, 25 Aug 2023 16:34:36 +0100 Message-Id: <643d6471e884bd9316b2fbd808a257a4602aa31a.1692977354.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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: The current behaviour for 'show remote exec-file' is this: (gdb) show remote exec-file (gdb) set remote exec-file /abc (gdb) show remote exec-file /abc (gdb) The first output, the blank line, is just GDB showing the default empty value. 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: (gdb) show remote exec-file The remote exec-file is unset, the default remote executable will be used. (gdb) set remote exec-file /abc (gdb) show remote exec-file The remote exec-file is "/abc". (gdb) Which I think is more helpful to the user. 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: (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) Which is hopefully more helpful. 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(-) diff --git a/gdb/remote.c b/gdb/remote.c index 8a3bb629837..1d40e3cf746 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 = get_remote_exec_file (); + if (filename.empty ()) + gdb_printf (file, _("The remote exec-file is unset, the default remote " + "executable will be used.\n")); + else + gdb_printf (file, "The remote exec-file is \"%s\".\n", filename.c_str ()); } static int @@ -15479,8 +15484,12 @@ Transfer files to and from the remote target system."), 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, 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" { 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\"\\." + } 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\"\\." } 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.*" gdb_test "with remote exec-file tmp-value -- print 1" " = 1" - gdb_test "show remote exec-file" "/inf${inf}-remote-exec" + gdb_test "show remote exec-file" "/inf${inf}-remote-exec.*" # If the inferiors are running check $_gdb_setting_str and # $_gdb_setting return the correct values. -- 2.25.4