lkml.org 
[lkml]   [2013]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 14/17] perf ftrace: Add a signal handler for SIGSEGV
Date
From: Namhyung Kim <namhyung.kim@lge.com>

It's for debugging purpose.

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/builtin-ftrace.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
index ad71d0412a7e..ed889d4dd0ba 100644
--- a/tools/perf/builtin-ftrace.c
+++ b/tools/perf/builtin-ftrace.c
@@ -41,6 +41,13 @@ struct perf_ftrace {

static bool done;

+static void sig_exit(int sig)
+{
+ psignal(sig, "perf");
+ signal(sig, SIG_DFL);
+ raise(sig);
+}
+
static void sig_handler(int sig __maybe_unused)
{
done = true;
@@ -228,6 +235,7 @@ static int do_ftrace_live(struct perf_ftrace *ftrace)
signal(SIGUSR1, sig_handler);
signal(SIGCHLD, sig_handler);
signal(SIGPIPE, sig_handler);
+ signal(SIGSEGV, sig_exit);

if (setup_tracing_files(ftrace) < 0)
goto out_reset;
@@ -613,6 +621,7 @@ static int do_ftrace_record(struct perf_ftrace *ftrace)
signal(SIGINT, sig_handler);
signal(SIGUSR1, sig_handler);
signal(SIGCHLD, sig_handler);
+ signal(SIGSEGV, sig_exit);

if (setup_tracing_files(ftrace) < 0)
goto out_reset;
@@ -1120,6 +1129,8 @@ static int do_ftrace_show(struct perf_ftrace *ftrace)
},
};

+ signal(SIGSEGV, sig_exit);
+
canonicalize_directory_name(ftrace->dirname);

scnprintf(buf, sizeof(buf), "%s.dir/perf.header", ftrace->dirname);
@@ -1211,6 +1222,8 @@ static int do_ftrace_report(struct perf_ftrace *ftrace)
struct machine *machine;
struct dso *dso;

+ signal(SIGSEGV, sig_exit);
+
canonicalize_directory_name(ftrace->dirname);

scnprintf(buf, sizeof(buf), "%s.dir/perf.header", ftrace->dirname);
--
1.7.11.7


\
 
 \ /
  Last update: 2013-07-30 12:01    [W:0.133 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site