tools lib traceevent: Check string is really printable
authorNamhyung Kim <namhyung.kim@lge.com>
Fri, 22 Jun 2012 08:10:15 +0000 (17:10 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 29 Jun 2012 16:28:12 +0000 (13:28 -0300)
commit600da3cfe19496485c5d8d52ff703590a0bd53f6
tree6c5dd5f1e4ce2d85b247024cbecfc75e3d3e606a
parent860df5833e461beba4bf9f3304a7919da98fd789
tools lib traceevent: Check string is really printable

When libtraceevent parses format fields, it assumes that array of 1 byte
is string but it's not always true. The kvm_emulate_insn contains 15 u8
array of insn that contains (binary) instructions. Thus when it's
printed, it'll have broken output like below:

  kvm_emulate_insn:     [FAILED TO PARSE] rip=3238197797 csbase=0 len=2 \
  insn=<89>P^]<B4>& flags=5 failed=0

With this patch:

  kvm_emulate_insn:     [FAILED TO PARSE] rip=3238197797 csbase=0 len=2 \
  insn=ARRAY[89, 10, 5d, c3, 8d, b4, 26, 00, 00, 00, 00, 55, 89, e5, 3e] flags=5 failed=0

Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1340352615-20737-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/lib/traceevent/event-parse.c