Re: [re: PATCH v2 00/15 - 08/11] dyndbg: split multi-query strings with %

From: jim . cromie
Date: Sun Dec 10 2023 - 20:10:16 EST


On Fri, Dec 8, 2023 at 5:32 PM Łukasz Bartosik <lb@xxxxxxxxxxxx> wrote:
>
> pt., 8 gru 2023 o 01:15 Jim Cromie <jim.cromie@xxxxxxxxx> napisał(a):
> >

> > vng -v --user root -p 4 \
> > -a dynamic_debug.verbose=3 \
> > -a \*.dyndbg=class,DRM_UT_CORE,+pfmlt_%class,DRM_UT_KMS,+pfm%class,DRM_UT_ATOMIC,+pf
> >
> > ':' would be a more natural multi-cmd separator, but is reserved
> > for +T:<trace_buf> to designate separate tracebuf instances.
> >
> > If '%' is distasteful, the backup plan is ",_,", since that would
> > never appear in a useful <format "$foo"> cmd.
> >
>
> What if we use a different character for passing trace instance name
> to the T flag, for example "-", +T-trace_buf
> and then use ":" instead of "%" as a separator ?
>

*** entering the Bikeshed ***

One of the nice constraints of the flags-val is that it always starts with +/-/=
the 1st char of flags is the only place they would appear unquoted.
using '-' again dilutes that specialness.

the whole +T:named_stream. syntax has a mnemonic value,
it seems to explain itself (but I'm weird)

WRT to ':' vs '%' as multi-cmd separator, what do we lose in each trade ?
ultimately it invalidates a query containing those chars. IOW

# impossible query when cmd-splitting on %
echo format "search for %s because %d" +p > /proc/dynamic_debug/control

# impossible when splitting on :
echo format "my_label: " +p > /proc/dynamic_debug/control

NB: only format would see an arg with either : or %, since theyre
*never* in filenames, functions or module (or class) names.

Of the 2, % is even more unlikely to wind up in a name,
colon already appears in host:path and urls,
and in some class-name systems
(tho not planned for "class" keyword)

the ability to search for colon-terminated labels seems more useful
than searching for a particular set of printf format specifiers,
which btw cant have colons between them.