From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4123 invoked by alias); 18 Mar 2002 20:55:31 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 3936 invoked from network); 18 Mar 2002 20:55:28 -0000 Received: from unknown (HELO localhost.redhat.com) (24.112.135.44) by sources.redhat.com with SMTP; 18 Mar 2002 20:55:28 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 9F1883ED3; Mon, 18 Mar 2002 15:55:17 -0500 (EST) Message-ID: <3C965435.9040302@cygnus.com> Date: Mon, 18 Mar 2002 12:55:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:0.9.8) Gecko/20020210 X-Accept-Language: en-us MIME-Version: 1.0 To: Jim Blandy Cc: gdb-patches@sources.redhat.com Subject: Re: Batons? Was: RFC: C/C++ preprocessor macro support for GDB References: <20020317062306.CC96D5E9DE@zwingli.cygnus.com> <3C96094E.8090407@cygnus.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-03/txt/msg00325.txt.bz2 > The GDB macro patch only uses one kind of baton: > > + /* A function for looking up preprocessor macro definitions. Return > + the preprocessor definition of NAME in scope according to BATON, or > + zero if NAME is not defined as a preprocessor macro. > + > + The caller must not free or modify the definition returned. It is > + probably unwise for the caller to hold pointers to it for very > + long; it probably lives in some objfile's obstacks. */ > + typedef struct macro_definition *(macro_lookup_ftype) (const char *name, > + void *baton); > + > + > + /* Expand any preprocessor macros in SOURCE, and return the expanded > + text. Use LOOKUP_FUNC and LOOKUP_FUNC_BATON to find identifiers' > + preprocessor definitions. SOURCE is a null-terminated string. The > + result is a null-terminated string, allocated using xmalloc; it is > + the caller's responsibility to free it. */ > + char *macro_expand (const char *source, > + macro_lookup_ftype *lookup_func, > + void *lookup_func_baton); > > Since this would be the only use of the term "baton" in the entire > source tree, it's not exactly helping people understand things more > there. In the Subversion code base, things are different, since it's > widely used. The dwarf2 expression stuff contained the word. It is this second occurance that caught my eye and got me wondering :-) > I'm open to suggestions. If folks think it's too cutesy, I'll change > it to whatever they want. For the same situtation, bfd's map_over_sections uses ``obj''. GDB is similar, catch_exceptions has ``func, func_args'', ui_file_put has ``write, dest''. Objects are described has having ``state'' or ``context''. enjoy, Andrew