From 7c8adf682b34f6efbd4113c83d93b31fba4c7cb0 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 11 Dec 2008 18:30:28 +0000 Subject: gdb PR macros/2564: * c-exp.y (macro_original_text, expansion_obstack, expression_macro_scope): New globals. (scan_macro_expansion): New function. (scanning_macro_expansion): Likewise. (finished_macro_expansion): Likewise. (scan_macro_cleanup): Likewise. (c_parse): Find macro scope. Initialize obstack. * c-lang.h (scan_macro_expansion, scanning_macro_expansion, finished_macro_expansion, expression_macro_lookup_func, expression_macro_lookup_baton): Remove. * c-lang.c (scan_macro_expansion, scanning_macro_expansion, finished_macro_expansion, expression_macro_lookup_func, expression_macro_lookup_baton): Remove. (macro_original_text, macro_expanded_text, c_preprocess_and_parse): Remove. (c_language_defn, cplus_language_defn, asm_language_defn, minimal_language_defn): Use c_parse. gdb/testsuite * gdb.base/macscp.exp: Print "address.addr". * gdb.base/macscp1.c (struct outer): New struct. (address): New global. --- gdb/testsuite/gdb.base/macscp.exp | 4 ++++ gdb/testsuite/gdb.base/macscp1.c | 14 ++++++++++++++ 2 files changed, 18 insertions(+) (limited to 'gdb/testsuite/gdb.base') diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp index 9cb9ef5..f7553a5 100644 --- a/gdb/testsuite/gdb.base/macscp.exp +++ b/gdb/testsuite/gdb.base/macscp.exp @@ -415,6 +415,10 @@ gdb_test "break [gdb_get_line_number "set breakpoint here"]" \ gdb_test "continue" "foo = 0;.*" "continue to macsp_expr" +gdb_test "print address.addr" \ + " = 0" \ + "print address.addr" + gdb_test "print MACRO_TO_EXPAND" \ "No symbol \"MACRO_TO_EXPAND\" in current context\." \ "print expression with macro before define." diff --git a/gdb/testsuite/gdb.base/macscp1.c b/gdb/testsuite/gdb.base/macscp1.c index 40f1217..e754b26 100644 --- a/gdb/testsuite/gdb.base/macscp1.c +++ b/gdb/testsuite/gdb.base/macscp1.c @@ -10,6 +10,20 @@ #define FORTY_EIGHT 48 #undef FORTY_EIGHT +struct outer +{ + struct fields + { + struct fault + { + int addr; + } fault; + } fields; +}; +struct outer address; + +#define addr fields.fault.addr + /* A macro named UNTIL_ is #defined until just before the definition of the function . -- cgit v1.1