diff options
author | Tom Tromey <tromey@redhat.com> | 2008-07-18 20:55:33 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2008-07-18 20:55:33 +0000 |
commit | d7d9f01ea18f14a9a1574042bd65dd73f9b6b2b8 (patch) | |
tree | 350b57eb105730c6e52b961f7c55b0821f6b222e /gdb/testsuite | |
parent | a9dc948127c2cb5127cec5ca87dbc19f17dd16cf (diff) | |
download | fsf-binutils-gdb-d7d9f01ea18f14a9a1574042bd65dd73f9b6b2b8.zip fsf-binutils-gdb-d7d9f01ea18f14a9a1574042bd65dd73f9b6b2b8.tar.gz fsf-binutils-gdb-d7d9f01ea18f14a9a1574042bd65dd73f9b6b2b8.tar.bz2 |
gdb
PR gdb/855:
* NEWS: Add entry for macro commands.
* Makefile.in (macrocmd.o): Add gdb_string.h.
* macroscope.h (user_macro_scope): Declare.
(default_macro_scope): Update documentation.
(macro_user_macros): Declare.
* c-lang.c (c_preprocess_and_parse): Always attempt macro lookup.
Use user_macro_scope.
(null_macro_lookup): Remove.
* macrotab.h (macro_callback_fn): Declare.
(macro_for_each): Likewise.
(macro_allow_redefinitions): Likewise.
* macrotab.c (foreach_macro): New function
(macro_for_each): Likewise.
(struct macro_table) <redef_ok>: New field.
(macro_allow_redefinitions): New function.
(new_macro_table): Update.
(macro_define_function): Likewise.
(macro_define_object): Likewise.
* macroscope.c (user_macro_scope): New function.
(default_macro_scope): Use it.
(macro_user_macros): New global.
(standard_macro_lookup): Look in macro_user_macros.
(_initialize_macroscope): New function.
* macroexp.h (macro_is_whitespace, macro_is_digit,
macro_is_identifier_nondigit): Declare.
* macroexp.c (macro_is_whitespace): Rename. No longer static.
(macro_is_digit): Likewise.
(macro_is_identifier_nondigit): Likewise.
(get_identifier): Update.
(get_pp_number): Likewise.
(get_token): Likewise.
* macrocmd.c (skip_ws): New function.
(extract_identifier): Likewise.
(free_macro_definition_ptr): Likewise.
(user_macros): Remove.
(macro_define_command): Implement.
(_initialize_macrocmd): Update.
(macro_undef_command): Implement.
(print_one_macro): New function.
(macro_list_command): Implement.
gdb/doc
* gdb.texinfo (Macros): Update. Use @code rather than @command.
gdb/testsuite
* gdb.base/macscp.exp: Add macro tests.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/macscp.exp | 44 |
2 files changed, 48 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index adcadd7..1a07bc1 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2008-07-18 Tom Tromey <tromey@redhat.com> + + * gdb.base/macscp.exp: Add macro tests. + 2008-07-17 Paul Pluzhnikov <ppluzhnikov@google.com> * gdb.base/foll-fork.exp: Fix for Linux/VDSO failure. diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp index ccefc85..90c2d95 100644 --- a/gdb/testsuite/gdb.base/macscp.exp +++ b/gdb/testsuite/gdb.base/macscp.exp @@ -423,8 +423,52 @@ gdb_test "print M" \ " = 0" \ "print expression with macro in scope." +gdb_test "macro define M 72" \ + "" \ + "user macro override" + +gdb_test "print M" \ + " = 72" \ + "choose user macro" + +gdb_test "macro undef M" \ + "" \ + "remove user override" + +gdb_test "print M" \ + " = 0" \ + "print expression with macro after removing override" + gdb_test "next" "foo = 2;" "next to definition" gdb_test "print M" \ "No symbol \"M\" in current context\." \ "print expression with macro after undef." + +gdb_test "macro define M 5" \ + "" \ + "basic macro define" + +gdb_test "print M" \ + " = 5" \ + "expansion of defined macro" + +gdb_test "macro list" \ + "macro define M 5" \ + "basic macro list" + +gdb_test "macro define M(x) x" \ + "" \ + "basic redefine, macro with args" + +gdb_test "print M (7)" \ + " = 7" \ + "expansion of macro with arguments" + +gdb_test "macro undef M" \ + "" \ + "basic macro undef" + +gdb_test "print M" \ + "No symbol \"M\" in current context\." \ + "print expression with macro after user undef." |