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

Eugene Syromiatnikov esyr at redhat.com
Thu Oct 25 15:46:13 UTC 2018


On Wed, Oct 24, 2018 at 12:18:21PM +0300, Dmitry V. Levin wrote:
> 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.

Yes, that's the idea.

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

Me neither. I haven't come up with anything better yet, however.


More information about the Strace-devel mailing list