On 9/2/21 02:01, Imran Khan wrote:
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.
Also change above mentioned users to use this helper.
Agree. I have incorporated this suggestion in latest version [1]+/**
+ * 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);
Maybe this should also skip stack_trace_print when nr_entries is 0, to avoid
the warning. While the callers added by this patch check handle != 0, future
ones might not.