aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/unwind.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2014-01-07 13:47:25 +0100
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-02-18 09:34:48 -0300
commit352ea45a7229df8f5ae83c0757f6d426ba0f41b5 (patch)
tree594983cc1b5917b4e7b116cc51d388f81cd190b9 /tools/perf/util/unwind.c
parentperf callchain: Do not report zero address in unwind (diff)
downloadlinux-dev-352ea45a7229df8f5ae83c0757f6d426ba0f41b5.tar.xz
linux-dev-352ea45a7229df8f5ae83c0757f6d426ba0f41b5.zip
perf callchain: Add mask into struct regs_dump
Adding mask info into struct regs_dump to make the registers information compact. The mask was always passed along, so logically the mask info fits more into the struct regs_dump. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Acked-by: Jean Pihet <jean.pihet@linaro.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jean Pihet <jean.pihet@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1389098853-14466-9-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to '')
-rw-r--r--tools/perf/util/unwind.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/tools/perf/util/unwind.c b/tools/perf/util/unwind.c
index 3b7018102dfb..720a4cae6004 100644
--- a/tools/perf/util/unwind.c
+++ b/tools/perf/util/unwind.c
@@ -86,7 +86,6 @@ struct unwind_info {
struct perf_sample *sample;
struct machine *machine;
struct thread *thread;
- u64 sample_uregs;
};
#define dw_read(ptr, type, end) ({ \
@@ -391,16 +390,16 @@ static int access_dso_mem(struct unwind_info *ui, unw_word_t addr,
return !(size == sizeof(*data));
}
-static int reg_value(unw_word_t *valp, struct regs_dump *regs, int id,
- u64 sample_regs)
+static int reg_value(unw_word_t *valp, struct regs_dump *regs, int id)
{
int i, idx = 0;
+ u64 mask = regs->mask;
- if (!(sample_regs & (1 << id)))
+ if (!(mask & (1 << id)))
return -EINVAL;
for (i = 0; i < id; i++) {
- if (sample_regs & (1 << i))
+ if (mask & (1 << i))
idx++;
}
@@ -424,8 +423,7 @@ static int access_mem(unw_addr_space_t __maybe_unused as,
return 0;
}
- ret = reg_value(&start, &ui->sample->user_regs, PERF_REG_SP,
- ui->sample_uregs);
+ ret = reg_value(&start, &ui->sample->user_regs, PERF_REG_SP);
if (ret)
return ret;
@@ -475,7 +473,7 @@ static int access_reg(unw_addr_space_t __maybe_unused as,
if (id < 0)
return -EINVAL;
- ret = reg_value(valp, &ui->sample->user_regs, id, ui->sample_uregs);
+ ret = reg_value(valp, &ui->sample->user_regs, id);
if (ret) {
pr_err("unwind: can't read reg %d\n", regnum);
return ret;
@@ -572,13 +570,11 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
struct machine *machine, struct thread *thread,
- u64 sample_uregs, struct perf_sample *data,
- int max_stack)
+ struct perf_sample *data, int max_stack)
{
unw_word_t ip;
struct unwind_info ui = {
.sample = data,
- .sample_uregs = sample_uregs,
.thread = thread,
.machine = machine,
};
@@ -587,7 +583,7 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
if (!data->user_regs.regs)
return -EINVAL;
- ret = reg_value(&ip, &data->user_regs, PERF_REG_IP, sample_uregs);
+ ret = reg_value(&ip, &data->user_regs, PERF_REG_IP);
if (ret)
return ret;