Skip to contentSkip to conversation

trace-cmd libtraceevent: Fix bprint '#' parsing

PATCH In review Vincent Whitchurch 2 participants 2 messages Nov 13, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd libtraceevent: Fix bprint '#' parsing

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

---
 lib/traceevent/event-parse.c | 2 ++
 1 file changed, 2 insertions(+)
lib/traceevent/event-parse.c +2 -0
index 06fa3dd..a62d2f7 100644
@@ -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;
Signature · 1 line
2.28.0
#1 lore raw
Quoted 12 lines · On Fri, 13 Nov 2020 14:29:53 +0100 Vincent Whitchurch…

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[]

Quoted 5 lines

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

Quoted 19 lines
---
 lib/traceevent/event-parse.c | 2 ++
 1 file changed, 2 insertions(+)
lib/traceevent/event-parse.c +2 -0
index 06fa3dd..a62d2f7 100644
@@ -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;