From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 59543 invoked by alias); 20 Apr 2015 03:21:49 -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 59531 invoked by uid 89); 20 Apr 2015 03:21:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-oi0-f47.google.com Received: from mail-oi0-f47.google.com (HELO mail-oi0-f47.google.com) (209.85.218.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 20 Apr 2015 03:21:47 +0000 Received: by oift201 with SMTP id t201so115937837oif.3 for ; Sun, 19 Apr 2015 20:21:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=7M+hswoHNUJyS1IMh/Tt25wmR+rRIQeqNFbWKeiFsdw=; b=XXMcP5HEQmfO9h+4Bu2QF0QuBZlsLfK4r/YCtvc9+wr/P9xvp/Xg4hXGOPEmWXFy1m bIq7LM3kW35bU+dSYkPqXD17x/APfiyzIxNgWYO2lLGB5t04XUlbiVrQW8CkDSRp+toY Tciyi/XrpU7ugcbbx3JdQiUUQt92DBVb95+51VwnLzwwSxwOzb0H3qYFe+jJHvHWM6qw ChAnSxjMTkiextCD0KqVAJhVRbhQWZG7dDGh71LcpOxDM8Q5BSkxgCFsiYANO/0SKfpY nbHMr7IpCVOTUBLYEFC09GF50mRwvxW4V21Qy3qHkoBMRjDCS24rqnzHL6dYUXMHWE46 M5dg== X-Gm-Message-State: ALoCoQlLJbxBoGve60kDTduBO7lu+7Rz8xju5oDs5d47IFRqpcQsoRBhXFg2XmMNuJOtn58N71Zv MIME-Version: 1.0 X-Received: by 10.202.72.213 with SMTP id v204mr11795670oia.116.1429500105751; Sun, 19 Apr 2015 20:21:45 -0700 (PDT) Received: by 10.182.89.99 with HTTP; Sun, 19 Apr 2015 20:21:45 -0700 (PDT) In-Reply-To: <20150413192235.29172.13097.stgit@valrhona.uglyboxes.com> References: <20150413192235.29172.13097.stgit@valrhona.uglyboxes.com> Date: Mon, 20 Apr 2015 03:21:00 -0000 Message-ID: Subject: Re: [PATCH 00/18] Implement full completer limiting From: Doug Evans To: Keith Seitz Cc: gdb-patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00732.txt.bz2 On Mon, Apr 13, 2015 at 12:23 PM, Keith Seitz wrote: > This series of patches is essentially a rewrite of the completion API > to enable better/more consistent completion-limiting. > > Currently completer functions are not required to implement completion- > limiting. These functions will compute all possible completions and then > rely on complete_line to limit the result. > > The main goal of this patchset is to require completer functions to > implement proper completion-limiting using maybe_add_completion. This > actually cleans up the completer API significantly and fixes at least one > serious bug (an assertion failure, gdb/17960). > > The new API requires all completions to be added to the completion > list using maybe_add_completion: > > void > my_completer_function (struct completer_data *cdata, > struct cmd_list_element *cmd, > const char *text, const char *prefix) > { > while (/* there are more completions to look for */) > { > char *match = xstrdup (a_completion_match); > enum maybe_add_completion_enum add_status; > > add_status = maybe_add_completion (cdata, match); > switch (add_status) > { > case MAYBE_ADD_COMPLETION_OK: > /* Completion was added -- keep looking for more. */ > break; > case MAYBE_ADD_COMPLETION_OK_MAX_REACHED: > /* Completion was added, but now at maximum permitted completions. > Stop looking for more matches. */ > return; > case MAYBE_ADD_COMPLETION_MAX_REACHED: > /* Completion was not added; maximum permitted completions > already reached. Stop looking for more matches. */ > xfree (match); > return; > case MAYBE_ADD_COMPLETION_DUPLICATE: > /* This completion is already in the list. Keep looking for > more matches. */ > xfree (match); > break; > } > } > } > > Each patch of the set has been tested regression-free against x86_64 > linux, native and native-gdbserver. Hi. I've gone over the entire patch set. A few things I like, but there's at least one thing I'm concerned about. Replicating the above switch in each completer: IWBN to avoid such duplication. We should still be able to remove the global state and fix 17960.