[U-Boot] [U-Boot,v4,5/6] cmd: iotrace: add dump trace command

Tom Rini trini at konsulko.com
Fri Jun 8 11:18:44 UTC 2018


On Wed, May 30, 2018 at 11:10:01PM +0300, Ramon Fried wrote:

> Add dump trace command which dump all trace
> buffer content in a much more readable fashion
> than md.
> 
> Signed-off-by: Ramon Fried <ramon.fried at gmail.com>
> Reviewed-by: Simon Glass <sjg at chromium.org>
> ---
> 
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
> Changes in v1: None
> 
>  cmd/iotrace.c | 36 +++++++++++++++++++++++++++++++++++-
>  1 file changed, 35 insertions(+), 1 deletion(-)
> 
> diff --git a/cmd/iotrace.c b/cmd/iotrace.c
> index 601b8c8e32..f50a3c3a1a 100644
> --- a/cmd/iotrace.c
> +++ b/cmd/iotrace.c
> @@ -24,6 +24,36 @@ static void do_print_stats(void)
>  	printf("CRC32:  %08lx\n", (ulong)iotrace_get_checksum());
>  }
>  
> +static void do_print_trace(void)
> +{
> +	ulong start, size, offset, count;
> +
> +	struct iotrace_record *cur_record;
> +
> +	iotrace_get_buffer(&start, &size, &offset, &count);
> +
> +	if (!start || !size || !count)
> +		return;
> +
> +	printf("Timestamp  Value          Address\n");
> +
> +	cur_record = (struct iotrace_record *)start;
> +	for (int i = 0; i < count; i++) {
> +		if (cur_record->flags & IOT_WRITE)
> +			printf("%08llu: 0x%08lx --> 0x%08lx\n",
> +			       cur_record->timestamp,
> +					cur_record->value,
> +					cur_record->addr);
> +		else
> +			printf("%08llu: 0x%08lx <-- 0x%08lx\n",
> +			       cur_record->timestamp,
> +					cur_record->value,
> +					cur_record->addr);
> +
> +		cur_record++;
> +	}
> +}

This isn't portable.  If you build for sandbox64:
cmd/iotrace.c: In function ‘do_print_trace’:
cmd/iotrace.c:44:11: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘phys_addr_t {aka unsigned int}’ [-Wformat=]
    printf("%08llu: 0x%08lx --> 0x%08lx\n",
           ^
cmd/iotrace.c:49:11: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘phys_addr_t {aka unsigned int}’ [-Wformat=]
    printf("%08llu: 0x%08lx <-- 0x%08lx\n",
           ^
t

Also, as-is, with clang-7:
u-boot/cmd/iotrace.c:47:6: warning: format specifies type 'unsigned long' but the argument has type 'phys_addr_t' (aka 'unsigned int') [-Wformat]
                                        cur_record->addr);
                                        ^~~~~~~~~~~~~~~~
cmd/iotrace.c:52:6: warning: format specifies type 'unsigned long' but the argument has type 'phys_addr_t' (aka 'unsigned int') [-Wformat]
                                        cur_record->addr);
                                        ^~~~~~~~~~~~~~~~

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180608/12888794/attachment.sig>


More information about the U-Boot mailing list