File: implicitptr.c

package info (click to toggle)
systemtap 5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,556 kB
  • sloc: cpp: 81,117; ansic: 54,933; xml: 49,795; exp: 43,595; sh: 11,526; python: 5,003; perl: 2,252; tcl: 1,312; makefile: 1,006; javascript: 149; lisp: 105; awk: 101; asm: 91; java: 70; sed: 16
file content (69 lines) | stat: -rw-r--r-- 956 bytes parent folder | download | duplicates (5)
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
#include <sys/sdt.h>

#define MARK(name) STAP_PROBE(implicitptr, name)

int z;
int **j2;
int ***k2;
int ****l2;

static int
foo (int i)
{
  int *j = &i;
  int **k = &j;
  int ***l = &k;
  j2 = &j; k2 = &k; l2 = &l;
 l1: MARK (foo_l1);
  z++;		      /* side effect helps the probe placement hit right */
  i++;
  return i;
}

struct S
{
  int *x, y;
};

int u[6];

static inline int
add (struct S *a, struct S *b, int c)
{
  *a->x += *b->x;
  a->y += b->y;
 l1: MARK (add_l1);
  u[c + 0]++;
  a = (struct S *) 0;
  u[c + 1]++;
  a = b;
 l2: MARK (add_l2);
  u[c + 2]++;
  return *a->x + *b->x + a->y + b->y;
}

static int
bar (int i)
{
  int j = i;
  int k;
  struct S p[2] = { { &i, i * 2 }, { &j, j * 2 } };
 l1: MARK (bar_l1);
  k = add (&p[0], &p[1], 0);
 l2: MARK (bar_l2);
  p[0].x = &j;
  p[1].x = &i;
  k += add (&p[0], &p[1], 3);
 l3: MARK (bar_l3);
  return i + j + k;
}

int x = 22;

int
main (void)
{
  x = foo (x);
  x = bar (x);
  return 0;
}