Re: [PATCH] kernel-shark: Provide parsing for quotation marks in Record command line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 28 Aug 2019 17:10:48 +0300
"Yordan Karadzhov (VMware)" <y.karadz@xxxxxxxxx> wrote:

> On 28.08.19 г. 16:06 ч., Steven Rostedt wrote:
> > On Tue, 27 Aug 2019 22:10:18 -0700
> > stephen@xxxxxxxxxx wrote:
> >   
> >> It strikes me that this explicitly supports only a single set of quotes.
> >> This sort of behavior would be pretty surprising for people expecting shell
> >> quote support, and for people expecting just splitting on spaces.
> >>
> >> I looked and couldn't really find any Qt utility for properly parsing shell
> >> quoting (similar to python's shlex module). I totally get that it's a lot
> >> of work to implement a correct shell quoting parser.
> >>
> >> Maybe a compromise would be to add a checkbox to the capture dialog, which
> >> tells kernel-shark to pass the entire textbox contents, unmodified, to the
> >> shell implementation on the system. So, my example of:
> >>
> >>      python -c 'print("hello world")'
> >>
> >> Would get put into the third argument of the command:
> >>
> >>      /bin/sh -c INSERT_TEXTBOX_CONTENTS_HERE
> >>
> >> Then you could rely on /bin/sh doing the parsing for you. The downside is
> >> that it adds a whole new process. But you can't always get everything in
> >> life, right?
> >>  
> > 
> > I need to look at this a bit deeper. I've written lots of cases where I
> > had to capture single and double quotes and turn them into a single
> > command. This is definitely needed here.
> >   
> 
> Can you send me few of the of most trickier examples that comes to your 
> mind, so that I can use them to test the parsing?
> 

I was thinking of when we start adding synthetic event code, we will
definitely need to handle some of this. Like:

 --select 'irq_lat: lat=sched_waking.common_timestamp.usecs - hrtimer_start.common_timestamp.usecs, pid=sched_waking.pid
                    from timer.hrtimer_start join sched.sched_waking
                      on hrtimer_start.common_pid == sched_waking.common_pid
		    where hrtimer_start.function == 0xffffffff81200580 and
                          sched_waking.common_flags & 1'

 --select "wake_lat: lat=sched_switch.common_timestamp.usecs - irq_lat.common_timestamp.usecs, irqlat=irq_lat.lat, pid=sched_switch.next_pid
             from sched.sched_switch join irq_lat on sched_switch.next_pid == irq_lat.pip where next_comm == \"my-rt-code\""


Note, the above will be all on one single line!

-- Steve



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux