diff options
Diffstat (limited to 'tools/perf/tests/code-reading.c')
| -rw-r--r-- | tools/perf/tests/code-reading.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 67f2d6323558..f671ec37a7c4 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c | |||
| @@ -133,8 +133,7 @@ static int read_via_objdump(const char *filename, u64 addr, void *buf, | |||
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | static int read_object_code(u64 addr, size_t len, u8 cpumode, | 135 | static int read_object_code(u64 addr, size_t len, u8 cpumode, |
| 136 | struct thread *thread, struct machine *machine, | 136 | struct thread *thread, struct state *state) |
| 137 | struct state *state) | ||
| 138 | { | 137 | { |
| 139 | struct addr_location al; | 138 | struct addr_location al; |
| 140 | unsigned char buf1[BUFSZ]; | 139 | unsigned char buf1[BUFSZ]; |
| @@ -145,8 +144,7 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode, | |||
| 145 | 144 | ||
| 146 | pr_debug("Reading object code for memory address: %#"PRIx64"\n", addr); | 145 | pr_debug("Reading object code for memory address: %#"PRIx64"\n", addr); |
| 147 | 146 | ||
| 148 | thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION, addr, | 147 | thread__find_addr_map(thread, cpumode, MAP__FUNCTION, addr, &al); |
| 149 | &al); | ||
| 150 | if (!al.map || !al.map->dso) { | 148 | if (!al.map || !al.map->dso) { |
| 151 | pr_debug("thread__find_addr_map failed\n"); | 149 | pr_debug("thread__find_addr_map failed\n"); |
| 152 | return -1; | 150 | return -1; |
| @@ -170,8 +168,8 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode, | |||
| 170 | len = al.map->end - addr; | 168 | len = al.map->end - addr; |
| 171 | 169 | ||
| 172 | /* Read the object code using perf */ | 170 | /* Read the object code using perf */ |
| 173 | ret_len = dso__data_read_offset(al.map->dso, machine, al.addr, buf1, | 171 | ret_len = dso__data_read_offset(al.map->dso, thread->mg->machine, |
| 174 | len); | 172 | al.addr, buf1, len); |
| 175 | if (ret_len != len) { | 173 | if (ret_len != len) { |
| 176 | pr_debug("dso__data_read_offset failed\n"); | 174 | pr_debug("dso__data_read_offset failed\n"); |
| 177 | return -1; | 175 | return -1; |
| @@ -264,8 +262,7 @@ static int process_sample_event(struct machine *machine, | |||
| 264 | 262 | ||
| 265 | cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; | 263 | cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; |
| 266 | 264 | ||
| 267 | return read_object_code(sample.ip, READLEN, cpumode, thread, machine, | 265 | return read_object_code(sample.ip, READLEN, cpumode, thread, state); |
| 268 | state); | ||
| 269 | } | 266 | } |
| 270 | 267 | ||
| 271 | static int process_event(struct machine *machine, struct perf_evlist *evlist, | 268 | static int process_event(struct machine *machine, struct perf_evlist *evlist, |
