[Q] Bit field/array/pointer output formatting disambiguation

Dmitry V. Levin ldv at altlinux.org
Wed Oct 24 09:18:21 UTC 2018


On Wed, Oct 17, 2018 at 06:13:39AM +0200, Eugene Syromyatnikov wrote:
> Hello.
> 
> There are some questions about strace users' preference regarding
> formatting of bit fields, arrays, and pointers in strace's output. As
> of now, square brackets are used for designating all these things,
> with the only difference in a separator used for delimiting items in
> arrays and bit masks (a combination of comma and space is used for
> delimiting array items, and a space is used for bit fields). Examples
> from strace(1):
>            getgroups(32, [100, 0]) = 2
>            sigprocmask(SIG_BLOCK, [CHLD TTOU], []) = 0
> 
> A special case of an array is a pointer reference, which is also
> printed using square brackets:
>            futex([0x2] /* 0x7fbf7bd730c8 */, FUTEX_WAKE_PRIVATE, 2147483647) = 0
> 
> The issue is that an array that contains only a single item may be
> confused with a bit mask that has only one bit set. As a solution to
> this, it is proposed to add spaces around elements in bit mask output:
>            getgroups(32, [100]) = 2
>            getgroups(32, []) = 2
>            sigprocmask(SIG_BLOCK, [ CHLD ], [  ]) = 0
>            sigprocmask(SIG_UNBLOCK, ~[  ], NULL) = 0

If we follow this approach, then [CHLD TTOU] would have to be changed
to [ CHLD TTOU ] for consistency.

I don't quite like the idea of meaningful spaces, though - they are so
easy to miss.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20181024/c5c42c42/attachment.bin>


More information about the Strace-devel mailing list