From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32006 invoked by alias); 27 May 2014 15:18:06 -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 31903 invoked by uid 89); 27 May 2014 15:18:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mail-la0-f44.google.com Received: from mail-la0-f44.google.com (HELO mail-la0-f44.google.com) (209.85.215.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 27 May 2014 15:18:04 +0000 Received: by mail-la0-f44.google.com with SMTP id hr17so6637806lab.17 for ; Tue, 27 May 2014 08:18:00 -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 :content-transfer-encoding; bh=x2YT1U0QAXurQh+r4mIWNOBFCnzHwcUcByP1OxHGpCs=; b=igNOL/JvKsKo7wnAemAfA+cxuy48In4gDTfozHL5MRXfCcEzQobwAkjEgsOESNKtmi pchVlEZCI0lP0muiGQcBNtiAdOSAVNHQ9EAow6qyXzelQ+rxddJ0QluLnE5h/JPEZ9Pu uvhseFc+9wcL5S/tZ6TlylGm7HKCv3/ne/ULEAYlZYnZ1dDSXQWmpR3fwtOP+EQD7tdx iGA/XhhVLq3gum5Bz+k1YFvG9X4nLJJWYtgB9jzsBRRtzr0+PPby8FnMV7aRRv1NAITW mHQKI0TjPZVV7uwxhPO8e/MX8H39tc7csBcvIO1O//sC/V4A7uVhlApRTNqfgc0Un3yR e7Tw== X-Gm-Message-State: ALoCoQnT/Wz0zCCP+N+95eZjTw0vPUz1W1+qtGUKaBQtve6Q3brYeBa4CZejEtIYiaiwsRG6jdd3 MIME-Version: 1.0 X-Received: by 10.112.150.130 with SMTP id ui2mr2898075lbb.80.1401203880256; Tue, 27 May 2014 08:18:00 -0700 (PDT) Received: by 10.112.171.6 with HTTP; Tue, 27 May 2014 08:18:00 -0700 (PDT) In-Reply-To: References: <87tx8ks8yv.fsf@fleche.redhat.com> Date: Tue, 27 May 2014 15:18:00 -0000 Message-ID: Subject: Re: [PATCH] Add autocompletion for convenience vars in print and set From: Daniel Gutson To: Tom Tromey Cc: gdb-patches Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg00672.txt.bz2 ping for maintainer. Thanks. On Thu, May 22, 2014 at 12:17 PM, Daniel Gutson wrote: > Second version. > Comments below: > > On Tue, May 20, 2014 at 1:36 PM, Tom Tromey wrote: >>>>>>> "Daniel" =3D=3D Daniel Gutson writes: >> >> Daniel> I could not find any testsuite where to add tests for this; if >> Daniel> there are, please let me know. >> >> See testsuite/gdb.base/completion.exp > > Thanks, I ran all the tests and passed. I did not add a new test > case though since I didn't check how to add a new convenience var > and undefine it later from the test framework. (Should I try harder?) > >> >> Daniel> exp : VARIABLE >> Daniel> { >> Daniel> - write_dollar_variable (pstate, $1); >> Daniel> + if (!parse_completion) >> Daniel> + write_dollar_variable (pstate, $1); >> Daniel> } >> >> I think this isn't correct. I think it won't work if you try to >> complete on a field name where the "LHS" has a convenience variable. >> That is something like: >> >> set $var =3D (struct x *) malloc (...) >> complete print $var.somethin > > You were right, that was broken. > >> >> Instead I think you need a new production, like "exp : VARIABLE COMPLETE= ". > > I found another solution without touching the yacc file: adding a check > inside write_dollar_variable > >> >> Daniel> + if (p !=3D NULL && *p =3D=3D '$') >> Daniel> + return complete_internalvar (p + 1); >> >> I'm not sure this is correct either, but offhand I don't know. >> Should it not look at "word"? > > It actually works ("word" didn't have the $). > > However, I noticed that 'set' cmd autocomplete doesn't work for > members of structures (neither with convenience vars nor regular > symbols). I'll address that in the next patch once this gets approved > and committed. > >> >> Daniel> + VEC (char_ptr) * ret =3D current_language->la_make_symbol_com= pletion_list ( >> Daniel> + text, wor= d, >> Daniel> + TYPE_CODE= _UNDEF); >> >> No space before "ret". >> The line breaks look odd, I would break before the "=3D" and not after t= he "(". >> >> thanks, >> Tom > > 2014-05-22 Daniel Gutson > > gdb/ > * parse.c (write_dollar_variable): Do not create an internal > var when completing. > * completer.c (expression_completer): Call complete_internalvar. > * symtab.c (make_symbol_completion_list): Call complete_internalv= ar. --=20 Daniel F. Gutson Chief Engineering Officer, SPD San Lorenzo 47, 3rd Floor, Office 5 C=C3=B3rdoba, Argentina Phone: +54 351 4217888 / +54 351 4218211 Skype: dgutson