Re: [PATCH v2 0/4] printf: Add struct range print specifier
From: Ira Weiny
Date: Thu Oct 31 2024 - 17:35:06 EST
metux wrote:
> On 26.10.24 02:46, Ira Weiny wrote:
> > Support for the Compute Express Link (CXL) Dynamic Capacity Devices
> > (DCD) have grown a number of uses to print struct range.[1] Support for
> > a printf specifier '%pra' was being worked within a large series and has
> > garnered a number of comments and discussion.
>
> This is just printing out hex dump of a memory range, correct ?
No. This prints the struct range values not the data.
>
> What I'm looking for quite some time is a sane way for dumping structs
> in a human readable form (field: value pairs, using their actual types
> eg. int vs string, ...).
>
> Any idea to do that in a generic way ?
> (potentially using debug info ?)
>
For printing buffers less than 64 bytes look at:[1]
%*ph
or bigger buffers
print_hex_dump()
Ira
[1] https://www.kernel.org/doc/html/latest/core-api/printk-formats.html