From patchwork Tue May 6 15:26:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 4122361 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 836F89F23C for ; Tue, 6 May 2014 15:29:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 97CDD201EF for ; Tue, 6 May 2014 15:29:57 +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 B3CB0201C8 for ; Tue, 6 May 2014 15:29:56 +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 1WhhHH-0004vz-H5; Tue, 06 May 2014 15:27:31 +0000 Received: from mail-ee0-f53.google.com ([74.125.83.53]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WhhGq-0004Vz-HN for linux-arm-kernel@lists.infradead.org; Tue, 06 May 2014 15:27:05 +0000 Received: by mail-ee0-f53.google.com with SMTP id c13so825256eek.26 for ; Tue, 06 May 2014 08:26:42 -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=Bb+uXiBGjMOVCIIgQ+okqLXXUOolIFr3tgaiFX/XIoE=; b=Odp1wUzU20OqDEKtbm4bUW+N6V9o0vDzMWshFCrTqa3Dhk/J7OKcIuy07vCvh7CXyD 4cKPiEawqscKR+MqmEtpIqoUhckw7bHDLzrv5h0n1dENQOWlLVagM5WxZ9DC/I3PUde1 i36RJbUe8sw9mY/jkYAleXMEpzgIThjC1SH3Dml48LbHYT3mwZDeQdzNMGSbvZPj/G+0 Cpkg27fPBETc+m8IuTQ9XtZVbXyhuG83algDLXty1qziZeH2YT6RWXDh1abTtzyyBrWo Mm+5RVnunYA45gk3bhPSjZu7IJfagzNzT+9qxAQSS5KWGzltpQeoeXQOjM6zHIWJPHiq u/EQ== X-Gm-Message-State: ALoCoQlDipoGUFs/45i2Vq3NBSIixCd58qNTPSJCkxf100eViSMo1UbJh8L5fXkLF8qxxWpUSsm2 X-Received: by 10.15.64.75 with SMTP id n51mr40425425eex.33.1399390002302; Tue, 06 May 2014 08:26:42 -0700 (PDT) Received: from localhost.localdomain (193.219-240-81.adsl-dyn.isp.belgacom.be. [81.240.219.193]) by mx.google.com with ESMTPSA id s46sm39364798ees.3.2014.05.06.08.26.40 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 06 May 2014 08:26:41 -0700 (PDT) From: Jean Pihet To: Jiri Olsa , Arnaldo Carvalho de Melo , will.deacon@arm.com Subject: [PATCH 3/3] perf tools: Add libdw DWARF post unwind support for ARM Date: Tue, 6 May 2014 17:26:19 +0200 Message-Id: <1399389979-11279-4-git-send-email-jean.pihet@linaro.org> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1399389979-11279-1-git-send-email-jean.pihet@linaro.org> References: <1399389979-11279-1-git-send-email-jean.pihet@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140506_082704_775887_3BC46B4E X-CRM114-Status: GOOD ( 13.10 ) X-Spam-Score: -0.7 (/) Cc: "linaro-kernel@lists.linaro.org" , Peter Zijlstra , Corey Ashford , Frederic Weisbecker , "linux-kernel@vger.kernel.org" , Paul Mackerras , David Ahern , Namhyung Kim , Jean Pihet , Ingo Molnar , "linux-arm-kernel@lists.infradead.org" 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 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); +}