diff options
| author | Ethan Graham <ethangraham@google.com> | 2025-07-16 12:46:20 +0000 |
|---|---|---|
| committer | Alexander Potapenko <glider@google.com> | 2025-08-04 12:25:52 +0000 |
| commit | f5bcc8dc6eb21df90aeb443032779df3e73c53a1 (patch) | |
| tree | f0a3e78563638e5e8418f604c7700449e7624d64 /pkg/csource/testdata/0 | |
| parent | abdcb21383cc97dd3eb98eaa27189415be7d8199 (diff) | |
pkg/csource: add call argument annotations to generated C-source files
The structure of arguments passed into syscalls is often hard to parse
since it is memcpy'd into mmap'd regions. Structural relations are often
lost in translation, resulting in reproducers that take longer for a
developer to understand.
This patch adds functionality for parsing syscall arguments semantically and
emitting a structured and human-readable comment which is inserted before each
syscall in the resulting C-source.
Diffstat (limited to 'pkg/csource/testdata/0')
| -rw-r--r-- | pkg/csource/testdata/0 | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/pkg/csource/testdata/0 b/pkg/csource/testdata/0 new file mode 100644 index 000000000..1f8c0f959 --- /dev/null +++ b/pkg/csource/testdata/0 @@ -0,0 +1,25 @@ +r0 = socket$netlink(0x10, 0x3, 0x2) +bind$netlink(r0, &(0x7f0000514ff4)={0x10, 0x0, 0x0, 0x2ffffffff}, 0xc) + +// socket$netlink arguments: [ +// domain: const = 0x10 (8 bytes) +// type: const = 0x3 (8 bytes) +// proto: netlink_proto = 0x2 (4 bytes) +// ] +// returns sock_netlink +syscall(__NR_socket, /*domain=*/0x10ul, /*type=*/3ul, /*proto=NETLINK_USERSOCK*/2) +// bind$netlink arguments: [ +// fd: sock_netlink (resource) +// addr: ptr[in, sockaddr_nl_t[AF_NETLINK, netlink_port_id, +// flags[netlink_group_bitmap, int32]]] { +// sockaddr_nl_t[AF_NETLINK, netlink_port_id, flags[netlink_group_bitmap, +// int32]] { +// nl_family: const = 0x10 (2 bytes) +// nl_pad: const = 0x0 (2 bytes) +// nl_pid: int32 = 0x0 (4 bytes) +// nl_groups: netlink_group_bitmap = 0x2ffffffff (4 bytes) +// } +// } +// addrlen: len = 0xc (8 bytes) +// ] +syscall(__NR_bind, /*fd=*/r[0], /*addr=*/0x200000514ff4ul, /*addrlen=*/0xcul)
\ No newline at end of file |
