linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: [PATCH] libtraceevent: Allow stack traces to show offset too
Date: Mon, 19 Dec 2022 22:42:58 -0500	[thread overview]
Message-ID: <20221219224258.68a86565@gandalf.local.home> (raw)

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The stack traces only show the function name and the full address, which
can be useless for running under gdb, because the address could be
randomized, and to find the locations within the functions, the offsets
from the start of the function really need to be displayed and not just
the full address, as the address isn't known by gdb.

Have the function plugin "offset" option affect stack traces too. That
way, there's a way to display the offsets of the functions too.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 plugins/plugin_function.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/plugins/plugin_function.c b/plugins/plugin_function.c
index 7777569f63b5..2d6509b430e4 100644
--- a/plugins/plugin_function.c
+++ b/plugins/plugin_function.c
@@ -233,9 +233,11 @@ trace_stack_handler(struct trace_seq *s, struct tep_record *record,
 			break;
 
 		func = tep_find_function(event->tep, addr);
-		if (func)
-			trace_seq_printf(s, "=> %s (%llx)\n", func, addr);
-		else
+		if (func) {
+			trace_seq_puts(s, "=> ");
+			show_function(s, event->tep, func, addr);
+			trace_seq_printf(s, " (%llx)\n", addr);
+		} else
 			trace_seq_printf(s, "=> %llx\n", addr);
 	}
 
-- 
2.35.1


                 reply	other threads:[~2022-12-20  3:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221219224258.68a86565@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).