Linux – Change format of syscall event trace output to ftrace

debuggingftracelinuxstracesystem-calls

I enabled ftrace event tracing for sys_enter_openat syscall. The respective output format given at events/syscalls/sys_enter_openat/format is

print fmt: "dfd: 0x%08lx, filename: 0x%08lx, flags: 0x%08lx, mode: 0x%08lx", ((unsigned long)(REC->dfd)), ((unsigned long)(REC->filename)), ((unsigned long)(REC->flags)), ((unsigned long)(REC->mode))

As expected a sample output line to ftrace is something like

msm_irqbalance-1338  [000] ...1 211710.033931: sys_openat(dfd: ffffff9c, filename: 5af693f224, flags: 2, mode: 0)

Is there a way to change output format such that filename: 5af693f224 can be shown as filename: <string> instead of hex(5af693f224)?

So basically is there a way to change output format while tracing a particular event(eg. sys_enter_openat above) to ftrace.

I guess this would have been possible using systemtap or krpobe but my setup does not allow its use as of now.

Best Answer

Unfortunately, there is currently not a way to do this. But perhaps in the future I may add it, if I can figure out a sane interface and implementation to do such a thing. Maybe I will add a trigger that will make the output show differently.

Although I may be new to StackExchange, I am the author of ftrace (real name Steven Rostedt - look up the git history). The "real answer" will happen when I write the code!

Related Question