From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20538 invoked by alias); 16 May 2014 19:12:50 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 20339 invoked by uid 89); 16 May 2014 19:12:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.3 required=5.0 tests=AWL,BAYES_50,KAM_STOCKGEN,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=no 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 19:12:47 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s4GJCjQL029085 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 16 May 2014 15:12:46 -0400 Received: from stumpy.slc.redhat.com (ovpn-113-20.phx2.redhat.com [10.3.113.20]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s4GJCjW6030901; Fri, 16 May 2014 15:12:45 -0400 Message-ID: <5376632D.3000409@redhat.com> Date: Fri, 16 May 2014 19:12:00 -0000 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Tom Tromey , gcc-patches@gcc.gnu.org Subject: Re: [PATCH 3/5] introduce the binding oracle References: <1400254001-12038-1-git-send-email-tromey@redhat.com> <1400254001-12038-4-git-send-email-tromey@redhat.com> In-Reply-To: <1400254001-12038-4-git-send-email-tromey@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg01331.txt.bz2 On 05/16/14 09:26, Tom Tromey wrote: > gdb wants to supply any declarations that may be referred to by the > user's code. Hooking into symbol lookup was an efficient way to > accomplish this. > > This patch introducing a "binding oracle" that is consulted whenever a > symbol binding is looked up for the first time. The oracle is just a > global function pointer. If it is NULL, no special work is done. It > is called with the identifier to supply and with an enum argument > indicating the kind of binding being requested. The oracle can then > call back into the C front end (via the new functions c_pushtag and > c_bind) to supply a binding; or it can silently do nothing if the > request could not be fulfilled. > > The code caches Whether the oracle has been called to avoid repeated > useless queries. > > There is a little hack in c_print_identifier to avoid calling the > binding oracle here. This makes debugging gcc in the presence of the > plugin remain relatively sane -- without this, calling debug_tree or > the like can confusingly call into the plugin. > > 2014-05-16 Phil Muldoon > Tom Tromey > > * c-tree.h (enum c_oracle_request): New. > (c_binding_oracle_function): New typedef. > (c_binding_oracle, c_pushtag, c_bind): Declare. > * c-decl.c (c_binding_oracle): New global. > (I_SYMBOL_CHECKED): New macro. > (i_symbol_binding): New function. > (I_SYMBOL_BINDING, I_SYMBOL_DECL): Redefine. > (I_TAG_CHECKED): New macro. > (i_tag_binding): New function. > (I_TAG_BINDING, I_TAG_DECL): Redefine. > (I_LABEL_CHECKED): New macro. > (i_label_binding): New function. > (I_LABEL_BINDING, I_LABEL_DECL): Redefine. > (c_print_identifier): Save and restore c_binding_oracle. > (c_pushtag, c_bind): New functions. > --- > void > c_print_identifier (FILE *file, tree node, int indent) > { > + void (*save) (enum c_oracle_request, tree identifier); > + > + // This makes debugging much more sane. > + save = c_binding_oracle; > + c_binding_oracle = NULL; > + Just a nit. C-style comment would be appreciated. It might also help to clarify what "much more sane" really means here. Otherwise, it looks OK to me. jeff