mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vegard Nossum <vegard.nossum@oracle.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Vegard Nossum <vegard.nossum@oracle.com>
Subject: [PATCH] tracing: use %pF in trace_dump_stack()
Date: Tue,  9 May 2017 10:50:04 +0200	[thread overview]
Message-ID: <20170509085004.7891-1-vegard.nossum@oracle.com> (raw)

When using trace_dump_stack() you currently just get a list of function
names.

It can be very useful to know exactly where a call came from, especially
if there are multiple calls from one function to another.

By switching trace_dump_stack() to use %pF we get the function name and
the offset, which can also be further processed to give exact line number
information, like this:

    <...>-1087    3.... 3270529us : <stack trace>
     => pty_write+0x45/0x50
     => n_tty_write+0x358/0x470
     => tty_write+0x189/0x2f0
     => __vfs_write+0x23/0x120
     => vfs_write+0xb3/0x1b0
     => SyS_write+0x44/0xa0
     => entry_SYSCALL_64_fastpath+0x18/0xad

    $ scripts/faddr2line vmlinux tty_write+0x189/0x2f0
    tty_write+0x189/0x2f0:
    do_tty_write at drivers/tty/tty_io.c:1174
     (inlined by) tty_write at drivers/tty/tty_io.c:1257

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
---
 kernel/trace/trace_output.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 02a4aeb22c47..879909efed33 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -1073,9 +1073,7 @@ static enum print_line_t trace_stack_print(struct trace_iterator *iter,
 		if (trace_seq_has_overflowed(s))
 			break;
 
-		trace_seq_puts(s, " => ");
-		seq_print_ip_sym(s, *p, flags);
-		trace_seq_putc(s, '\n');
+		trace_seq_printf(s, " => %pF\n", (void *) *p);
 	}
 
 	return trace_handle_return(s);
-- 
2.12.0.rc0

             reply	other threads:[~2017-05-09  8:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-09  8:50 Vegard Nossum [this message]
2017-05-09 13:41 ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170509085004.7891-1-vegard.nossum@oracle.com \
    --to=vegard.nossum@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®