lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 3 Jun 2014 20:55:05 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Namhyung Kim <namhyung@...nel.org>
Cc:	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Ingo Molnar <mingo@...nel.org>,
	Paul Mackerras <paulus@...ba.org>,
	Namhyung Kim <namhyung.kim@....com>,
	LKML <linux-kernel@...r.kernel.org>,
	Tom Zanussi <tzanussi@...il.com>,
	Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Subject: Re: [PATCH] perf script/python: Print array argument as string

On Thu, May 29, 2014 at 01:44:55PM +0900, Namhyung Kim wrote:
> With the Sebastian's change of handling num array argument (of raw
> syscall enter), the script still failed to work like this:
> 
>   $ perf record -e raw_syscalls:* sleep 1
>   $ perf script -g python
>   $ perf script -s perf-script.py
>   ...
>   Traceback (most recent call last):
>     File "perf-script.py", line 42, in raw_syscalls__sys_enter
>       (id, args),
>   TypeError: %u format: a number is required, not list
>   Fatal Python error: problem in Python trace event handler
>   Aborted (core dumped)
> 
> This is because the generated script tries to print the array arg as
> unsigned integer (%u).  Since the python seems to convert arguments to
> strings by default, just using %s solved the problem for me.
> 
> Cc: Tom Zanussi <tzanussi@...il.com>
> Cc: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>

ack/test anyone? ;-)

thanks,
jirka

> ---
>  tools/perf/util/scripting-engines/trace-event-python.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
> index 40a815a5360b..a22ab53788bf 100644
> --- a/tools/perf/util/scripting-engines/trace-event-python.c
> +++ b/tools/perf/util/scripting-engines/trace-event-python.c
> @@ -649,6 +649,7 @@ static int python_generate_script(struct pevent *pevent, const char *outfile)
>  			fprintf(ofp, "%s=", f->name);
>  			if (f->flags & FIELD_IS_STRING ||
>  			    f->flags & FIELD_IS_FLAG ||
> +			    f->flags & FIELD_IS_ARRAY ||
>  			    f->flags & FIELD_IS_SYMBOLIC)
>  				fprintf(ofp, "%%s");
>  			else if (f->flags & FIELD_IS_SIGNED)
> -- 
> 1.9.2
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists