diff mbox series

trace-cmd libtraceevent: Fix bprint '#' parsing

Message ID 20201113132953.2371-1-vincent.whitchurch@axis.com (mailing list archive)
State Accepted
Commit d4b5921344ed143bf2686ea9fa39cb6ea146b02f
Headers show
Series trace-cmd libtraceevent: Fix bprint '#' parsing | expand

Commit Message

Vincent Whitchurch Nov. 13, 2020, 1:29 p.m. UTC
Fix handling of '#' in bprint format specifiers.

For example, with this:

 trace_printk("jiffies %lu pending %#x\n", jiffies, pending);

Before:

  bprint: __do_softirq: jiffies 4294919108 pending x
  ...
  bprint: [FAILED TO PARSE] ip=... fmt=... buf=ARRAY[]

After:

  bprint: __do_softirq: jiffies 4294919108 pending 0x4
  ...
  bprint: __do_softirq: jiffies 4294919109 pending 0x4

Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
---
 lib/traceevent/event-parse.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Steven Rostedt Nov. 13, 2020, 2:25 p.m. UTC | #1
On Fri, 13 Nov 2020 14:29:53 +0100
Vincent Whitchurch <vincent.whitchurch@axis.com> wrote:

> Fix handling of '#' in bprint format specifiers.
> 
> For example, with this:
> 
>  trace_printk("jiffies %lu pending %#x\n", jiffies, pending);
> 
> Before:
> 
>   bprint: __do_softirq: jiffies 4294919108 pending x
>   ...
>   bprint: [FAILED TO PARSE] ip=... fmt=... buf=ARRAY[]
> 
> After:
> 
>   bprint: __do_softirq: jiffies 4294919108 pending 0x4
>   ...
>   bprint: __do_softirq: jiffies 4294919109 pending 0x4

Thanks Vincent!

Note, I'll be adding this to both the trace-cmd tree and the
libtraceevent.git repo (I need to update the website to reflect this).

  git://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git

-- Steve


> 
> Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
> ---
>  lib/traceevent/event-parse.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/traceevent/event-parse.c b/lib/traceevent/event-parse.c
> index 06fa3dd..a62d2f7 100644
> --- a/lib/traceevent/event-parse.c
> +++ b/lib/traceevent/event-parse.c
> @@ -4456,6 +4456,8 @@ static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, s
>  				goto process_again;
>  			case '.':
>  				goto process_again;
> +			case '#':
> +				goto process_again;
>  			case 'z':
>  			case 'Z':
>  				ls = 1;
diff mbox series

Patch

diff --git a/lib/traceevent/event-parse.c b/lib/traceevent/event-parse.c
index 06fa3dd..a62d2f7 100644
--- a/lib/traceevent/event-parse.c
+++ b/lib/traceevent/event-parse.c
@@ -4456,6 +4456,8 @@  static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, s
 				goto process_again;
 			case '.':
 				goto process_again;
+			case '#':
+				goto process_again;
 			case 'z':
 			case 'Z':
 				ls = 1;