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".
+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:
#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.
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);
# 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'" \