From patchwork Mon Mar 3 09:53:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 3752591 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1AD90BF13A for ; Mon, 3 Mar 2014 09:56:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 27A902024D for ; Mon, 3 Mar 2014 09:56:20 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 19415201F0 for ; Mon, 3 Mar 2014 09:56:18 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKPaF-0005FM-11; Mon, 03 Mar 2014 09:54:51 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKPa0-000168-Ai; Mon, 03 Mar 2014 09:54:36 +0000 Received: from mail-pa0-f52.google.com ([209.85.220.52]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKPZd-0000z3-Nr for linux-arm-kernel@lists.infradead.org; Mon, 03 Mar 2014 09:54:20 +0000 Received: by mail-pa0-f52.google.com with SMTP id rd3so2069132pab.39 for ; Mon, 03 Mar 2014 01:53:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Xfy5cyfaKI0MRh/V7O8JG9qUGhubacuR4GJziaYXUUQ=; b=DsumyD54d2oC/eLidHE9KukbJKLddKYJn0MEx9WvDtfbdZoQLUT6i/6jNT0LbjRJBz 9zSKxrEm3rsCzupRQsLVILGtFZEuQxLOjVt48PxPQPadbDS16i0ByfdnjYgsqlbnX0ZE 9Qot6SHqZNIOqGK30ANsmstdtROu4TY4yUnVgH2FkLbFwn80VZKted4PYXu+B5Xi/fGE Ctk3H7xdi68OZAbwVAtPLsn933mZacJSRXWgoELnRkcJQML0rdHv5NWlCmwDz0Hfjjhf UtAsd4fNUmKFulWZKA0Bv1TAhpZWEdQHc3y6sFJ119zBoSOywhhyAqrFdBZkVd8evVqM mXsQ== X-Gm-Message-State: ALoCoQkdiGleNDOz3c2tNWYLwNjfGygF6XsLI4I+05EBI4rbNSzVCD7v6litC9r+/VBHpZSXbKds X-Received: by 10.66.145.199 with SMTP id sw7mr2470916pab.143.1393840432387; Mon, 03 Mar 2014 01:53:52 -0800 (PST) Received: from localhost.localdomain (z88l218.static.ctm.net. [202.175.88.218]) by mx.google.com with ESMTPSA id ha11sm2802046pbd.17.2014.03.03.01.53.46 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 03 Mar 2014 01:53:51 -0800 (PST) From: Jean Pihet To: linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Arnaldo , Ingo Molnar , Jiri Olsa Subject: [PATCH 3/3] perf tools: Add libdw DWARF post unwind support for ARM Date: Mon, 3 Mar 2014 10:53:23 +0100 Message-Id: <1393840403-26639-4-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1393840403-26639-1-git-send-email-jean.pihet@linaro.org> References: <1393840403-26639-1-git-send-email-jean.pihet@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140303_045413_933092_B4544633 X-CRM114-Status: GOOD ( 11.91 ) X-Spam-Score: 1.8 (+) Cc: steve.capper@linaro.org, Peter Zijlstra , Corey Ashford , Frederic Weisbecker , patches@linaro.org, Will Deacon , Paul Mackerras , David Ahern , Namhyung Kim , Jean Pihet X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_00,KHOP_BIG_TO_CC, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY, URIBL_BLACK autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Adding libdw DWARF post unwind support, which is part of elfutils-devel/libdw-dev package from version 0.158. The new code is contained in unwin-libdw.c object, and implements unwind__get_entries unwind interface function. Signed-off-by: Jean Pihet Cc: Jiri Olsa Cc: Corey Ashford Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Arnaldo Carvalho de Melo Cc: David Ahern --- tools/perf/arch/arm/Makefile | 5 +++++ tools/perf/arch/arm/util/unwind-libdw.c | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tools/perf/arch/arm/util/unwind-libdw.c diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile index 221f21d..09d6215 100644 --- a/tools/perf/arch/arm/Makefile +++ b/tools/perf/arch/arm/Makefile @@ -4,6 +4,11 @@ LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o endif ifndef NO_LIBUNWIND LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o +endif +ifndef NO_LIBDW_DWARF_UNWIND +LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o +endif +ifndef NO_DWARF_UNWIND LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o endif diff --git a/tools/perf/arch/arm/util/unwind-libdw.c b/tools/perf/arch/arm/util/unwind-libdw.c new file mode 100644 index 0000000..b4176c6 --- /dev/null +++ b/tools/perf/arch/arm/util/unwind-libdw.c @@ -0,0 +1,36 @@ +#include +#include "../../util/unwind-libdw.h" +#include "../../util/perf_regs.h" + +bool libdw__arch_set_initial_registers(Dwfl_Thread *thread, void *arg) +{ + struct unwind_info *ui = arg; + struct regs_dump *user_regs = &ui->sample->user_regs; + Dwarf_Word dwarf_regs[PERF_REG_ARM_MAX]; + +#define REG(r) ({ \ + Dwarf_Word val = 0; \ + perf_reg_value(&val, user_regs, PERF_REG_ARM_##r); \ + val; \ +}) + + dwarf_regs[0] = REG(R0); + dwarf_regs[1] = REG(R1); + dwarf_regs[2] = REG(R2); + dwarf_regs[3] = REG(R3); + dwarf_regs[4] = REG(R4); + dwarf_regs[5] = REG(R5); + dwarf_regs[6] = REG(R6); + dwarf_regs[7] = REG(R7); + dwarf_regs[8] = REG(R8); + dwarf_regs[9] = REG(R9); + dwarf_regs[10] = REG(R10); + dwarf_regs[11] = REG(FP); + dwarf_regs[12] = REG(IP); + dwarf_regs[13] = REG(SP); + dwarf_regs[14] = REG(LR); + dwarf_regs[15] = REG(PC); + + return dwfl_thread_state_registers(thread, 0, PERF_REG_ARM_MAX, + dwarf_regs); +}