[PATCH 2/2] ptype: add option to use hexadecimal notation

Paul Koning paulkoning@comcast.net
Thu Apr 15 00:08:58 GMT 2021



> On Apr 14, 2021, at 6:45 PM, Lancelot SIX via Gdb-patches <gdb-patches@sourceware.org> wrote:
> 
> On Tue, Apr 13, 2021 at 08:08:58PM -0400, Paul Koning wrote:
>> 
>> 
>>> On Apr 13, 2021, at 7:18 PM, John Baldwin <jhb@FreeBSD.org> wrote:
>>> 
>>> On 12/31/20 4:53 AM, Lancelot SIX via Gdb-patches wrote:
>>>> This commit adds a flag to the ptype command in order to print the
>>>> offsets and sizes of struct members using the hexadecimal notation. The
>>>> 'x' flag ensures use of the hexadecimal notation while the 'X' flag
>>>> ensures use of the decimal notation. The default is to use decimal
>>>> notation.
>> 
>> "X" for decimal is rather non-obvious.  How about "d" instead?  Usually X means uppercase hexadecimal.
> 
> I went for the x/X since other options use the lowercase/uppercase to
> activate/deactivate flags (m/M or t/T).  If this is more confusing than
> helping, I am fine using 'd' to force decimal notation.  I am just a bit
> concerned that with those 2 distinct letters, one could expects to find
> two flags ('set print type hex' and 'set print type decimal'), where
> only one actually exists.  Is this me overthinking it?
> 
> Lancelot.

I didn't realize there's an existing pattern like that.  Given that precedent, it seems that what you're proposing is fine and matches what's already done elsewhere.  

	paul



More information about the Gdb-patches mailing list