perf tools: Introduce dump_stack signal helper

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

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-79kjmerlw6d88csyx1afzwvn@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 28083681
...@@ -269,6 +269,13 @@ void dump_stack(void) ...@@ -269,6 +269,13 @@ void dump_stack(void)
void dump_stack(void) {} void dump_stack(void) {}
#endif #endif
void sighandler_dump_stack(int sig)
{
psignal(sig, "perf");
dump_stack();
exit(sig);
}
void get_term_dimensions(struct winsize *ws) void get_term_dimensions(struct winsize *ws)
{ {
char *s = getenv("LINES"); char *s = getenv("LINES");
......
...@@ -277,6 +277,7 @@ char *ltrim(char *s); ...@@ -277,6 +277,7 @@ char *ltrim(char *s);
char *rtrim(char *s); char *rtrim(char *s);
void dump_stack(void); void dump_stack(void);
void sighandler_dump_stack(int sig);
extern unsigned int page_size; extern unsigned int page_size;
extern int cacheline_size; extern int cacheline_size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment