From: Arnaldo Carvalho de Melo Date: Tue, 24 Feb 2015 18:34:23 +0000 (-0300) Subject: perf tools: Introduce dump_stack signal helper X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=07c1a0dadfce976e9877c55ce5212dd14753c91d;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git perf tools: Introduce dump_stack signal helper To use in stdio based tools, like 'trace'. Cc: Adrian Hunter Cc: Borislav Petkov Cc: David Ahern Cc: Don Zickus Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Namhyung Kim Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-79kjmerlw6d88csyx1afzwvn@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 92db3f156b63..4ee6d0d4c993 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c @@ -269,6 +269,13 @@ void dump_stack(void) void dump_stack(void) {} #endif +void sighandler_dump_stack(int sig) +{ + psignal(sig, "perf"); + dump_stack(); + exit(sig); +} + void get_term_dimensions(struct winsize *ws) { char *s = getenv("LINES"); diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 73c2f8e557ab..fbd598afc606 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h @@ -277,6 +277,7 @@ char *ltrim(char *s); char *rtrim(char *s); void dump_stack(void); +void sighandler_dump_stack(int sig); extern unsigned int page_size; extern int cacheline_size;