In case of a ftrace configuration problem, the description of the error is printed in the error_log file. It is useful to dump all recorded errors in "trace-cmd stat" command. Reported-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207291 Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@xxxxxxxxx> --- Documentation/trace-cmd-stat.1.txt | 2 ++ tracecmd/trace-stat.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/Documentation/trace-cmd-stat.1.txt b/Documentation/trace-cmd-stat.1.txt index 004fbaa5..2f1a9c8b 100644 --- a/Documentation/trace-cmd-stat.1.txt +++ b/Documentation/trace-cmd-stat.1.txt @@ -43,6 +43,8 @@ system. The status that it shows is: *Uprobes:* Shows any uprobes that are defined for tracing. +*Error log:* Dump the content of ftrace error_log file. + SEE ALSO -------- trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1), diff --git a/tracecmd/trace-stat.c b/tracecmd/trace-stat.c index 3f7b3493..c5057978 100644 --- a/tracecmd/trace-stat.c +++ b/tracecmd/trace-stat.c @@ -897,6 +897,22 @@ static void report_traceon(struct buffer_instance *instance) free(str); } +static void report_errorlog(struct buffer_instance *instance) +{ + char *str; + + if (!tracefs_file_exists(instance->tracefs, "error_log")) + return; + str = get_instance_file_content(instance, "error_log"); + if (!str) + return; + + if (str[0]) + printf("\nError log:\n%s\n", str); + + free(str); +} + static void stat_instance(struct buffer_instance *instance) { if (instance != &top_instance) { @@ -920,6 +936,7 @@ static void stat_instance(struct buffer_instance *instance) report_kprobes(instance); report_uprobes(instance); report_traceon(instance); + report_errorlog(instance); } void trace_stat (int argc, char **argv) -- 2.25.1