Batons? Was: RFC: C/C++ preprocessor macro support for GDB
Andrew Cagney
ac131313@cygnus.com
Mon Mar 18 12:55:00 GMT 2002
> 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
More information about the Gdb-patches
mailing list