mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Imran Khan <imran.f.khan@oracle.com>
To: geert@linux-m68k.org, vbabka@suse.cz, akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org
Subject: [RFC PATCH 2/2] lib, stackdepot: Add helper to print stack entries.
Date: Wed,  1 Sep 2021 15:19:14 +1000	[thread overview]
Message-ID: <20210901051914.971603-3-imran.f.khan@oracle.com> (raw)
In-Reply-To: <20210901051914.971603-1-imran.f.khan@oracle.com>

To print a stack entries, users of stackdepot, first
use stack_depot_fetch to get a list of stack entries
and then use stack_trace_print to print this list.
Provide a helper in stackdepot to print stack entries
based on stackdepot handle.

Signed-off-by: Imran Khan <imran.f.khan@oracle.com>
Suggested-by: Vlastimil Babka <vbabka@suse.cz>
---
 lib/stackdepot.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lib/stackdepot.c b/lib/stackdepot.c
index 1d42ef9ef766..eab4476b060b 100644
--- a/lib/stackdepot.c
+++ b/lib/stackdepot.c
@@ -214,6 +214,23 @@ static inline struct stack_record *find_stack(struct stack_record *bucket,
 	return NULL;
 }
 
+/**
+ * stack_depot_print - print stack entries from a depot
+ *
+ * @handle:		Stack depot handle which was returned from
+ *			stack_depot_save().
+ *
+ */
+void stack_depot_print(depot_stack_handle_t stack)
+{
+	unsigned long *entries;
+	unsigned int nr_entries;
+
+	nr_entries = stack_depot_fetch(stack, &entries);
+	stack_trace_print(entries, nr_entries, 0);
+}
+EXPORT_SYMBOL_GPL(stack_depot_print);
+
 /**
  * stack_depot_fetch - Fetch stack entries from a depot
  *
-- 
2.30.2


  parent reply	other threads:[~2021-09-01  5:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01  5:19 [RFC PATCH 0/2] lib, stackdepot: check stackdepot handle before accessing slabs Imran Khan
2021-09-01  5:19 ` [RFC PATCH 1/2] " Imran Khan
2021-09-01  8:58   ` Vlastimil Babka
2021-09-02  0:12     ` imran.f.khan
2021-09-01  5:19 ` Imran Khan [this message]
2021-09-01  9:07   ` [RFC PATCH 2/2] lib, stackdepot: Add helper to print stack entries Vlastimil Babka
2021-09-02  0:11     ` imran.f.khan
2021-09-02  8:00       ` Vlastimil Babka

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=20210901051914.971603-3-imran.f.khan@oracle.com \
    --to=imran.f.khan@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vbabka@suse.cz \
    /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®