]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
tools lib traceevent: Simplify pointer print logic and fix %pF
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 12 Jan 2018 00:47:45 +0000 (19:47 -0500)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 17 Jan 2018 13:22:03 +0000 (10:22 -0300)
When processing %pX in pretty_print(), simplify the logic slightly by
incrementing the ptr to the format string if isalnum(ptr[1]) is true.
This follows the logic a bit more closely to what is in the kernel.

Also, this fixes a small bug where %pF was not giving the offset of the
function.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/20180112004822.260262257@goodmis.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/lib/traceevent/event-parse.c

index 87757eabbb08e63abeae5c4d51548af3c6982b46..8757dd64e42ce862dfe731287f6390e4f9328b2f 100644 (file)
@@ -4956,21 +4956,22 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
                                else
                                        ls = 2;
 
-                               if (*(ptr+1) == 'F' || *(ptr+1) == 'f' ||
-                                   *(ptr+1) == 'S' || *(ptr+1) == 's') {
+                               if (isalnum(ptr[1]))
                                        ptr++;
+
+                               if (*ptr == 'F' || *ptr == 'f' ||
+                                   *ptr == 'S' || *ptr == 's') {
                                        show_func = *ptr;
-                               } else if (*(ptr+1) == 'M' || *(ptr+1) == 'm') {
-                                       print_mac_arg(s, *(ptr+1), data, size, event, arg);
-                                       ptr++;
+                               } else if (*ptr == 'M' || *ptr == 'm') {
+                                       print_mac_arg(s, *ptr, data, size, event, arg);
                                        arg = arg->next;
                                        break;
-                               } else if (*(ptr+1) == 'I' || *(ptr+1) == 'i') {
+                               } else if (*ptr == 'I' || *ptr == 'i') {
                                        int n;
 
-                                       n = print_ip_arg(s, ptr+1, data, size, event, arg);
+                                       n = print_ip_arg(s, ptr, data, size, event, arg);
                                        if (n > 0) {
-                                               ptr += n;
+                                               ptr += n - 1;
                                                arg = arg->next;
                                                break;
                                        }