perf tools: Fix compile error on sample->user_regs
Subsystems (4)
Namhyung Kim
maintainerPATCH v2 1/1 perf tools: Fix compile error on sample->user_regs
It's recently changed to allocate dynamically but misses to update some arch-dependent codes to use perf_sample__user_regs().
---
v2) fix arm (32-bit) as well
tools/perf/arch/arm/tests/dwarf-unwind.c | 2 +- tools/perf/arch/arm/util/unwind-libdw.c | 2 +- tools/perf/arch/csky/util/unwind-libdw.c | 2 +- tools/perf/arch/loongarch/util/unwind-libdw.c | 2 +- tools/perf/arch/powerpc/tests/dwarf-unwind.c | 2 +- tools/perf/arch/powerpc/util/unwind-libdw.c | 2 +- tools/perf/arch/riscv/util/unwind-libdw.c | 2 +- tools/perf/arch/s390/util/unwind-libdw.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-)
tools/perf/arch/arm/tests/dwarf-unwind.c +1 -1
@@ -45,7 +45,7 @@ static int sample_ustack(struct perf_sample *sample,int test__arch_unwind_sample (struct perf_sample *sample,struct thread *thread) { -struct regs_dump *regs = &sample->user_regs; +struct regs_dump *regs =perf_sample__user_regs (sample);u64 *buf; buf =calloc (1 ,sizeof (u64) *PERF_REGS_MAX );
tools/perf/arch/arm/util/unwind-libdw.c +1 -1
@@ -8,7 +8,7 @@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; +struct regs_dump *user_regs =perf_sample__user_regs (ui->sample);Dwarf_Word dwarf_regs[PERF_REG_ARM_MAX ];#define REG (r) ({ \
tools/perf/arch/csky/util/unwind-libdw.c +1 -1
@@ -10,7 +10,7 @@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; +struct regs_dump *user_regs =perf_sample__user_regs (ui->sample);Dwarf_Word dwarf_regs[PERF_REG_CSKY_MAX ];#define REG (r) ({ \
tools/perf/arch/loongarch/util/unwind-libdw.c +1 -1
@@ -10,7 +10,7 @@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; +struct regs_dump *user_regs =perf_sample__user_regs (ui->sample);Dwarf_Word dwarf_regs[PERF_REG_LOONGARCH_MAX ];#define REG (r) ({ \
tools/perf/arch/powerpc/tests/dwarf-unwind.c +1 -1
@@ -45,7 +45,7 @@ static int sample_ustack(struct perf_sample *sample,int test__arch_unwind_sample (struct perf_sample *sample,struct thread *thread) { -struct regs_dump *regs = &sample->user_regs; +struct regs_dump *regs =perf_sample__user_regs (sample);u64 *buf; buf =calloc (1 ,sizeof (u64) *PERF_REGS_MAX );
tools/perf/arch/powerpc/util/unwind-libdw.c +1 -1
@@ -16,7 +16,7 @@ static const int special_regs[3][2] = {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; +struct regs_dump *user_regs =perf_sample__user_regs (ui->sample);Dwarf_Word dwarf_regs[32 ], dwarf_nip;size_t i;
tools/perf/arch/riscv/util/unwind-libdw.c +1 -1
@@ -10,7 +10,7 @@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; +struct regs_dump *user_regs =perf_sample__user_regs (ui->sample);Dwarf_Word dwarf_regs[32 ];#define REG (r) ({ \
tools/perf/arch/s390/util/unwind-libdw.c +1 -1
@@ -11,7 +11,7 @@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; +struct regs_dump *user_regs =perf_sample__user_regs (ui->sample);Dwarf_Word dwarf_regs[ARRAY_SIZE (s390_dwarf_regs)];#define REG (r) ({ \
Signature · 1 line
2.48.1.601.g30ceb7b040-goog
Quoted 7 lines · Namhyung Kim
It's recently changed to allocate dynamically but misses to update some arch-dependent codes to use
perf_sample__user_regs().Fixes dc6d2bc2d893a878 ("perf sample: Make user_regs and intr_regs optional")Reported-by Stephen Rothwell <[email protected]>Signed-off-by Namhyung Kim <[email protected]>
Thanks for this! My tag in case it is useful:
Would be nice to have asan testing to make sure there are arch dependent memory leaks, less arch code would be nice.
Thanks,
Ian
Quoted 120 lines
---
v2) fix arm (32-bit) as welltools/perf/arch/arm/tests/dwarf-unwind.c | 2 +- tools/perf/arch/arm/util/unwind-libdw.c | 2 +- tools/perf/arch/csky/util/unwind-libdw.c | 2 +- tools/perf/arch/loongarch/util/unwind-libdw.c | 2 +- tools/perf/arch/powerpc/tests/dwarf-unwind.c | 2 +- tools/perf/arch/powerpc/util/unwind-libdw.c | 2 +- tools/perf/arch/riscv/util/unwind-libdw.c | 2 +- tools/perf/arch/s390/util/unwind-libdw.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-)tools/perf/arch/arm/tests/dwarf-unwind.c +1
-1@@ -45,7 +45,7 @@ static int sample_ustack(struct perf_sample *sample,int test__arch_unwind_sample (struct perf_sample *sample,struct thread *thread) { -struct regs_dump *regs = &sample->user_regs; +struct regs_dump *regs =perf_sample__user_regs (sample);u64 *buf; buf =calloc (1 ,sizeof (u64) *PERF_REGS_MAX );tools/perf/arch/arm/util/unwind-libdw.c +1
-1@@ -8,7 +8,7 @@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; +struct regs_dump *user_regs =perf_sample__user_regs (ui->sample);Dwarf_Word dwarf_regs[PERF_REG_ARM_MAX ];#define REG (r) ({ \tools/perf/arch/csky/util/unwind-libdw.c +1
-1@@ -10,7 +10,7 @@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; +struct regs_dump *user_regs =perf_sample__user_regs (ui->sample);Dwarf_Word dwarf_regs[PERF_REG_CSKY_MAX ];#define REG (r) ({ \tools/perf/arch/loongarch/util/unwind-libdw.c +1
-1@@ -10,7 +10,7 @@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; +struct regs_dump *user_regs =perf_sample__user_regs (ui->sample);Dwarf_Word dwarf_regs[PERF_REG_LOONGARCH_MAX ];#define REG (r) ({ \tools/perf/arch/powerpc/tests/dwarf-unwind.c +1
-1@@ -45,7 +45,7 @@ static int sample_ustack(struct perf_sample *sample,int test__arch_unwind_sample (struct perf_sample *sample,struct thread *thread) { -struct regs_dump *regs = &sample->user_regs; +struct regs_dump *regs =perf_sample__user_regs (sample);u64 *buf; buf =calloc (1 ,sizeof (u64) *PERF_REGS_MAX );tools/perf/arch/powerpc/util/unwind-libdw.c +1
-1@@ -16,7 +16,7 @@ static const int special_regs[3][2] = {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; +struct regs_dump *user_regs =perf_sample__user_regs (ui->sample);Dwarf_Word dwarf_regs[32 ], dwarf_nip;size_t i;tools/perf/arch/riscv/util/unwind-libdw.c +1
-1@@ -10,7 +10,7 @@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; +struct regs_dump *user_regs =perf_sample__user_regs (ui->sample);Dwarf_Word dwarf_regs[32 ];#define REG (r) ({ \tools/perf/arch/s390/util/unwind-libdw.c +1
-2@@ -11,7 +11,7 @@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; +struct regs_dump *user_regs =perf_sample__user_regs (ui->sample);Dwarf_Word dwarf_regs[ARRAY_SIZE (s390_dwarf_regs)];#define REG (r) ({ \ --2.48.1.601.g30ceb7b040-goog
Namhyung Kim
maintainerQuoted 11 lines · Ian Rogers
Quoted 7 lines · Namhyung Kim
It's recently changed to allocate dynamically but misses to update some arch-dependent codes to use
perf_sample__user_regs().Fixes dc6d2bc2d893a878 ("perf sample: Make user_regs and intr_regs optional")Reported-by Stephen Rothwell <[email protected]>Signed-off-by Namhyung Kim <[email protected]>Thanks for this! My tag in case it is useful:
Reviewed-by Ian Rogers <[email protected]>
Sure, thanks for the review.
Quoted 3 lines
Would be nice to have asan testing to make sure there are arch dependent memory leaks, less arch code would be nice.
Right, I need cross-arch or native non-x86 testing.
Thanks,
Namhyung
Quoted 4 lines · Namhyung Kim
It's recently changed to allocate dynamically but misses to update some arch-dependent codes to use
perf_sample__user_regs().
Applied to perf-tools-next, thanks!
Best regards,
Namhyung