diff options
| author | Florent Revest <revest@chromium.org> | 2023-07-04 17:59:04 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2024-02-01 10:12:21 +0000 |
| commit | 810241190102eaf849f5744ca7eeb68ad34f01d7 (patch) | |
| tree | 941d2616ff4038ae1e4198ecbaa5fd708fd845eb /pkg/csource/csource_test.go | |
| parent | c40f278e4d854c3b6341ec272dd3eb9b84fcff54 (diff) | |
pkg/csource: annotate syscall() args with their pretty-printed values
This factorizes const arguments into the shortest flags OR bitmask
possible so they are easy to read. E.g:
/*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul
Diffstat (limited to 'pkg/csource/csource_test.go')
| -rw-r--r-- | pkg/csource/csource_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/pkg/csource/csource_test.go b/pkg/csource/csource_test.go index eb85fd77b..957d2ebc9 100644 --- a/pkg/csource/csource_test.go +++ b/pkg/csource/csource_test.go @@ -223,6 +223,24 @@ syscall(SYS_csource6, /*buf=*/0x%xul); target.DataOffset+0x100, target.DataOffset+0x100, target.DataOffset+0x140, target.DataOffset+0x140), }, + { + input: ` +csource7(0x0) +csource7(0x1) +csource7(0x2) +csource7(0x3) +csource7(0x4) +csource7(0x5) +`, + output: ` +syscall(SYS_csource7, /*flag=*/0ul); +syscall(SYS_csource7, /*flag=BIT_0*/1ul); +syscall(SYS_csource7, /*flag=BIT_1*/2ul); +syscall(SYS_csource7, /*flag=BIT_0_AND_1*/3ul); +syscall(SYS_csource7, /*flag=*/4ul); +syscall(SYS_csource7, /*flag=BIT_0|0x4*/5ul); +`, + }, } for i, test := range tests { t.Run(fmt.Sprint(i), func(t *testing.T) { @@ -231,6 +249,7 @@ syscall(SYS_csource6, /*buf=*/0x%xul); t.Fatal(err) } ctx := &context{ + p: p, target: target, sysTarget: targets.Get(target.OS, target.Arch), } |
