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: 25599 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6301020540 for ; Mon, 3 Mar 2014 09:53:54 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id wo20sf18668414obc.2 for ; Mon, 03 Mar 2014 01:53:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=Xfy5cyfaKI0MRh/V7O8JG9qUGhubacuR4GJziaYXUUQ=; b=O0RjLh9L38IdwodnfiuiKWtzkEPrdewyoTlTdYFqhD/BI2xrES4+pi7lgesoZJogy7 2DGxbXnS4uqR6aPGyTshBJxvoK9MK5un2WqLSxEJGR+mmY4VwMYyMWW23t+CZboRT35c kUMWflttpjL6axELPcrwdNvCbiMBJroNn3085FVh7PAKnApbvWQoiYya18VktB+kR8E4 4cXlhB2nyUgtNHhGvvjAEOH5qtCQBULN7XQW3Y3oF6y6A8tQkVIHkub1QVOUYFfneTUk 05ZhWeF98xpUz8MAcrr6Y72DSC9uqCgc81x/zn4zrR9s3Mu86uxOOPRTcayiuVGaJvRi 30hg== X-Gm-Message-State: ALoCoQlugdORSd/evmnIstGaCPvTgGIKEREzjdvb2X11k8LAVC+qPO9nx3PBbWgPl47LqQuokzHa X-Received: by 10.182.98.230 with SMTP id el6mr13332562obb.10.1393840433889; Mon, 03 Mar 2014 01:53:53 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.30.8 with SMTP id c8ls2064455qgc.56.gmail; Mon, 03 Mar 2014 01:53:53 -0800 (PST) X-Received: by 10.221.22.71 with SMTP id qv7mr1496644vcb.34.1393840433694; Mon, 03 Mar 2014 01:53:53 -0800 (PST) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id kp12si2031740veb.126.2014.03.03.01.53.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Mar 2014 01:53:53 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id oz11so2505854veb.34 for ; Mon, 03 Mar 2014 01:53:53 -0800 (PST) X-Received: by 10.58.161.46 with SMTP id xp14mr227223veb.37.1393840433610; Mon, 03 Mar 2014 01:53:53 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.130.193 with SMTP id u1csp42861vcs; Mon, 3 Mar 2014 01:53:53 -0800 (PST) X-Received: by 10.68.135.137 with SMTP id ps9mr2125643pbb.160.1393840432789; Mon, 03 Mar 2014 01:53:52 -0800 (PST) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by mx.google.com with ESMTPS id qy5si10104079pab.50.2014.03.03.01.53.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Mar 2014 01:53:52 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.50 is neither permitted nor denied by best guess record for domain of jean.pihet@linaro.org) client-ip=209.85.220.50; Received: by mail-pa0-f50.google.com with SMTP id kq14so3579848pab.23 for ; Mon, 03 Mar 2014 01:53:52 -0800 (PST) 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 Cc: Will Deacon , steve.capper@linaro.org, patches@linaro.org, Jean Pihet , Corey Ashford , Frederic Weisbecker , Namhyung Kim , Paul Mackerras , Peter Zijlstra , David Ahern 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: jean.pihet@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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); +}