File: struct

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 (47 lines) | stat: -rw-r--r-- 1,808 bytes parent folder | download | duplicates (2)
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
NAME struct assignment into variable
PROG struct Foo { int m; } u:./testprogs/simple_struct:func { $s = *((struct Foo *)arg0); printf("Result: %d\n", $s.m); exit(); }
EXPECT Result: 2
TIMEOUT 4
AFTER ./testprogs/simple_struct

NAME struct assignment into map
PROG struct Foo { int m; int n; } u:./testprogs/simple_struct:func { @s = *((struct Foo *)arg0); exit(); }
EXPECT @s: { .m = 2, .n = 3 }
TIMEOUT 4
AFTER ./testprogs/simple_struct

NAME struct field order
PROG struct Foo { int n; int m; } u:./testprogs/simple_struct:func { @s = *((struct Foo *)arg0); exit(); }
EXPECT @s: { .n = 2, .m = 3 }
TIMEOUT 4
AFTER ./testprogs/simple_struct

NAME nested struct assignment into map
PROG struct Foo { struct { int m[1] } y; struct { int n } a; } u:./testprogs/simple_struct:func { @s = *((struct Foo *)arg0); exit(); }
EXPECT @s: { .y = { .m = [2] }, .a = { .n = 3 } }
TIMEOUT 4
AFTER ./testprogs/simple_struct

NAME struct as a map key
PROG struct Foo { int m; int n; } u:./testprogs/simple_struct:func { @s[*((struct Foo *)arg0)] = 0; exit(); }
EXPECT @s[{ .m = 2, .n = 3 }]: 0
TIMEOUT 4
AFTER ./testprogs/simple_struct

NAME struct as a part of multikey
PROG struct Foo { int m; int n; } u:./testprogs/simple_struct:func { @s[*((struct Foo *)arg0), 42] = 0; exit(); }
EXPECT @s[{ .m = 2, .n = 3 }, 42]: 0
TIMEOUT 4
AFTER ./testprogs/simple_struct

NAME struct as a map key assigned from another map
PROG struct Foo { int m; int n; } u:./testprogs/simple_struct:func { @x = *((struct Foo *)arg0); @s[@x] = 0; exit(); }
EXPECT @s[{ .m = 2, .n = 3 }]: 0
TIMEOUT 4
AFTER ./testprogs/simple_struct

NAME struct in a tuple
PROG struct Foo { int m; int n; } u:./testprogs/simple_struct:func { @s = (1, *((struct Foo *)arg0)); exit(); }
EXPECT @s: (1, { .m = 2, .n = 3 })
TIMEOUT 4
AFTER ./testprogs/simple_struct