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-17 23:33:40 +0100
commitc8b188085d2048b8a2c3e55ea2ef71993717bd3b (patch)
tree4aea7ff4c58b8ddfa1fcfa91b0c2f52176d29f6d
parentc1e1314d00fda5625f1a87b915fd83a61c253993 (diff)
downloadgdb-c8b188085d2048b8a2c3e55ea2ef71993717bd3b.zip
gdb-c8b188085d2048b8a2c3e55ea2ef71993717bd3b.tar.gz
gdb-c8b188085d2048b8a2c3e55ea2ef71993717bd3b.tar.bz2
gdb.base/find.exp C++ify
This makes the testcase work when compiled with C++ compiler. We need #include <string.h> for memset. gdb/testsuite/ChangeLog: * gdb.base/find.c: Include <string.h>. (init_bufs): Add cast. * gdb.base/find.exp: Issue "set print asm-demangle on".
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.base/find.c3
-rw-r--r--gdb/testsuite/gdb.base/find.exp3
3 files changed, 11 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index a0211e6..e81c85c 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2020-09-17 Pedro Alves <pedro@palves.net>
+
+ * gdb.base/find.c: Include <string.h>.
+ (init_bufs): Add cast.
+ * gdb.base/find.exp: Issue "set print asm-demangle on".
+
2020-09-16 Tom Tromey <tromey@adacore.com>
PR gdb/26598:
diff --git a/gdb/testsuite/gdb.base/find.c b/gdb/testsuite/gdb.base/find.c
index b97eb12..d9db067 100644
--- a/gdb/testsuite/gdb.base/find.c
+++ b/gdb/testsuite/gdb.base/find.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <stdint.h>
+#include <string.h>
/* According to C99 <stdint.h> has to provide these identifiers as
types, but is also free to define macros shadowing the typedefs.
@@ -54,7 +55,7 @@ static void
init_bufs ()
{
search_buf_size = BUF_SIZE;
- search_buf = malloc (search_buf_size);
+ search_buf = (char *) malloc (search_buf_size);
if (search_buf == NULL)
exit (1);
memset (search_buf, 'x', search_buf_size);
diff --git a/gdb/testsuite/gdb.base/find.exp b/gdb/testsuite/gdb.base/find.exp
index ad512d5..6e11b77 100644
--- a/gdb/testsuite/gdb.base/find.exp
+++ b/gdb/testsuite/gdb.base/find.exp
@@ -42,6 +42,9 @@ set two_patterns_found "${newline}2 patterns found\[.\]"
# Test string pattern.
+# For when the testcase is built in C++ mode.
+gdb_test_no_output "set print asm-demangle on"
+
gdb_test_no_output "set *(int32_t*) &int8_search_buf\[10\] = 0x61616161" ""
gdb_test "find &int8_search_buf\[0\], +sizeof(int8_search_buf), 'a', 'a', 'a'" \