Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758591Ab3G3JUb (ORCPT ); Tue, 30 Jul 2013 05:20:31 -0400 Received: from LGEMRELSE6Q.lge.com ([156.147.1.121]:47887 "EHLO LGEMRELSE6Q.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758365Ab3G3JTa (ORCPT ); Tue, 30 Jul 2013 05:19:30 -0400 X-AuditID: 9c930179-b7c49ae000000e68-f8-51f7851af3c5 From: Namhyung Kim To: Arnaldo Carvalho de Melo Cc: Peter Zijlstra , Paul Mackerras , Ingo Molnar , Namhyung Kim , LKML , Steven Rostedt , Frederic Weisbecker , Jiri Olsa , David Ahern , Stephane Eranian , Jeremy Eder Subject: [PATCH 14/17] perf ftrace: Add a signal handler for SIGSEGV Date: Tue, 30 Jul 2013 18:19:11 +0900 Message-Id: <1375175954-798-15-git-send-email-namhyung@kernel.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1375175954-798-1-git-send-email-namhyung@kernel.org> References: <1375175954-798-1-git-send-email-namhyung@kernel.org> X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2000 Lines: 71 From: Namhyung Kim It's for debugging purpose. Cc: Steven Rostedt Cc: Frederic Weisbecker Signed-off-by: Namhyung Kim --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/