summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-framefilter-mi.c
blob: caf8876fcb9829f49ee700d749c85dbdde79ee0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/* This testcase is part of GDB, the GNU debugger.

   Copyright 2013-2019 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

#include <stdlib.h>

void funca(void);
int count = 0;

typedef struct
{
  char *nothing;
  int f;
  short s;
} foobar;

void end_func (int foo, char *bar, foobar *fb, foobar bf)
{
  const char *str = "The End";
  const char *st2 = "Is Near";
  int b = 12;
  short c = 5;
  {
    int d = 15;
    int e = 14;
    const char *foo = "Inside block";
    {
      int f = 42;
      int g = 19;
      const char *bar = "Inside block x2";
      {
	short h = 9;
	h = h +1;  /* Inner test breakpoint  */
      }
    }
  }

  return; /* Backtrace end breakpoint */
}

void funcb(int j)
{
  struct foo
  {
    int a;
    int b;
  };

  struct foo bar;

  bar.a = 42;
  bar.b = 84;

  funca();
  return;
}

void funca(void)
{
  foobar fb;
  foobar *bf;

  if (count < 10)
    {
      count++;
      funcb(count);
    }

  fb.nothing = "Foo Bar";
  fb.f = 42;
  fb.s = 19;

  bf = malloc (sizeof (foobar));
  bf->nothing = malloc (128);
  bf->nothing = "Bar Foo";
  bf->f = 24;
  bf->s = 91;

  end_func(21, "Param", bf, fb);
  free (bf->nothing);
  free (bf);
  return;
}


void func1(void)
{
  funca();
  return;
}

int func2(void)
{
  func1();
  return 1;
}

void func3(int i)
{
  func2();

  return;
}

int func4(int j)
{
  func3(j);

  return 2;
}

int func5(int f, int d)
{
  int i = 0;
  char *random = "random";
  i=i+f;

  func4(i);
  return i;
}

int
main()
{
  func5(3,5);
  return 0;
}