From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22556 invoked by alias); 10 Apr 2014 16:27:39 -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 22542 invoked by uid 89); 10 Apr 2014 16:27:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 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; Thu, 10 Apr 2014 16:27:35 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3AGRYuF011699 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 10 Apr 2014 12:27:34 -0400 Received: from barimba (ovpn-113-179.phx2.redhat.com [10.3.113.179]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s3AGRXjT022973 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Thu, 10 Apr 2014 12:27:33 -0400 From: Tom Tromey To: Sergio Durigan Junior Cc: GDB Patches , Phil Muldoon Subject: Re: [PATCH] PR python/16699: GDB Python command completion with overriden complete vs. completer class References: Date: Thu, 10 Apr 2014 16:27:00 -0000 In-Reply-To: (Sergio Durigan Junior's message of "Wed, 12 Mar 2014 19:49:39 -0300") Message-ID: <87a9btqhe3.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2014-04/txt/msg00183.txt.bz2 >>>>> "Sergio" == Sergio Durigan Junior writes: Sergio> This PR came from a Red Hat bug that was filed recently. I checked and Sergio> it still exists on HEAD, so here's a proposed fix. Although this is Sergio> marked as a Python backend bug, this is really about the completion Sergio> mechanism used by GDB. Since this code reminds me of my first attempt Sergio> to make a good noodle, it took me quite some time to fix it in a Sergio> non-intrusive way. Thanks, Sergio. Sergio> +/* Python function called to determine the break characters of a Sergio> + certain completer. We use dummy variables for the "text" and Sergio> + "word" arguments for the completer, and call it. We're actually Sergio> + only interested in knowing if the completer registered by the user Sergio> + will return one of the integer codes (see COMPLETER_* symbols). */ Sergio> + Sergio> +static void Sergio> +cmdpy_completer_handle_brkchars (struct cmd_list_element *command) Sergio> +{ IIUC this is calling the command's complete method with some dummy strings to see what it will do. I don't think this approach will work since in general the reason to write a complete method is to be able to adapt to different arguments. That is, there's no reason to expect that passing dummy arguments will yield the same result. I didn't look deeply into the problem but is there a way to "reparse" the text when the complete method returns one of the enum values? Tom