From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 121035 invoked by alias); 10 Aug 2018 03:05:22 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 121025 invoked by uid 89); 10 Aug 2018 03:05:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=risk, growing X-HELO: gateway34.websitewelcome.com Received: from gateway34.websitewelcome.com (HELO gateway34.websitewelcome.com) (192.185.149.13) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 10 Aug 2018 03:05:19 +0000 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 5ED2266F30 for ; Thu, 9 Aug 2018 22:05:18 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id nxjqfdppq79N3nxjqfvu7H; Thu, 09 Aug 2018 22:05:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=nkohUZHU+hOFPs7jhIZ26l7Y4hy3HtK+QWnqtpm5msc=; b=oDHOfWxFjk7Gny8W5WnPwvwoai aNBCoGOib1HhbnQAL5n661EweD2gXcufc/0niy4LFqrMq4Hgzy3SwUxqvCPLU4RGflfguTEiBKD6c OxvQz/yYba4y+4IM6N8Aye77z; Received: from 75-166-85-72.hlrn.qwest.net ([75.166.85.72]:51548 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fnxjq-0047Io-3G; Thu, 09 Aug 2018 22:05:18 -0500 From: Tom Tromey To: Tom Tromey Cc: Philippe Waroquiers , gdb-patches@sourceware.org Subject: Re: [RFA 1/2] Fix regressions for multi breakpoints command line setting/clearing References: <20180802212613.29813-1-philippe.waroquiers@skynet.be> <20180802212613.29813-2-philippe.waroquiers@skynet.be> <87sh3v1ezc.fsf@tromey.com> <87lg9gi1c4.fsf@tromey.com> <1533845999.1860.1.camel@skynet.be> <878t5fhxdl.fsf@tromey.com> Date: Fri, 10 Aug 2018 03:05:00 -0000 In-Reply-To: <878t5fhxdl.fsf@tromey.com> (Tom Tromey's message of "Thu, 09 Aug 2018 18:35:18 -0600") Message-ID: <87ftzmvs42.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2018-08/txt/msg00254.txt.bz2 >>>>> "Tom" == Tom Tromey writes: >>> if (repeat && *p1 == '\0') >>> - return saved_command_line; >>> + { >>> + xfree (buffer_finish (cmd_line_buffer)); >>> + buffer_grow_str0 (cmd_line_buffer, saved_command_line); >>> + cmd_line_buffer->used_size = 0; Philippe> I was somewhat surprised by used_size being set to 0. Philippe> I am not sure to understand in which case it is supposed to be Philippe> set to 0 : it is set to 0 in the first few lines of handle_line_of_input Philippe> with a comment explaining why. Philippe> I however do not understand why it is set to the string length in Philippe> the 'Do history expansion' case, and not to 0 : as far as I can see, Philippe> cmd will be returned as a full line in case of expansion ? Tom> Thanks for noticing this. Tom> I suspect the history case (which doesn't seem to be tested...) is just Tom> wrong and should also set the used size to 0. I think we both misread this, because the history expansion case does: xfree (buffer_finish (cmd_line_buffer)); cmd_line_buffer->buffer = history_value; cmd_line_buffer->buffer_size = len + 1; ... which does not change used_size. So, I think all the cases are behaving properly. Tom> I'll see if I can come up with a test case here. I'm still going to write a history expansion test, because there should be at least one. Philippe> So, I am wondering what kind of usage of this function Philippe> will make the buffer bigger. Maybe worth pointing at the Philippe> above risk then ? Tom> I can add a comment somewhere. Actually I don't think there is a problem here. The growing case, I think, can only happen with continuation lines. Otherwise the buffer is stable -- I think, provided we don't reenter the command loop -- for the duration of the command. Tom