aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2020-09-17 23:33:40 +0100
committerPedro Alves <pedro@palves.net>2020-09-18 00:04:29 +0100
commit52626c58267233b0e6a9807a80945467a019013b (patch)
tree51c05b3972ba31b38efff9e74217d38afb60e52d
parent52bb090268881cfa1ab615273e281610935f2f95 (diff)
downloadgdb-52626c58267233b0e6a9807a80945467a019013b.zip
gdb-52626c58267233b0e6a9807a80945467a019013b.tar.gz
gdb-52626c58267233b0e6a9807a80945467a019013b.tar.bz2
gdb.base/nested-addr.{c,exp} C++ify
Adjust gdb.base/nested-addr.exp to let the testcase build and run as a C++ program. "print /d" is used so we get "= 1" instead of "= true" in C++ mode. gdb/testsuite/ChangeLog: * gdb.base/nested-addr.c (main): Add cast. * gdb.base/nested-addr.exp: Use "print /d".
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/nested-addr.c2
-rw-r--r--gdb/testsuite/gdb.base/nested-addr.exp2
3 files changed, 7 insertions, 2 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index c7e2c4c..2dbaab7 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2020-09-17 Pedro Alves <pedro@palves.net>
+ * gdb.base/nested-addr.c (main): Add cast.
+ * gdb.base/nested-addr.exp: Use "print /d".
+
+2020-09-17 Pedro Alves <pedro@palves.net>
+
* gdb.base/break.exp (func): New. Use it throughout when
expecting a function name.
diff --git a/gdb/testsuite/gdb.base/nested-addr.c b/gdb/testsuite/gdb.base/nested-addr.c
index 4725753..3d1cfd45 100644
--- a/gdb/testsuite/gdb.base/nested-addr.c
+++ b/gdb/testsuite/gdb.base/nested-addr.c
@@ -28,7 +28,7 @@ static foo *foo_array = NULL;
int
main (void)
{
- foo_array = calloc (3, sizeof (*foo_array));
+ foo_array = (foo *) calloc (3, sizeof (*foo_array));
foo_array[1].a = 10;
foo_array[2].b = 20;
return 0; /* BREAK */
diff --git a/gdb/testsuite/gdb.base/nested-addr.exp b/gdb/testsuite/gdb.base/nested-addr.exp
index 7ed0d65..15071ca 100644
--- a/gdb/testsuite/gdb.base/nested-addr.exp
+++ b/gdb/testsuite/gdb.base/nested-addr.exp
@@ -31,4 +31,4 @@ gdb_test "print &foo_array\[1\].a" "= \\(int \\*\\) $hex.*"
# A bug in EVAL_AVOID_SIDE_EFFECTS mode used to yield the following error:
# Attempt to take address of value not located in memory.
-gdb_test "print 1 && &foo_array\[1\].a" "= 1"
+gdb_test "print /d 1 && &foo_array\[1\].a" "= 1"