From patchwork Wed Sep 20 16:51:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sahil Siddiq X-Patchwork-Id: 76456 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C512138582A4 for ; Wed, 20 Sep 2023 16:52:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C512138582A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1695228738; bh=oRbCKMZlrIFA7EssYYlAiKO+n3RVFltr8eISiC8ODyw=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=By78kYfCeeOWbHWbHZU9ZBwtTyHXS+EuEIGwOS0KWmkhuAvr2/pIQo8W3grmvJcqa t7ai6KPY+8fJ5zn0dzBQ+yvdeQPo62eY+U2830/68t6fuoXPnAnTsZVBaA/yaiWR0N TqlYQrlJp2sBcR2yYrBuGTxjf89x75zXMSeuCBvU= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id A87113858D1E for ; Wed, 20 Sep 2023 16:51:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A87113858D1E Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-690d8fb3b7eso1068253b3a.1 for ; Wed, 20 Sep 2023 09:51:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695228712; x=1695833512; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oRbCKMZlrIFA7EssYYlAiKO+n3RVFltr8eISiC8ODyw=; b=m6SwFH1iGiEE1Qr4bPyiErpJVxEYQG2KqT51n14Cqjfar4MLtqtVnDMXJDyhmYfXu6 TympJxF+DkPMssh4OvVwkGmeigm9PH0t6BHersDcIWESMAWESzzL9ky2ett4oPjG+iFS rgUxL3NE5tYhBcXrv2s15FNtwlw9mRhXCQtMskGJ1f6+EoUcLz2iicZh5vI4mlrh9YpD 7e3AXhdACSjXje49P25S2wrH1yH1gS0pLtRmAuJcLp3rjr8MNj9fwc/sIrU22S4IJ/eB OWtyuH5DGEJnoJDYOEGFs3UjQ5EUOqFX30IRv1T4W/Sn6F/64NuMcTNMfRGATQRH7VHL dPQg== X-Gm-Message-State: AOJu0Yx4pXUD7pSFsTd5vdBUp6Ex/MWFr6iM5I0BgVp4ICcy7QGGC6fH p6bNoHAbQONf39DW+c1YFfzPpW1Qv5Q9ew== X-Google-Smtp-Source: AGHT+IGMhY809hrWdjJdmUDHUDbjquhHg3TzLVfR8NTCDn8G/kAR1gyTRhd/24K8wMkXE20HgC9zjA== X-Received: by 2002:a05:6a21:81a7:b0:11d:4c79:90ee with SMTP id pd39-20020a056a2181a700b0011d4c7990eemr3062366pzb.25.1695228712425; Wed, 20 Sep 2023 09:51:52 -0700 (PDT) Received: from valdaarhun.localdomain ([223.233.86.126]) by smtp.gmail.com with ESMTPSA id g21-20020a62e315000000b0068c670afe30sm10428490pfh.124.2023.09.20.09.51.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 09:51:52 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Sahil Siddiq Subject: [PATCH][PR ] Fix: Trailing whitespace omitted when using "with" command Date: Wed, 20 Sep 2023 22:21:25 +0530 Message-ID: <20230920165125.1394193-1-icegambit91@gmail.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Sahil Siddiq via Gdb-patches From: Sahil Siddiq Reply-To: Sahil Siddiq Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Consider the following usage of the "complete" command ( represents a whitespace): (gdb) complete set architecture set architecture auto set architecture i386 set architecture i386:intel set architecture i386:x64-32 set architecture i386:x64-32:intel set architecture i386:x86-64 set architecture i386:x86-64:intel set architecture i8086 The trailing whitespace is not dropped. However, using the "with" command alongside "complete" drops the trailing whitespace. (gdb) with max-completions unlimited -- complete set architecture set architecture The execute_command() function in "gdb/top.c" is responsible for this. It checks if the command is "complete" or "set". If it isn't, then the trailing whitespace is cleared. The syntax of the "with" command is: with SETTING [VALUE] [-- COMMAND] Given that the "with" command is used to temporarily change the value of a setting before running a specific command, execute_command() should not clear trailing spaces until it evaluates the COMMAND to be run following the "--" delimiter. Changes: * gdb/top.c (execute_command): Fix trailing whitespace omission for "with" command. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29784 Signed-off-by: Sahil Siddiq --- gdb/top.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gdb/top.c b/gdb/top.c index 2322e55f1db..dbe528d671b 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -525,6 +525,7 @@ execute_command (const char *p, int from_tty) std::string without_whitespace; if (arg && c->type != set_cmd + && strcmp(c->name, "with") && !is_complete_command (c)) { const char *old_end = arg + strlen (arg) - 1;