File: struct_array_vars.bt

package info (click to toggle)
bpftrace 0.24.1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,496 kB
  • sloc: cpp: 60,982; ansic: 10,952; python: 953; yacc: 665; sh: 536; lex: 295; makefile: 22
file content (46 lines) | stat: -rwxr-xr-x 801 bytes parent folder | download | duplicates (3)
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
struct T {
  uint32_t a;
  uint32_t b[2];
};

struct W {
  uint32_t a;
  struct T t;
};

struct C {
  uint32_t a;
  void * b;
  struct W w[10];
};

uprobe:./testprogs/struct_array:clear {
  $c = (struct C *) arg0;

  $w = $c->w;
  @w[0] = $c->w;
  @[$c->w] = 42;

  printf("%d ", $w[0].a);
  printf("%d ", $w[2].a);
  printf("%d ", $w[4].a);
  printf("%d ", $w[6].a);
  printf("%d ", $w[8].a);

  printf("-- ");
  printf("%d ", @w[0][1].t.a);
  printf("%d ", @w[0][3].t.a);
  printf("%d ", @w[0][5].t.a);
  printf("%d ", @w[0][7].t.a);
  printf("%d ", @w[0][9].t.a);

  printf("-- ");
  printf("%d ", @w[0][0].t.b[1]);
  printf("%d ", @w[0][1].t.b[1]);
  printf("%d ", @w[0][2].t.b[1]);
  printf("%d ", @w[0][3].t.b[1]);
  printf("%d ", @w[0][4].t.b[1]);

  printf("-- ");
  printf("%d ", @[$c->w]);
}