Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / find.c
CommitLineData
08388c79
DE
1/* Testcase for the find command.
2 This testcase is part of GDB, the GNU debugger.
3
88b9d363 4 Copyright 2008-2022 Free Software Foundation, Inc.
08388c79
DE
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19 Please email any bugs, comments, and/or additions to this file to:
20 bug-gdb@gnu.org */
21
22#include <stdlib.h>
23#include <stdint.h>
c8b18808 24#include <string.h>
08388c79 25
d3e1fc54
DJ
26/* According to C99 <stdint.h> has to provide these identifiers as
27 types, but is also free to define macros shadowing the typedefs.
28 This is the case with some C library implementations. Undefine
29 them to make sure the types are used and included in debug output. */
30#undef int8_t
31#undef int16_t
32#undef int32_t
33#undef int64_t
34
08388c79
DE
35#define CHUNK_SIZE 16000 /* same as findcmd.c's */
36#define BUF_SIZE (2 * CHUNK_SIZE) /* at least two chunks */
37
38static int8_t int8_search_buf[100];
39static int16_t int16_search_buf[100];
40static int32_t int32_search_buf[100];
41static int64_t int64_search_buf[100];
42
43static char *search_buf;
44static int search_buf_size;
45
46static int x;
47
48static void
49stop_here ()
50{
51 x = 1; // stop here
52}
53
54static void
55init_bufs ()
56{
57 search_buf_size = BUF_SIZE;
c8b18808 58 search_buf = (char *) malloc (search_buf_size);
08388c79
DE
59 if (search_buf == NULL)
60 exit (1);
61 memset (search_buf, 'x', search_buf_size);
62}
63
64int
65main ()
66{
67 init_bufs ();
68
69 stop_here ();
70
0219b378
DJ
71 /* Reference variables. */
72 x = int8_search_buf[0];
73 x = int16_search_buf[0];
74 x = int32_search_buf[0];
75 x = int64_search_buf[0];
76
08388c79
DE
77 return 0;
78}
This page took 1.89455 seconds and 4 git commands to generate.