Skip to content

Commit e447e1d

Browse files
author
Steven Rostedt
committed
tracing: explain why stack tracer is empty
If the stack tracing is disabled (by default) the stack_trace file will only contain the header: # cat /debug/tracing/stack_trace Depth Size Location (0 entries) ----- ---- -------- This can be frustrating to a developer that does not realize that the stack tracer is disabled. This patch adds the following text: # cat /debug/tracing/stack_trace Depth Size Location (0 entries) ----- ---- -------- # # Stack tracer disabled # # To enable the stack tracer, either add 'stacktrace' to the # kernel command line # or 'echo 1 > /proc/sys/kernel/stack_tracer_enabled' # Signed-off-by: Steven Rostedt <srostedt@redhat.com>
1 parent 2da03ec commit e447e1d

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎kernel/trace/trace_stack.c‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,17 @@ static int trace_lookup_stack(struct seq_file *m, long i)
245245
#endif
246246
}
247247

248+
static void print_disabled(struct seq_file *m)
249+
{
250+
seq_puts(m, "#\n"
251+
"# Stack tracer disabled\n"
252+
"#\n"
253+
"# To enable the stack tracer, either add 'stacktrace' to the\n"
254+
"# kernel command line\n"
255+
"# or 'echo 1 > /proc/sys/kernel/stack_tracer_enabled'\n"
256+
"#\n");
257+
}
258+
248259
static int t_show(struct seq_file *m, void *v)
249260
{
250261
long i;
@@ -255,6 +266,10 @@ static int t_show(struct seq_file *m, void *v)
255266
" (%d entries)\n"
256267
" ----- ---- --------\n",
257268
max_stack_trace.nr_entries);
269+
270+
if (!stack_tracer_enabled && !max_stack_size)
271+
print_disabled(m);
272+
258273
return 0;
259274
}
260275

0 commit comments

Comments
 (0)