qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Blue Swirl <blauwirbel@gmail.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: qemu-devel@nongnu.org, Anthony Liguori <aliguori@us.ibm.com>,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
	Prerna Saxena <prerna@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] Re: [PATCH 01/14] trace: Add trace-events file for declaring trace events
Date: Tue, 31 Aug 2010 18:00:15 +0000	[thread overview]
Message-ID: <AANLkTim543Q0f1bW7n3phq4mt7f7RL2A_fgfBQKe4fy_@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimFXf6OUXS9mcR-3EDfH7Mindi0vTw1+7gkfyej@mail.gmail.com>

On Tue, Aug 31, 2010 at 8:46 AM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> On Mon, Aug 30, 2010 at 10:01 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
>> On Mon, Aug 30, 2010 at 8:42 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
>>> On Mon, Aug 30, 2010 at 8:10 PM, malc <av1474@comtv.ru> wrote:
>>>> On Mon, 30 Aug 2010, Blue Swirl wrote:
>>>>
>>>>> On Mon, Aug 30, 2010 at 1:27 PM, Stefan Hajnoczi
>>>>> <stefanha@linux.vnet.ibm.com> wrote:
>>>>> > This patch introduces the trace-events file where trace events can be
>>>>> > declared like so:
>>>>> >
>>>>> > qemu_malloc(size_t size) "size %zu"
>>>>> > qemu_free(void *ptr) "ptr %p"
>>>>> >
>>>>> > These trace event declarations are processed by a new tool called
>>>>> > tracetool to generate code for the trace events.  Trace event
>>>>> > declarations are independent of the backend tracing system (LTTng User
>>>>> > Space Tracing, ftrace markers, DTrace).
>>>>>
>>>>> I think the tool does not work if 'sh' is not 'bash'. For example, on
>>>>> OpenBSD I got:
>>>>
>>>> Well, it does work with ash.
>>>>
>>>>>
>>>>> config-host.mak is out-of-date, running configure
>>>>>
>>>>> Error: invalid trace backend
>>>>> Please choose a supported trace backend.
>>>>>
>>>>>   GEN   trace.h
>>>>> /src/qemu/tracetool[176]: no closing quote
>>>>>
>>>>> This shows the problem:
>>>>> sh -x ../tracetool --nop --check-backend
>>>>> + set -f
>>>>> ../tracetool[176]: no closing quote
>>>>
>>>> `set -f' is a valid construct according to:
>>>> http://www.opengroup.org/onlinepubs/009695399/utilities/set.html
>>>>
>>>> The problem is likely elsewhere.
>>>
>>> Right, the offending lines are:
>>>    echo ${1%%(*}
>>> and
>>>    args=${1#*(}
>>>
>>> If I remove both of those, the errors are gone.
>>>
>>
>> This patch fixes the problem. Double quotes do not help.
>>
>> diff --git a/tracetool b/tracetool
>> index d640100..01de580 100755
>> --- a/tracetool
>> +++ b/tracetool
>> @@ -29,14 +29,14 @@ EOF
>>  # Get the name of a trace event
>>  get_name()
>>  {
>> -    echo ${1%%(*}
>> +    echo ${1%%\(*}
>>  }
>>
>>  # Get the argument list of a trace event, including types and names
>>  get_args()
>>  {
>>     local args
>> -    args=${1#*(}
>> +    args=${1#*\(}
>>     args=${args%)*}
>>     echo "$args"
>>  }
>
> Thanks for finding and fixing this!  I have been testing with dash in
> addition to bash.
>
> I'd like to write tracetool in Python (or Perl, if needed) to
> eliminate issues like this.  I chose shell though to avoid the
> dependency on Python.  QEMU currently uses Perl for texi2pod.pl and
> Python for QMP scripts but both are optional.  Tracetool isn't
> optional because it runs even when tracing is disabled ("nop" backend
> generates empty stub functions).  How do you feel about tracetool in
> Python?

I'd like to avoid additional dependencies. One way to solve this could
be to ship QEMU with default-trace.[ch] which are used for the nop
case, then tracetool implementation would not matter much. But these
files would need to be updated, in synch, whenever new trace points
are added which is fragile.

Maybe a bit of CPP magic added to trace-events could simplify (or even
eliminate) the script, something like we do with .hx files.

  reply	other threads:[~2010-08-31 18:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-30 13:27 [Qemu-devel] [PATCH 00/14 v2] trace: Add static tracing to QEMU Stefan Hajnoczi
2010-08-30 13:27 ` [Qemu-devel] [PATCH 01/14] trace: Add trace-events file for declaring trace events Stefan Hajnoczi
2010-08-30 19:50   ` [Qemu-devel] " Blue Swirl
2010-08-30 20:10     ` malc
2010-08-30 20:42       ` Blue Swirl
2010-08-30 21:01         ` Blue Swirl
2010-08-31  8:46           ` Stefan Hajnoczi
2010-08-31 18:00             ` Blue Swirl [this message]
2010-09-01  6:18               ` Stefan Hajnoczi
2010-09-01 16:03                 ` [Qemu-devel] [PATCH v3] " Stefan Hajnoczi
2010-08-30 13:27 ` [Qemu-devel] [PATCH 02/14] trace: Add simple built-in tracing backend Stefan Hajnoczi
2010-08-30 13:27 ` [Qemu-devel] [PATCH 03/14] trace: Support for dynamically enabling/disabling trace events Stefan Hajnoczi
2010-08-30 13:27 ` [Qemu-devel] [PATCH 04/14] trace: Support disabled events in trace-events Stefan Hajnoczi
2010-08-30 13:27 ` [Qemu-devel] [PATCH 05/14] trace: Specify trace file name Stefan Hajnoczi
2010-08-30 13:27 ` [Qemu-devel] [PATCH 06/14] trace: Add trace-file command to open/close/flush trace file Stefan Hajnoczi
2010-08-30 13:27 ` [Qemu-devel] [PATCH 07/14] trace: Add trace file name command-line option Stefan Hajnoczi
2010-08-30 13:27 ` [Qemu-devel] [PATCH 08/14] trace: Add LTTng Userspace Tracer backend Stefan Hajnoczi
2010-08-30 13:27 ` [Qemu-devel] [PATCH 09/14] trace: Add user documentation Stefan Hajnoczi
2010-08-30 13:27 ` [Qemu-devel] [PATCH 10/14] trace: Trace qemu_malloc() and qemu_vmalloc() Stefan Hajnoczi
2010-08-30 13:27 ` [Qemu-devel] [PATCH 11/14] trace: Trace virtio-blk, multiwrite, and paio_submit Stefan Hajnoczi
2010-08-30 13:27 ` [Qemu-devel] [PATCH 12/14] trace: Trace virtqueue operations Stefan Hajnoczi
2010-08-30 13:27 ` [Qemu-devel] [PATCH 13/14] trace: Trace port IO Stefan Hajnoczi
2010-08-30 13:27 ` [Qemu-devel] [PATCH 14/14] trace: Trace entry point of balloon request handler Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTim543Q0f1bW7n3phq4mt7f7RL2A_fgfBQKe4fy_@mail.gmail.com \
    --to=blauwirbel@gmail.com \
    --cc=aliguori@us.ibm.com \
    --cc=prerna@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).