From patchwork Fri May 16 08:41:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 4189381 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 44B3FBFF02 for ; Fri, 16 May 2014 08:44:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 72AAB202E6 for ; Fri, 16 May 2014 08:44:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (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 8EC5020295 for ; Fri, 16 May 2014 08:44:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WlDir-00072m-Ep; Fri, 16 May 2014 08:42:33 +0000 Received: from mail-ee0-f44.google.com ([74.125.83.44]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WlDiE-0006hp-LA for linux-arm-kernel@lists.infradead.org; Fri, 16 May 2014 08:41:55 +0000 Received: by mail-ee0-f44.google.com with SMTP id c41so1317141eek.3 for ; Fri, 16 May 2014 01:41:32 -0700 (PDT) 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=gjvKNG3GU9E0fCmLkPpUD3LTeZ6RJOk2l3yEbuP8P3M=; b=hmrukl+fSrJ1mldpjapK8Z5YzAfN1qlbSiscEZNX43/gm8nKThYHsg9niwx3sVnMRc tOPB976jyGN1d68W34GOyhLh1rqk+Tbxe/0th04V79Zir4h/WGJB0rOsjrt5ji4Y9/yk JAfdFKp5sthWiAvQ6Wh3Egsrpp0zoVFFWVLHoOaVCHQzj6LnQQB8B3WcI50R1d3qPqQU S0fL0Tny9c/wsgelrT/IV0hyVLop0SO9eHpH8q/H/vRDEY301BOpRYZJyVt0kMrspwKx Q9Yfyv5eZs4hnYQHyyGYTVCfyOkpLKUMJw3DRcxsZwvpkjXKdDiBBra0d7zn0cg4GByb tnOQ== X-Gm-Message-State: ALoCoQmZ9vTG9JpQMasq1RgaPl8QFCohdvECM21QGVc3Eg6vzAKqfO3HbktQHOT/Kas5L6M7FkYa X-Received: by 10.14.198.6 with SMTP id u6mr2343567een.60.1400229692369; Fri, 16 May 2014 01:41:32 -0700 (PDT) Received: from localhost.localdomain (74.16-201-80.adsl-dyn.isp.belgacom.be. [80.201.16.74]) by mx.google.com with ESMTPSA id u1sm18410354eex.31.2014.05.16.01.41.29 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 16 May 2014 01:41:31 -0700 (PDT) From: Jean Pihet To: linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Will Deacon , Jiri Olsa , Ingo Molnar , Arnaldo Carvalho de Melo Subject: [PATCH 4/4] perf tools: Add libdw DWARF post unwind support for ARM Date: Fri, 16 May 2014 10:41:12 +0200 Message-Id: <1400229672-16104-4-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1400229672-16104-1-git-send-email-jean.pihet@linaro.org> References: <1400229672-16104-1-git-send-email-jean.pihet@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140516_014154_884347_3C5A1E56 X-CRM114-Status: GOOD ( 12.38 ) X-Spam-Score: -0.7 (/) Cc: Peter Zijlstra , Corey Ashford , Frederic Weisbecker , Paul Mackerras , Arnaldo Carvalho de Melo , 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=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Reviewed-by: Will Deacon 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); +}