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 871A23857711 for ; Wed, 16 Aug 2023 15:55:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 871A23857711 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=1692201316; 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=R4ZtOxXJXhY3hirb/ycg2d2Je76YNtEzPG4rtRMr1k0=; b=UDJkwjzYQtvW5rC1ZhmuPACDF8bteBDWatFn/bucz1cUnT2ocww6mWcBzhlq/pTSc4R1Kb jguy/3gu0a3P5tikD2DgwLTiPiVSFlUHI8LUHVvl78cg/knXwRzSIN5NIF1s7exhSKGaAj xm3POIry8BDYT192R1ALTnXJIMw8zxo= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-19-TJqTkWCOPC-angCH8mVppQ-1; Wed, 16 Aug 2023 11:55:14 -0400 X-MC-Unique: TJqTkWCOPC-angCH8mVppQ-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-94a355cf318so431185066b.2 for ; Wed, 16 Aug 2023 08:55:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692201313; x=1692806113; 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=R4ZtOxXJXhY3hirb/ycg2d2Je76YNtEzPG4rtRMr1k0=; b=imTBR12atdJMHtPMZSmEkzktjL+HomSZo+B9sSM3Ryj7MM8E6ZvdWEO42c4XYy5pUo yFKUFK2BISvOoEP/t+2wij2sFhYU1Jp9boE+4FmtMhevLC8CHuTpdCOCXmCwzKOgb50X FmKnPDJ6HUzEz8RDHLfd6UXM6wEeDH3NIDtO5WmjIui2kLFILiidm8uS6aXWtaoERFdg iDuPvMSbHiQUM8+vWxhpYzbd7XVRSUq3ngQL2wwYCdfUaSfO5RHtiP/YbZnH27jG+Pgf t64wG2rjpvIi8HlPH/JOuFMni4iv0rgGKXfku/mjQHJpjRVKNNZqNy982YEsAqy9ru9Q FiAQ== X-Gm-Message-State: AOJu0YyR7fBkrYwKuD1S46sWVjBZn9CwPShvdAjsyZMf9iltZsM5frGZ K6yp+xYQiOedQ/XSzviUOFerjPq1gv04nxnH4to1vziVdoAOPljP0v6E4gulxJfsuZWgWCcU7KO Ak2EPA5EoxTmKM6mbBUZSljeYEwIpNHY9CnVJrCxL2Z2+krrTSyR2KshcG+zovYDmf65P4qihj6 2gOp8iZQ== X-Received: by 2002:a17:906:c00f:b0:99b:e03b:3968 with SMTP id e15-20020a170906c00f00b0099be03b3968mr1580296ejz.64.1692201313431; Wed, 16 Aug 2023 08:55:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG2xEZTrLw6hO/0TVe4jgKwRJsF6nVZ5LzT4q5HkjcdTznoIagsNdykNFtXDYOLYy0OfKlsnQ== X-Received: by 2002:a17:906:c00f:b0:99b:e03b:3968 with SMTP id e15-20020a170906c00f00b0099be03b3968mr1580285ejz.64.1692201313193; Wed, 16 Aug 2023 08:55:13 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id f8-20020a17090624c800b009894b476310sm8578937ejb.163.2023.08.16.08.55.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Aug 2023 08:55:12 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH 03/10] gdb: improve show text and help text for 'remote exec-file' Date: Wed, 16 Aug 2023 16:54:59 +0100 Message-Id: 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.8 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. --- 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 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 = 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 @@ -15475,8 +15480,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