Re: [PATCH 1/3] perf script python: Fix string vs byte array resolving

2016-07-18 Thread Jiri Pirko
Sat, Jul 16, 2016 at 06:11:18PM CEST, jo...@kernel.org wrote: >Jirka reported that python code returns all arrays as strings. >This makes impossible to get all items for byte array tracepoint >field containing 0x00 value item. > >Fixing this by scanning full length of the array and returning >it as

[PATCH 1/3] perf script python: Fix string vs byte array resolving

2016-07-16 Thread Jiri Olsa
Jirka reported that python code returns all arrays as strings. This makes impossible to get all items for byte array tracepoint field containing 0x00 value item. Fixing this by scanning full length of the array and returning it as PyByteArray object in case non printable byte is found. Link: http

Re: [PATCH 1/3] perf script python: Fix string vs byte array resolving

2016-07-16 Thread Jiri Olsa
On Fri, Jul 15, 2016 at 01:18:40PM -0400, Steven Rostedt wrote: > On Fri, 15 Jul 2016 09:29:55 +0200 > Jiri Olsa wrote: > > > + if (field->flags & FIELD_IS_STRING && > > + is_printable_array(data + offset, len)) { > > + obj = PyStr

Re: [PATCH 1/3] perf script python: Fix string vs byte array resolving

2016-07-15 Thread Jiri Pirko
Fri, Jul 15, 2016 at 09:29:55AM CEST, jo...@kernel.org wrote: >Jirka reported that python code returns all arrays as strings. >This makes impossible to get all items for byte array tracepoint >field containing 0x00 value item. > >Fixing this by scanning full length of the array and returning >it as

Re: [PATCH 1/3] perf script python: Fix string vs byte array resolving

2016-07-15 Thread Steven Rostedt
On Fri, 15 Jul 2016 18:13:10 +0200 Jiri Olsa wrote: > On Fri, Jul 15, 2016 at 12:02:31PM -0400, Steven Rostedt wrote: > > SNIP > > > > for "AA\1\0" this returns "1" although that should return "0". > > > > > > orig len 4 > > > decremented len 3 > > > for: > > > 0 1 > > > > > > index 2 would n

Re: [PATCH 1/3] perf script python: Fix string vs byte array resolving

2016-07-15 Thread Steven Rostedt
On Fri, 15 Jul 2016 09:29:55 +0200 Jiri Olsa wrote: > + if (field->flags & FIELD_IS_STRING && > + is_printable_array(data + offset, len)) { > + obj = PyString_FromString((char *) data + > offset); Hmm. As I stated, It is po

Re: [PATCH 1/3] perf script python: Fix string vs byte array resolving

2016-07-15 Thread Arnaldo Carvalho de Melo
Em Fri, Jul 15, 2016 at 01:37:31PM -0300, Arnaldo Carvalho de Melo escreveu: > Em Fri, Jul 15, 2016 at 06:13:10PM +0200, Jiri Olsa escreveu: > > On Fri, Jul 15, 2016 at 12:02:31PM -0400, Steven Rostedt wrote: > > > > SNIP > > > > > > for "AA\1\0" this returns "1" although that should return "0".

Re: [PATCH 1/3] perf script python: Fix string vs byte array resolving

2016-07-15 Thread Arnaldo Carvalho de Melo
Em Fri, Jul 15, 2016 at 06:13:10PM +0200, Jiri Olsa escreveu: > On Fri, Jul 15, 2016 at 12:02:31PM -0400, Steven Rostedt wrote: > > SNIP > > > > for "AA\1\0" this returns "1" although that should return "0". > > > > > > orig len 4 > > > decremented len 3 > > > for: > > > 0 1 > > > > > > index 2

Re: [PATCH 1/3] perf script python: Fix string vs byte array resolving

2016-07-15 Thread Jiri Olsa
On Fri, Jul 15, 2016 at 12:02:31PM -0400, Steven Rostedt wrote: SNIP > > for "AA\1\0" this returns "1" although that should return "0". > > > > orig len 4 > > decremented len 3 > > for: > > 0 1 > > > > index 2 would not be inspected. Or am I missing something? > > > > I think that the for chec

Re: [PATCH 1/3] perf script python: Fix string vs byte array resolving

2016-07-15 Thread Steven Rostedt
On Fri, 15 Jul 2016 17:51:10 +0200 Jiri Pirko wrote: > Fri, Jul 15, 2016 at 09:29:55AM CEST, jo...@kernel.org wrote: > >Jirka reported that python code returns all arrays as strings. > >This makes impossible to get all items for byte array tracepoint > >field containing 0x00 value item. > > > >Fi

Re: [PATCH 1/3] perf script python: Fix string vs byte array resolving

2016-07-15 Thread Steven Rostedt
On Fri, 15 Jul 2016 09:29:55 +0200 Jiri Olsa wrote: > Jirka reported that python code returns all arrays as strings. > This makes impossible to get all items for byte array tracepoint > field containing 0x00 value item. > > Fixing this by scanning full length of the array and returning > it as P

Re: [PATCH 1/3] perf script python: Fix string vs byte array resolving

2016-07-15 Thread Jiri Olsa
On Fri, Jul 15, 2016 at 09:29:55AM +0200, Jiri Olsa wrote: > Jirka reported that python code returns all arrays as strings. > This makes impossible to get all items for byte array tracepoint > field containing 0x00 value item. > > Fixing this by scanning full length of the array and returning > it

[PATCH 1/3] perf script python: Fix string vs byte array resolving

2016-07-15 Thread Jiri Olsa
Jirka reported that python code returns all arrays as strings. This makes impossible to get all items for byte array tracepoint field containing 0x00 value item. Fixing this by scanning full length of the array and returning it as PyByteArray object in case non printable byte is found. Cc: Steven