lkml.org 
[lkml]   [2012]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH 0/2] libtraceevent/perf: Add support for trace-cmd plugins
From
Date
On Tue, 2012-06-19 at 14:41 +0900, Namhyung Kim wrote:
> On Mon, 18 Jun 2012 22:16:11 -0400, Steven Rostedt wrote:
> > We can be a bit better at the raw print, sure. Here's the format that's
> > there:
> >
> > field:__u64 rip; offset:16; size:8; signed:0;
> > field:__u32 csbase; offset:24; size:4; signed:0;
> > field:__u8 len; offset:28; size:1; signed:0;
> > field:__u8 insn[15]; offset:29; size:15; signed:0;
> > field:__u8 flags; offset:44; size:1; signed:0;
> > field:__u8 failed; offset:45; size:1; signed:0;
> >
> > It treated __u* as decimal numbers, but it also saw that insn[15] was an
> > array, and with single bytes at that. So it thought it was a string, and
> > tried to print it out as such.
> >
> > We can change the heuristics of this to make it more readable.
> >
>
> Right. The current heuristic treats an u8 array as a string:
>
> static int field_is_string(struct format_field *field)
> {
> if ((field->flags & FIELD_IS_ARRAY) &&
> (strstr(field->type, "char") || strstr(field->type, "u8") ||
> strstr(field->type, "s8")))
> return 1;
>
> return 0;
> }
>
> Do you want to get rid of u8 from the function? Or is there a
> better way?
>

We could simply check if all the characters in the array passes
'isprint()' and if it does then print the string, otherwise print the
hex. Do this for all events, and if it one fails, then mark it always to
print hex.

-- Steve




\
 
 \ /
  Last update: 2012-06-19 14:41    [W:0.062 / U:0.864 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site