Bug 207605

Summary: please support %ph/more %p format(s)
Product: Tools Reporter: Johannes Berg (johannes)
Component: Trace-cmd/KernelsharkAssignee: Default virtual assignee for Trace-cmd and kernelshark (tools_tracecmd_kernelshark)
Status: RESOLVED CODE_FIX    
Severity: enhancement CC: rostedt, tstoyanov
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: N/A Subsystem:
Regression: No Bisected commit-id:

Description Johannes Berg 2020-05-06 12:53:10 UTC
I was trying to create an event with a __dynamic_array() where the small contents is printed with

  TP_printk("%*phN", __get_dynamic_array_len(x), __get_dynamic_array(x))

which works OK in the kernel, but trace-cmd just prints

  0x<userspaceaddr>hN


There are many many more kernel extensions to %p though, and only two (IPv4 and MAC addresses) seem to be supported right now.

See the kernel's lib/vsprintf.c, documentation is above the pointer() function.
Comment 1 Tzvetomir Stoyanov 2020-05-06 14:55:46 UTC
Hi Johannes,
I'm working on some trace-cmd optimizations related to parsing and printing these print formats, will look at lib/vsprintf.c documentation and how to improve trace-cmd to handle these cases.

Thanks for using trace-cmd and reporting this issue.
Comment 2 Tzvetomir Stoyanov 2020-05-08 13:20:26 UTC
Submitted a fix: https://patchwork.kernel.org/patch/11536179/
Comment 3 Johannes Berg 2020-05-08 17:22:46 UTC
Awesome, thanks!
Comment 4 Steven Rostedt 2020-07-08 00:31:18 UTC
Fixed by: 29885d7fbb55 ("trace-cmd: Add support for more printk format specifiers")