qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] Add wildcard trace event support


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH] Add wildcard trace event support
Date: Fri, 28 Oct 2011 10:47:07 +0100

On Thu, Oct 20, 2011 at 10:38 AM, Mark Wu <address@hidden> wrote:
>  The "tracetool" script automates tedious trace event code generation and also
> diff --git a/trace/simple.c b/trace/simple.c
> index b639dda..869e315 100644
> --- a/trace/simple.c
> +++ b/trace/simple.c
> @@ -324,14 +324,29 @@ void trace_print_events(FILE *stream, fprintf_function 
> stream_printf)
>  bool trace_event_set_state(const char *name, bool state)
>  {
>     unsigned int i;
> -
> +    unsigned int len;
> +    bool wildcard = false;
> +    bool matched = false;
> +
> +    len = strlen(name);
> +    if (name[len-1] == '*') {

I think it's worth making a small change:

if (len > 0 && name[len - 1] == '*') {

Normally strlen(name) > 0 but just in case we should prevent accessing name[-1].

Seems fine otherwise.  Perhaps we can figure out how to share code
between simple.c and stderr.c in the future.

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]