[RESEND][RFC 01/18] gdb.base/find.exp C++ify

Pedro Alves pedro@palves.net
Wed Sep 16 11:38:07 GMT 2020


[For some reason, this patch didn't make it to the archives.  Resending.]

We need #include <string.h> for memset.
---
 gdb/testsuite/gdb.base/find.c   | 3 ++-
 gdb/testsuite/gdb.base/find.exp | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/find.c b/gdb/testsuite/gdb.base/find.c
index b97eb129883..d9db06790f2 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 ad512d51c78..6e11b776b8b 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'" \
-- 
2.14.5



More information about the Gdb-patches mailing list