From patchwork Fri May 16 15:26:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 967 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx23.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id A64EB36007B for ; Fri, 16 May 2014 08:41:18 -0700 (PDT) Received: by homiemail-mx23.g.dreamhost.com (Postfix, from userid 14314964) id 3B60463D09549; Fri, 16 May 2014 08:41:18 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx23.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx23.g.dreamhost.com (Postfix) with ESMTPS id DF28863D32100 for ; Fri, 16 May 2014 08:41:17 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=Nevhy11BPhvmlvLlyeCxJ5Fd2ItGKl7 EaTuqzPLMPUUg3hzBqnplOfuRsbNyltM5tZfbK5sR+SmxtExdW4i4uLX4FxrhDrU NBTwBC7WjljgxTCcl6vhvEPf/9IYyy2IgwTO5KZoj5va7CiY1SqMVw56CXul2EuP taEv8/S1VQlw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=qsj52t6qKKEqbnrwJ8RRMFDNZKs=; b=lo5Zm maXypAeo4NcGsK2hQAZbeP0PwUVPpGnpghZi2lE7nAejjMVag3tPLlPg5sAAod40 x5L2ZNcJRn6N0AitJQFIZcZkhEOs8nKI1OjqCFwdmX0usvyXfla4ZFLzyLuGH6SB 32YdqzS0ZpqQdG29O+PBHICWZdE9druX6gshTk= Received: (qmail 15532 invoked by alias); 16 May 2014 15:41:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 15476 invoked by uid 89); 16 May 2014 15:41:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 May 2014 15:41:15 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4GFQgZL032687 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 16 May 2014 11:26:42 -0400 Received: from barimba.redhat.com (ovpn-113-182.phx2.redhat.com [10.3.113.182]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s4GFQcV7006849; Fri, 16 May 2014 11:26:41 -0400 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Phil Muldoon Subject: [PATCH 05/14] change how the CLI handles comments Date: Fri, 16 May 2014 09:26:26 -0600 Message-Id: <1400253995-12333-6-git-send-email-tromey@redhat.com> In-Reply-To: <1400253995-12333-1-git-send-email-tromey@redhat.com> References: <1400253995-12333-1-git-send-email-tromey@redhat.com> X-DH-Original-To: gdb@patchwork.siddhesh.in From: Phil Muldoon When using the multi-line feature, we don't want the gdb CLI to remove comments from the command list, as this will remove things like "#define". This patch moves the comment feature into command_loop to avoid this problem. 2014-05-16 Phil Muldoon * top.c (command_loop): Handle comments here... (command_line_input): ... not here. --- gdb/ChangeLog | 5 +++++ gdb/top.c | 20 +++++++------------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/gdb/top.c b/gdb/top.c index fa20025..16694e6 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -560,11 +560,14 @@ command_loop (void) make_command_stats_cleanup (1); - execute_command (command, instream == stdin); - - /* Do any commands attached to breakpoint we are stopped at. */ - bpstat_do_actions (); + /* Do not execute commented lines. */ + if (command[0] != '#') + { + execute_command (command, instream == stdin); + /* Do any commands attached to breakpoint we are stopped at. */ + bpstat_do_actions (); + } do_cleanups (old_chain); } } @@ -1057,15 +1060,6 @@ command_line_input (char *prompt_arg, int repeat, char *annotation_suffix) if (*linebuffer && input_from_terminal_p ()) add_history (linebuffer); - /* Note: lines consisting solely of comments are added to the command - history. This is useful when you type a command, and then - realize you don't want to execute it quite yet. You can comment - out the command and then later fetch it from the value history - and remove the '#'. The kill ring is probably better, but some - people are in the habit of commenting things out. */ - if (*p1 == '#') - *p1 = '\0'; /* Found a comment. */ - /* Save into global buffer if appropriate. */ if (repeat) {