aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/lang/c/register_variables/test.c
blob: 476c32899edc69712852e37b2d8a336bc5d8f47e (plain) (blame)
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
#include <stdio.h>

struct bar {
  int m1;
  int m2;
};

void f1(int a, struct bar *b) __attribute__((noinline)) __attribute__((regparm(2)));
void f1(int a, struct bar *b)
{
  b->m2 = b->m1 + a; // set breakpoint here
}

void f2(struct bar *b) __attribute__((noinline)) __attribute__((regparm(1)));
void f2(struct bar *b)
{
  int c = b->m2;
  printf("%d\n", c); // set breakpoint here
}

float f3() __attribute__((noinline));
float f3() {
  return 3.14f;
}

int main()
{
  struct bar myBar = { 3, 4 };
  f1(2, &myBar);
  f2(&myBar);

  float f = f3();
  printf("%f\n", f); // set breakpoint here
  return 0;
}