Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757542AbbEEKLr (ORCPT ); Tue, 5 May 2015 06:11:47 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:4093 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757469AbbEEKK5 (ORCPT ); Tue, 5 May 2015 06:10:57 -0400 From: He Kuang To: , , , , , , CC: , , , Subject: [RFC PATCH 3/6] perf bpf: Save pt_regs info from debuginfo Date: Tue, 5 May 2015 10:10:09 +0000 Message-ID: <1430820612-84443-4-git-send-email-hekuang@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1430820612-84443-1-git-send-email-hekuang@huawei.com> References: <1430820612-84443-1-git-send-email-hekuang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.197.210] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.5548972D.02A5,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 50a31e75d1c4d8335ca34012ff4b195d Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2346 Lines: 76 Save pt_regs number and size information in function convert_variable_location() instead of the register string name, so we can fetch the target register from bpf context register later. Signed-off-by: He Kuang --- tools/perf/util/include/dwarf-regs.h | 2 ++ tools/perf/util/probe-event.h | 4 ++++ tools/perf/util/probe-finder.c | 11 +++++++++++ 3 files changed, 17 insertions(+) diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h index 8f14965..166bec2 100644 --- a/tools/perf/util/include/dwarf-regs.h +++ b/tools/perf/util/include/dwarf-regs.h @@ -3,6 +3,8 @@ #ifdef HAVE_DWARF_SUPPORT const char *get_arch_regstr(unsigned int n); +char get_arch_pt_regs(unsigned int n); +int get_arch_pt_regs_size(void); #endif #endif diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h index d6b7834..842d6c4 100644 --- a/tools/perf/util/probe-event.h +++ b/tools/perf/util/probe-event.h @@ -29,6 +29,10 @@ struct probe_trace_arg { char *value; /* Base value */ char *type; /* Type name */ struct probe_trace_arg_ref *ref; /* Referencing offset */ + unsigned int regn; + unsigned int reg_size; + char *insns; + int insns_cnt; }; /* kprobe-tracer and uprobe-tracer tracing event (point + arg) */ diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 2a76e14..249e6cb 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -159,6 +159,15 @@ static struct probe_trace_arg_ref *alloc_trace_arg_ref(long offs) return ref; } +char __attribute__ ((weak)) get_arch_pt_regs(unsigned int n) { + n = n; + return -1; +} + +int __attribute__ ((weak)) get_arch_pt_regs_size(void) { + return -1; +} + /* * Convert a location into trace_arg. * If tvar == NULL, this just checks variable can be converted. @@ -260,6 +269,8 @@ static_var: return -ERANGE; } + tvar->regn = get_arch_pt_regs(regn); + tvar->reg_size = get_arch_pt_regs_size(); tvar->value = strdup(regs); if (tvar->value == NULL) return -ENOMEM; -- 1.8.5.2 -- 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/