[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] trace-events: print 0x before hex numbers
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] trace-events: print 0x before hex numbers |
Date: |
Fri, 28 Jul 2017 07:08:57 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 07/28/2017 04:04 AM, Peter Maydell wrote:
> On 28 July 2017 at 09:55, Vladimir Sementsov-Ogievskiy
> <address@hidden> wrote:
>> To make logs more readable prefix all hex values with '0x' mark.
>> This is needed for consistency too, as a lot of hex values are already
>> prefixed with '0x'. Also, bring all hex outputs to the common form -
>> use '%#', not '0x%'.
>>
>> This patch is done by two commands:
>> find . -name trace-events | \
>> xargs sed -i 's/%\([-+
>> *.0-9]*\([hljztL]\|ll\|hh\)\?\(x\|X\|"\s*PRIx\)\)/%#\1/g'
Why PRIx32 but not PRIX32?
>> find . -name trace-events | xargs sed -i 's/0x%#/%#/g'
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
>> ---
>
> There seem to be an order of magnitude more trace format strings
> using 0x% rather than %#, so maybe converting in the other direction
> would be better? I think the patch would also be easier to review
> if the "no change to the printed value" switches between 0x% and %#
Umm, 0x%x and %#x are not identical. The difference is visible when
printing 0; the former produces 0x0 while the latter produces 0.
Fortunately, both forms are unambiguous, and the point of this exercise
is to make it unambiguous when a value must be read as hex to be
interpreted correctly. I kind of like %#x, but agree that it is not as
commonly used; and from the consistency standpoint, seeing a series of
traces that report 0x0 vs. 0x1 is nicer than 0 vs 0x1.
> were not in the same patch as "changing the printed value which
> didn't have an 0x before".
I definitely agree with this advice of splitting things.
>
> thanks
> -- PMM
>
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature