aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-05-16 20:31:10 +0000
committerTom Tromey <tromey@redhat.com>2012-05-16 20:31:10 +0000
commitabc9d0dc6edeeabbd65fedb43cf840875156da91 (patch)
tree6af9437622479beefdff726b65ee0880edb7d549 /gdb/testsuite
parent7537bd464b5c7aaa08b67e53f38403551ef5605d (diff)
downloadgdb-abc9d0dc6edeeabbd65fedb43cf840875156da91.zip
gdb-abc9d0dc6edeeabbd65fedb43cf840875156da91.tar.gz
gdb-abc9d0dc6edeeabbd65fedb43cf840875156da91.tar.bz2
PR macros/13205:
* macrotab.h: (macro_define_special): Declare. (enum macro_special_kind): New. (struct macro_definition) <argc, replacement>: Update comments. * macrotab.c (new_macro_definition): Unconditionally set 'argc'. (macro_define_object_internal): New function. (macro_define_object): Use it. (macro_define_special): New function. (fixup_definition): New function. (macro_lookup_definition, foreach_macro_in_scope) (foreach_macro): Use fixup_definition. * macroexp.h (macro_stringify): Declare. * macroexp.c (free_buffer_return_text): New function. (stringify): Constify "arg". (macro_stringify): New function. * dwarf2read.c (macro_start_file): Call macro_define_special. testsuite * gdb.base/macscp1.c (macscp_expr): Add comment. * gdb.base/macscp.exp: Test __FILE__ and __LINE__.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/macscp.exp10
-rw-r--r--gdb/testsuite/gdb.base/macscp1.c2
3 files changed, 15 insertions, 2 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 93e0a0d..236007d 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-16 Tom Tromey <tromey@redhat.com>
+
+ * gdb.base/macscp1.c (macscp_expr): Add comment.
+ * gdb.base/macscp.exp: Test __FILE__ and __LINE__.
+
2012-05-16 Maciej W. Rozycki <macro@codesourcery.com>
* gdb.base/return-nodebug.exp: Also test float and double types.
diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp
index fa2173a..44a526b 100644
--- a/gdb/testsuite/gdb.base/macscp.exp
+++ b/gdb/testsuite/gdb.base/macscp.exp
@@ -227,6 +227,10 @@ list_and_check_macro macscp3_2 WHERE {macscp3.h macscp1.c {before macscp3_2}}
gdb_test "info macro FROM_COMMANDLINE" \
"Defined at \[^\r\n\]*:0\r\n-DFROM_COMMANDLINE=ARG"
+gdb_test "info macro __FILE__" "#define __FILE__ \".*macscp3.h\"" \
+ "info macro __FILE__ before running"
+gdb_test "info macro __LINE__" "#define __LINE__ 26" \
+ "info macro __LINE__ before running"
# Although GDB's macro table structures distinguish between multiple
# #inclusions of the same file, GDB's other structures don't. So the
@@ -466,7 +470,7 @@ gdb_test "print MACRO_TO_EXPAND" \
" = 0" \
"print expression with macro after removing override"
-gdb_test "next" "foo = 2;" "next to definition 2"
+gdb_test "next" "foo = 2;.*" "next to definition 2"
gdb_test "print MACRO_TO_EXPAND" \
"No symbol \"MACRO_TO_EXPAND\" in current context\." \
@@ -673,3 +677,7 @@ gdb_test_no_output "macro define si_addr fields.fault.si_addr" \
gdb_test "macro expand siginfo.si_addr" \
"expands to: siginfo.fields.fault.si_addr" \
"macro expand siginfo.si_addr"
+
+gdb_test "print __FILE__" " = \".*macscp1.c\""
+gdb_test "print __LINE__" \
+ " = [gdb_get_line_number {stopping point for line test}]"
diff --git a/gdb/testsuite/gdb.base/macscp1.c b/gdb/testsuite/gdb.base/macscp1.c
index e754b26..b1eb0b4 100644
--- a/gdb/testsuite/gdb.base/macscp1.c
+++ b/gdb/testsuite/gdb.base/macscp1.c
@@ -91,7 +91,7 @@ macscp_expr (void)
#define MACRO_TO_EXPAND foo
foo = 1;
#undef MACRO_TO_EXPAND
- foo = 2;
+ foo = 2; /* stopping point for line test */
}
#define TWENTY_THREE 23