gdb.base/nested-addr.{c,exp} C++ify
authorPedro Alves <pedro@palves.net>
Thu, 17 Sep 2020 22:33:40 +0000 (23:33 +0100)
committerPedro Alves <pedro@palves.net>
Thu, 17 Sep 2020 23:04:29 +0000 (00:04 +0100)
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".

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/nested-addr.c
gdb/testsuite/gdb.base/nested-addr.exp

index c7e2c4c59befa893607f259ae91ad03682aa6b8e..2dbaab74d0e9c07b0d26a0cfca5a319e2fb7a55d 100644 (file)
@@ -1,3 +1,8 @@
+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
index 4725753382ddc14b0d1e92a1db69defb417106c2..3d1cfd45376cd5834f4b0c7f50f91d363ec0690b 100644 (file)
@@ -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 */
index 7ed0d65d327de2c79f1a58360e2a0ac558c069ac..15071cac9c79d9ced06fcc828565dc9b51f26ae6 100644 (file)
@@ -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"
This page took 0.070513 seconds and 4 git commands to generate.