aboutsummaryrefslogtreecommitdiff
path: root/gdb/parser-defs.h
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2002-05-10 16:43:34 +0000
committerJim Blandy <jimb@codesourcery.com>2002-05-10 16:43:34 +0000
commite38354fc49399b27b6582e2d841ad9f84c01e4e9 (patch)
tree99e433e3b181e8500d4d395f19e069600c9ce20f /gdb/parser-defs.h
parent4e8e7d605075db68a0ae736e2d0356687ddeeea3 (diff)
downloadbinutils-jimb-macro-020506-branch.zip
binutils-jimb-macro-020506-branch.tar.gz
binutils-jimb-macro-020506-branch.tar.bz2
Expand preprocessor macros in C expressions.jimb-macro-020506-branch
* c-lang.h: #include "macroexp.h", for macro_lookup_ftype. (scan_macro_expansion, scanning_macro_expansion, finished_macro_expansion): New function declarations. (expression_macro_lookup_func, expression_macro_lookup_baton): New variable declarations. * parser-defs.h (expression_context_pc): New declaration. * parse.c (expression_context_pc): New variable. (parse_exp_1): Set expression_context_pc, as well as expression_context_block. * c-exp.y (yylex): If we're not already reading the result of a macro expansion, try to macro-expand the next token. When we're done scanning a macro expansion, switch back to the mainline text. Commas and `if's in a macro's expansion don't terminate the input. * c-lang.c: #include "macroscope.h" and "gdb_assert.h". (macro_original_text, macro_expanded_text, expression_macro_lookup_func, expression_macro_lookup_baton): New variables. (scan_macro_expansion, scanning_macro_expansion, finished_macro_expansion, scan_macro_cleanup, null_macro_lookup, c_preprocess_and_parse): New functions. (c_language_defn, cplus_language_defn, asm_language_defn): Call c_preprocess_and_parse, instead of c_parse. * Makefile.in (c_lang_h): Note that this #includes macroexp.h. (c-lang.o): Note dependency on macroscope.h and gdb_assert.h.
Diffstat (limited to 'gdb/parser-defs.h')
-rw-r--r--gdb/parser-defs.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index ece2849..7db1c77e 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -37,6 +37,12 @@ extern int expout_ptr;
extern struct block *expression_context_block;
+/* If expression_context_block is non-zero, then this is the PC within
+ the block that we want to evaluate expressions at. When debugging
+ C or C++ code, we use this to find the exact line we're at, and
+ then look up the macro definitions active at that point. */
+CORE_ADDR expression_context_pc;
+
/* The innermost context required by the stack and register variables
we've encountered so far. */
extern struct block *innermost_block;