From: Arnaldo Carvalho de Melo <[email protected]>

To use in stdio based tools, like 'trace'.

Cc: Adrian Hunter <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Don Zickus <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/util/util.c | 7 +++++++
 tools/perf/util/util.h | 1 +
 2 files changed, 8 insertions(+)

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;
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to