From f5bcc8dc6eb21df90aeb443032779df3e73c53a1 Mon Sep 17 00:00:00 2001 From: Ethan Graham Date: Wed, 16 Jul 2025 12:46:20 +0000 Subject: 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. --- pkg/csource/options.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'pkg/csource/options.go') diff --git a/pkg/csource/options.go b/pkg/csource/options.go index 74d4a587a..4438e5df2 100644 --- a/pkg/csource/options.go +++ b/pkg/csource/options.go @@ -50,6 +50,9 @@ type Options struct { HandleSegv bool `json:"segv,omitempty"` Trace bool `json:"trace,omitempty"` + + CallComments bool `json:"callcomments,omitempty"` + LegacyOptions } @@ -160,13 +163,14 @@ func (opts Options) checkLinuxOnly(OS string) error { func DefaultOpts(cfg *mgrconfig.Config) Options { opts := Options{ - Threaded: true, - Repeat: true, - Procs: cfg.Procs, - Slowdown: cfg.Timeouts.Slowdown, - Sandbox: cfg.Sandbox, - UseTmpDir: true, - HandleSegv: true, + Threaded: true, + Repeat: true, + Procs: cfg.Procs, + Slowdown: cfg.Timeouts.Slowdown, + Sandbox: cfg.Sandbox, + UseTmpDir: true, + HandleSegv: true, + CallComments: true, } if cfg.TargetOS == targets.Linux { opts.NetInjection = true -- cgit mrf-deployment