Introduce gdb.FinishBreakpoint in Python
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / py-inferior.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stdint.h>
4 #include <string.h>
5
6 #define CHUNK_SIZE 16000 /* same as findcmd.c's */
7 #define BUF_SIZE (2 * CHUNK_SIZE) /* at least two chunks */
8
9 int8_t int8_search_buf[100];
10 int16_t int16_search_buf[100];
11 int32_t int32_search_buf[100];
12 int64_t int64_search_buf[100];
13
14 static char *search_buf;
15 static int search_buf_size;
16
17
18 int f2 (int a)
19 {
20 /* We use a `char[]' type below rather than the typical `char *'
21 to make sure that `str' gets allocated on the stack. Otherwise,
22 the compiler may place the "hello, testsuite" string inside
23 a read-only section, preventing us from over-writing it from GDB. */
24 char str[] = "hello, testsuite";
25
26 puts (str); /* Break here. */
27
28 return ++a;
29 }
30
31 int f1 (int a, int b)
32 {
33 return f2(a) + b;
34 }
35
36 static void
37 init_bufs ()
38 {
39 search_buf_size = BUF_SIZE;
40 search_buf = malloc (search_buf_size);
41 if (search_buf == NULL)
42 exit (1);
43 memset (search_buf, 'x', search_buf_size);
44 }
45
46 int main (int argc, char *argv[])
47 {
48 init_bufs ();
49
50 return f1 (1, 2);
51 }
This page took 0.03299 seconds and 4 git commands to generate.