Skip to content

Commit b295c3e

Browse files
Sakari Ailusacmel
authored andcommitted
tools lib traceevent: Convert remaining %p[fF] users to %p[sS]
There are no in-kernel %p[fF] users left. Convert the traceevent tool, too, to align with the kernel. Signed-off-by: Sakari Ailus <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: [email protected] Cc: Heikki Krogerus <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Joe Perches <[email protected]> Cc: [email protected] Cc: [email protected] Cc: Namhyung Kim <[email protected]> Cc: Petr Mladek <[email protected]> Cc: Rafael J. Wysocki <[email protected]> Cc: Rob Herring <[email protected]> Cc: Steven Rostedt (VMware) <[email protected]> Cc: Tzvetomir Stoyanov <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 055c67e commit b295c3e

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

tools/lib/traceevent/Documentation/libtraceevent-func_apis.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ parser context.
5959

6060
The _tep_register_function()_ function registers a function name mapped to an
6161
address and (optional) module. This mapping is used in case the function tracer
62-
or events have "%pF" or "%pS" parameter in its format string. It is common to
63-
pass in the kallsyms function names with their corresponding addresses with this
62+
or events have "%pS" parameter in its format string. It is common to pass in
63+
the kallsyms function names with their corresponding addresses with this
6464
function. The _tep_ argument is the trace event parser context. The _name_ is
65-
the name of the function, the string is copied internally. The _addr_ is
66-
the start address of the function. The _mod_ is the kernel module
67-
the function may be in (NULL for none).
65+
the name of the function, the string is copied internally. The _addr_ is the
66+
start address of the function. The _mod_ is the kernel module the function may
67+
be in (NULL for none).
6868

6969
The _tep_register_print_string()_ function registers a string by the address
7070
it was stored in the kernel. Some strings internal to the kernel with static

tools/lib/traceevent/event-parse.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4367,10 +4367,20 @@ static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, s
43674367
switch (*ptr) {
43684368
case 's':
43694369
case 'S':
4370-
case 'f':
4371-
case 'F':
43724370
case 'x':
43734371
break;
4372+
case 'f':
4373+
case 'F':
4374+
/*
4375+
* Pre-5.5 kernels use %pf and
4376+
* %pF for printing symbols
4377+
* while kernels since 5.5 use
4378+
* %pfw for fwnodes. So check
4379+
* %p[fF] isn't followed by 'w'.
4380+
*/
4381+
if (ptr[1] != 'w')
4382+
break;
4383+
/* fall through */
43744384
default:
43754385
/*
43764386
* Older kernels do not process
@@ -4487,12 +4497,12 @@ get_bprint_format(void *data, int size __maybe_unused,
44874497

44884498
printk = find_printk(tep, addr);
44894499
if (!printk) {
4490-
if (asprintf(&format, "%%pf: (NO FORMAT FOUND at %llx)\n", addr) < 0)
4500+
if (asprintf(&format, "%%ps: (NO FORMAT FOUND at %llx)\n", addr) < 0)
44914501
return NULL;
44924502
return format;
44934503
}
44944504

4495-
if (asprintf(&format, "%s: %s", "%pf", printk->printk) < 0)
4505+
if (asprintf(&format, "%s: %s", "%ps", printk->printk) < 0)
44964506
return NULL;
44974507

44984508
return format;

0 commit comments

Comments
 (0)