Pull perf fixes from Ingo Molnar: "This is mostly tooling fixes, plus an instruction pointer filtering fix. It's more fixes than usual - Arnaldo got back from a longer vacation and there was a backlog" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (27 commits) perf symbols: Kill dso__build_id_is_kmod() perf symbols: Keep DSO->symtab_type after decompress perf tests: Decompress kernel module before objdump perf tools: Consolidate error path in __open_dso() perf tools: Decompress kernel module when reading DSO data perf annotate: Use dso__decompress_kmodule_path() perf tools: Introduce dso__decompress_kmodule_{fd,path} perf tools: Fix a memory leak in __open_dso() perf annotate: Fix symbolic link of build-id cache perf/core: Drop kernel samples even though :u is specified perf script python: Remove dups in documentation examples perf script python: Updated trace_unhandled() signature perf script python: Fix wrong code snippets in documentation perf script: Fix documentation errors perf script: Fix outdated comment for perf-trace-python perf probe: Fix examples section of documentation perf report: Ensure the perf DSO mapping matches what libdw sees perf report: Include partial stacks unwound with libdw perf annotate: Add missing powerpc triplet perf test: Disable breakpoint signal tests for powerpc ...
Unified · Split
| @@ -7316,6 +7316,21 @@ int perf_event_account_interrupt(struct perf_event *event) · 7315 unmodified lines | |||
| 7316 | return __perf_event_account_interrupt(event, 1); | 7316 | return __perf_event_account_interrupt(event, 1); |
| 7317 | } | 7317 | } |
| 7318 | 7318 | ||
| 7319 | static bool sample_is_allowed(struct perf_event *event, struct pt_regs *regs) | ||
| 7320 | { | ||
| 7321 | /* | ||
| 7322 | * Due to interrupt latency (AKA "skid"), we may enter the | ||
| 7323 | * kernel before taking an overflow, even if the PMU is only | ||
| 7324 | * counting user events. | ||
| 7325 | * To avoid leaking information to userspace, we must always | ||
| 7326 | * reject kernel samples when exclude_kernel is set. | ||
| 7327 | */ | ||
| 7328 | if (event->attr.exclude_kernel && !user_mode(regs)) | ||
| 7329 | return false; | ||
| 7330 | |||
| 7331 | return true; | ||
| 7332 | } | ||
| 7333 | |||
| 7319 | /* | 7334 | /* |
| 7320 | * Generic event overflow handling, sampling. | 7335 | * Generic event overflow handling, sampling. |
| 7321 | */ | 7336 | */ |
| @@ -7336,6 +7351,12 @@ static int __perf_event_overflow(struct perf_event *event, · 14 unmodified lines | |||
| 7336 | 7351 | ||
| 7337 | ret = __perf_event_account_interrupt(event, throttle); | 7352 | ret = __perf_event_account_interrupt(event, throttle); |
| 7338 | 7353 | ||
| 7354 | /* | ||
| 7355 | * For security, drop the skid kernel samples if necessary. | ||
| 7356 | */ | ||
| 7357 | if (!sample_is_allowed(event, regs)) | ||
| 7358 | return ret; | ||
| 7359 | |||
| 7339 | /* | 7360 | /* |
| 7340 | * XXX event_limit might not quite work as expected on inherited | 7361 | * XXX event_limit might not quite work as expected on inherited |
| 7341 | * events | 7362 | * events |
| @@ -240,9 +240,13 @@ Add a probe on schedule() function 12th line with recording cpu local variable: · 239 unmodified lines | |||
| 240 | or | 240 | or |
| 241 | ./perf probe --add='schedule:12 cpu' | 241 | ./perf probe --add='schedule:12 cpu' |
| 242 | 242 | ||
| 243 | this will add one or more probes which has the name start with "schedule". | 243 | Add one or more probes which has the name start with "schedule". |
| 244 | 244 | ||
| 245 | Add probes on lines in schedule() function which calls update_rq_clock(). | 245 | ./perf probe schedule* |
| 246 | or | ||
| 247 | ./perf probe --add='schedule*' | ||
| 248 | |||
| 249 | Add probes on lines in schedule() function which calls update_rq_clock(). | ||
| 246 | 250 | ||
| 247 | ./perf probe 'schedule;update_rq_clock*' | 251 | ./perf probe 'schedule;update_rq_clock*' |
| 248 | or | 252 | or |
| @@ -39,7 +39,7 @@ EVENT HANDLERS · 38 unmodified lines | |||
| 39 | When perf script is invoked using a trace script, a user-defined | 39 | When perf script is invoked using a trace script, a user-defined |
| 40 | 'handler function' is called for each event in the trace. If there's | 40 | 'handler function' is called for each event in the trace. If there's |
| 41 | no handler function defined for a given event type, the event is | 41 | no handler function defined for a given event type, the event is |
| 42 | ignored (or passed to a 'trace_handled' function, see below) and the | 42 | ignored (or passed to a 'trace_unhandled' function, see below) and the |
| 43 | next event is processed. | 43 | next event is processed. |
| 44 | 44 | ||
| 45 | Most of the event's field values are passed as arguments to the | 45 | Most of the event's field values are passed as arguments to the |
| @@ -149,10 +149,8 @@ def raw_syscalls__sys_enter(event_name, context, common_cpu, · 148 unmodified lines | |||
| 149 | print "id=%d, args=%s\n" % \ | 149 | print "id=%d, args=%s\n" % \ |
| 150 | (id, args), | 150 | (id, args), |
| 151 | 151 | ||
| 152 | def trace_unhandled(event_name, context, common_cpu, common_secs, common_nsecs, | 152 | def trace_unhandled(event_name, context, event_fields_dict): |
| 153 | common_pid, common_comm): | 153 | print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())]) |
| 154 | print_header(event_name, common_cpu, common_secs, common_nsecs, | ||
| 155 | common_pid, common_comm) | ||
| 156 | 154 | ||
| 157 | def print_header(event_name, cpu, secs, nsecs, pid, comm): | 155 | def print_header(event_name, cpu, secs, nsecs, pid, comm): |
| 158 | print "%-20s %5u %05u.%09u %8u %-20s " % \ | 156 | print "%-20s %5u %05u.%09u %8u %-20s " % \ |
| @@ -321,7 +319,7 @@ So those are the essential steps in writing and running a script. The · 162 unmodified lines | |||
| 321 | process can be generalized to any tracepoint or set of tracepoints | 319 | process can be generalized to any tracepoint or set of tracepoints |
| 322 | you're interested in - basically find the tracepoint(s) you're | 320 | you're interested in - basically find the tracepoint(s) you're |
| 323 | interested in by looking at the list of available events shown by | 321 | interested in by looking at the list of available events shown by |
| 324 | 'perf list' and/or look in /sys/kernel/debug/tracing events for | 322 | 'perf list' and/or look in /sys/kernel/debug/tracing/events/ for |
| 325 | detailed event and field info, record the corresponding trace data | 323 | detailed event and field info, record the corresponding trace data |
| 326 | using 'perf record', passing it the list of interesting events, | 324 | using 'perf record', passing it the list of interesting events, |
| 327 | generate a skeleton script using 'perf script -g python' and modify the | 325 | generate a skeleton script using 'perf script -g python' and modify the |
| @@ -334,7 +332,7 @@ right place, you can have your script listed alongside the other · 6 unmodified lines | |||
| 334 | scripts listed by the 'perf script -l' command e.g.: | 332 | scripts listed by the 'perf script -l' command e.g.: |
| 335 | 333 | ||
| 336 | ---- | 334 | ---- |
| 337 | root@tropicana:~# perf script -l | 335 | # perf script -l |
| 338 | List of available trace scripts: | 336 | List of available trace scripts: |
| 339 | wakeup-latency system-wide min/max/avg wakeup latency | 337 | wakeup-latency system-wide min/max/avg wakeup latency |
| 340 | rw-by-file <comm> r/w activity for a program, by file | 338 | rw-by-file <comm> r/w activity for a program, by file |
| @@ -383,8 +381,6 @@ source tree: · 42 unmodified lines | |||
| 383 | 381 | ||
| 384 | ---- | 382 | ---- |
| 385 | # ls -al kernel-source/tools/perf/scripts/python | 383 | # ls -al kernel-source/tools/perf/scripts/python |
| 386 | |||
| 387 | root@tropicana:/home/trz/src/tip# ls -al tools/perf/scripts/python | ||
| 388 | total 32 | 384 | total 32 |
| 389 | drwxr-xr-x 4 trz trz 4096 2010-01-26 22:30 . | 385 | drwxr-xr-x 4 trz trz 4096 2010-01-26 22:30 . |
| 390 | drwxr-xr-x 4 trz trz 4096 2010-01-26 22:29 .. | 386 | drwxr-xr-x 4 trz trz 4096 2010-01-26 22:29 .. |
| @@ -399,7 +395,7 @@ otherwise your script won't show up at run-time), 'perf script -l' · 8 unmodified lines | |||
| 399 | should show a new entry for your script: | 395 | should show a new entry for your script: |
| 400 | 396 | ||
| 401 | ---- | 397 | ---- |
| 402 | root@tropicana:~# perf script -l | 398 | # perf script -l |
| 403 | List of available trace scripts: | 399 | List of available trace scripts: |
| 404 | wakeup-latency system-wide min/max/avg wakeup latency | 400 | wakeup-latency system-wide min/max/avg wakeup latency |
| 405 | rw-by-file <comm> r/w activity for a program, by file | 401 | rw-by-file <comm> r/w activity for a program, by file |
| @@ -437,7 +433,7 @@ EVENT HANDLERS · 31 unmodified lines | |||
| 437 | When perf script is invoked using a trace script, a user-defined | 433 | When perf script is invoked using a trace script, a user-defined |
| 438 | 'handler function' is called for each event in the trace. If there's | 434 | 'handler function' is called for each event in the trace. If there's |
| 439 | no handler function defined for a given event type, the event is | 435 | no handler function defined for a given event type, the event is |
| 440 | ignored (or passed to a 'trace_handled' function, see below) and the | 436 | ignored (or passed to a 'trace_unhandled' function, see below) and the |
| 441 | next event is processed. | 437 | next event is processed. |
| 442 | 438 | ||
| 443 | Most of the event's field values are passed as arguments to the | 439 | Most of the event's field values are passed as arguments to the |
| @@ -532,7 +528,7 @@ can implement a set of optional functions: · 88 unmodified lines | |||
| 532 | gives scripts a chance to do setup tasks: | 528 | gives scripts a chance to do setup tasks: |
| 533 | 529 | ||
| 534 | ---- | 530 | ---- |
| 535 | def trace_begin: | 531 | def trace_begin(): |
| 536 | pass | 532 | pass |
| 537 | ---- | 533 | ---- |
| 538 | 534 | ||
| @@ -541,7 +537,7 @@ def trace_begin: · 2 unmodified lines | |||
| 541 | as display results: | 537 | as display results: |
| 542 | 538 | ||
| 543 | ---- | 539 | ---- |
| 544 | def trace_end: | 540 | def trace_end(): |
| 545 | pass | 541 | pass |
| 546 | ---- | 542 | ---- |
| 547 | 543 | ||
| @@ -550,8 +546,7 @@ def trace_end: · 2 unmodified lines | |||
| 550 | of common arguments are passed into it: | 546 | of common arguments are passed into it: |
| 551 | 547 | ||
| 552 | ---- | 548 | ---- |
| 553 | def trace_unhandled(event_name, context, common_cpu, common_secs, | 549 | def trace_unhandled(event_name, context, event_fields_dict): |
| 554 | common_nsecs, common_pid, common_comm): | ||
| 555 | pass | 550 | pass |
| 556 | ---- | 551 | ---- |
| 557 | 552 | ||
| @@ -26,6 +26,7 @@ const char *const arm64_triplets[] = { · 25 unmodified lines | |||
| 26 | 26 | ||
| 27 | const char *const powerpc_triplets[] = { | 27 | const char *const powerpc_triplets[] = { |
| 28 | "powerpc-unknown-linux-gnu-", | 28 | "powerpc-unknown-linux-gnu-", |
| 29 | "powerpc-linux-gnu-", | ||
| 29 | "powerpc64-unknown-linux-gnu-", | 30 | "powerpc64-unknown-linux-gnu-", |
| 30 | "powerpc64-linux-gnu-", | 31 | "powerpc64-linux-gnu-", |
| 31 | "powerpc64le-linux-gnu-", | 32 | "powerpc64le-linux-gnu-", |
| @@ -1578,6 +1578,7 @@ static void print_header(int argc, const char **argv) · 1577 unmodified lines | |||
| 1578 | static void print_footer(void) | 1578 | static void print_footer(void) |
| 1579 | { | 1579 | { |
| 1580 | FILE *output = stat_config.output; | 1580 | FILE *output = stat_config.output; |
| 1581 | int n; | ||
| 1581 | 1582 | ||
| 1582 | if (!null_run) | 1583 | if (!null_run) |
| 1583 | fprintf(output, "\n"); | 1584 | fprintf(output, "\n"); |
| @@ -1590,7 +1591,9 @@ static void print_footer(void) · 6 unmodified lines | |||
| 1590 | } | 1591 | } |
| 1591 | fprintf(output, "\n\n"); | 1592 | fprintf(output, "\n\n"); |
| 1592 | 1593 | ||
| 1593 | if (print_free_counters_hint) | 1594 | if (print_free_counters_hint && |
| 1595 | sysctl__read_int("kernel/nmi_watchdog", &n) >= 0 && | ||
| 1596 | n > 0) | ||
| 1594 | fprintf(output, | 1597 | fprintf(output, |
| 1595 | "Some events weren't counted. Try disabling the NMI watchdog:\n" | 1598 | "Some events weren't counted. Try disabling the NMI watchdog:\n" |
| 1596 | " echo 0 > /proc/sys/kernel/nmi_watchdog\n" | 1599 | " echo 0 > /proc/sys/kernel/nmi_watchdog\n" |
| @@ -681,6 +681,10 @@ static struct syscall_fmt { · 680 unmodified lines | |||
| 681 | { .name = "mlockall", .errmsg = true, | 681 | { .name = "mlockall", .errmsg = true, |
| 682 | .arg_scnprintf = { [0] = SCA_HEX, /* addr */ }, }, | 682 | .arg_scnprintf = { [0] = SCA_HEX, /* addr */ }, }, |
| 683 | { .name = "mmap", .hexret = true, | 683 | { .name = "mmap", .hexret = true, |
| 684 | /* The standard mmap maps to old_mmap on s390x */ | ||
| 685 | #if defined(__s390x__) | ||
| 686 | .alias = "old_mmap", | ||
| 687 | #endif | ||
| 684 | .arg_scnprintf = { [0] = SCA_HEX, /* addr */ | 688 | .arg_scnprintf = { [0] = SCA_HEX, /* addr */ |
| 685 | [2] = SCA_MMAP_PROT, /* prot */ | 689 | [2] = SCA_MMAP_PROT, /* prot */ |
| 686 | [3] = SCA_MMAP_FLAGS, /* flags */ }, }, | 690 | [3] = SCA_MMAP_FLAGS, /* flags */ }, }, |
| @@ -288,3 +288,17 @@ int test__bp_signal(int subtest __maybe_unused) · 287 unmodified lines | |||
| 288 | return count1 == 1 && overflows == 3 && count2 == 3 && overflows_2 == 3 && count3 == 2 ? | 288 | return count1 == 1 && overflows == 3 && count2 == 3 && overflows_2 == 3 && count3 == 2 ? |
| 289 | TEST_OK : TEST_FAIL; | 289 | TEST_OK : TEST_FAIL; |
| 290 | } | 290 | } |
| 291 | |||
| 292 | bool test__bp_signal_is_supported(void) | ||
| 293 | { | ||
| 294 | /* | ||
| 295 | * The powerpc so far does not have support to even create | ||
| 296 | * instruction breakpoint using the perf event interface. | ||
| 297 | * Once it's there we can release this. | ||
| 298 | */ | ||
| 299 | #ifdef __powerpc__ | ||
| 300 | return false; | ||
| 301 | #else | ||
| 302 | return true; | ||
| 303 | #endif | ||
| 304 | } | ||
| @@ -97,10 +97,12 @@ static struct test generic_tests[] = { · 96 unmodified lines | |||
| 97 | { | 97 | { |
| 98 | .desc = "Breakpoint overflow signal handler", | 98 | .desc = "Breakpoint overflow signal handler", |
| 99 | .func = test__bp_signal, | 99 | .func = test__bp_signal, |
| 100 | .is_supported = test__bp_signal_is_supported, | ||
| 100 | }, | 101 | }, |
| 101 | { | 102 | { |
| 102 | .desc = "Breakpoint overflow sampling", | 103 | .desc = "Breakpoint overflow sampling", |
| 103 | .func = test__bp_signal_overflow, | 104 | .func = test__bp_signal_overflow, |
| 105 | .is_supported = test__bp_signal_is_supported, | ||
| 104 | }, | 106 | }, |
| 105 | { | 107 | { |
| 106 | .desc = "Number of exit events of a simple workload", | 108 | .desc = "Number of exit events of a simple workload", |
| @@ -401,6 +403,11 @@ static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist) · 294 unmodified lines | |||
| 401 | if (!perf_test__matches(t, curr, argc, argv)) | 403 | if (!perf_test__matches(t, curr, argc, argv)) |
| 402 | continue; | 404 | continue; |
| 403 | 405 | ||
| 406 | if (t->is_supported && !t->is_supported()) { | ||
| 407 | pr_debug("%2d: %-*s: Disabled\n", i, width, t->desc); | ||
| 408 | continue; | ||
| 409 | } | ||
| 410 | |||
| 404 | pr_info("%2d: %-*s:", i, width, t->desc); | 411 | pr_info("%2d: %-*s:", i, width, t->desc); |
| 405 | 412 | ||
| 406 | if (intlist__find(skiplist, i)) { | 413 | if (intlist__find(skiplist, i)) { |
| @@ -229,6 +229,8 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode, · 228 unmodified lines | |||
| 229 | unsigned char buf2[BUFSZ]; | 229 | unsigned char buf2[BUFSZ]; |
| 230 | size_t ret_len; | 230 | size_t ret_len; |
| 231 | u64 objdump_addr; | 231 | u64 objdump_addr; |
| 232 | const char *objdump_name; | ||
| 233 | char decomp_name[KMOD_DECOMP_LEN]; | ||
| 232 | int ret; | 234 | int ret; |
| 233 | 235 | ||
| 234 | pr_debug("Reading object code for memory address: %#"PRIx64"\n", addr); | 236 | pr_debug("Reading object code for memory address: %#"PRIx64"\n", addr); |
| @@ -289,9 +291,25 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode, · 54 unmodified lines | |||
| 289 | state->done[state->done_cnt++] = al.map->start; | 291 | state->done[state->done_cnt++] = al.map->start; |
| 290 | } | 292 | } |
| 291 | 293 | ||
| 294 | objdump_name = al.map->dso->long_name; | ||
| 295 | if (dso__needs_decompress(al.map->dso)) { | ||
| 296 | if (dso__decompress_kmodule_path(al.map->dso, objdump_name, | ||
| 297 | decomp_name, | ||
| 298 | sizeof(decomp_name)) < 0) { | ||
| 299 | pr_debug("decompression failed\n"); | ||
| 300 | return -1; | ||
| 301 | } | ||
| 302 | |||
| 303 | objdump_name = decomp_name; | ||
| 304 | } | ||
| 305 | |||
| 292 | /* Read the object code using objdump */ | 306 | /* Read the object code using objdump */ |
| 293 | objdump_addr = map__rip_2objdump(al.map, al.addr); | 307 | objdump_addr = map__rip_2objdump(al.map, al.addr); |
| 294 | ret = read_via_objdump(al.map->dso->long_name, objdump_addr, buf2, len); | 308 | ret = read_via_objdump(objdump_name, objdump_addr, buf2, len); |
| 309 | |||
| 310 | if (dso__needs_decompress(al.map->dso)) | ||
| 311 | unlink(objdump_name); | ||
| 312 | |||
| 295 | if (ret > 0) { | 313 | if (ret > 0) { |
| 296 | /* | 314 | /* |
| 297 | * The kernel maps are inaccurate - assume objdump is right in | 315 | * The kernel maps are inaccurate - assume objdump is right in |
| @@ -34,6 +34,7 @@ struct test { · 33 unmodified lines | |||
| 34 | int (*get_nr)(void); | 34 | int (*get_nr)(void); |
| 35 | const char *(*get_desc)(int subtest); | 35 | const char *(*get_desc)(int subtest); |
| 36 | } subtest; | 36 | } subtest; |
| 37 | bool (*is_supported)(void); | ||
| 37 | }; | 38 | }; |
| 38 | 39 | ||
| 39 | /* Tests */ | 40 | /* Tests */ |
| @@ -99,6 +100,8 @@ const char *test__clang_subtest_get_desc(int subtest); · 59 unmodified lines | |||
| 99 | int test__clang_subtest_get_nr(void); | 100 | int test__clang_subtest_get_nr(void); |
| 100 | int test__unit_number__scnprint(int subtest); | 101 | int test__unit_number__scnprint(int subtest); |
| 101 | 102 | ||
| 103 | bool test__bp_signal_is_supported(void); | ||
| 104 | |||
| 102 | #if defined(__arm__) || defined(__aarch64__) | 105 | #if defined(__arm__) || defined(__aarch64__) |
| 103 | #ifdef HAVE_DWARF_UNWIND_SUPPORT | 106 | #ifdef HAVE_DWARF_UNWIND_SUPPORT |
| 104 | struct thread; | 107 | struct thread; |
| @@ -239,10 +239,20 @@ static int jump__parse(struct arch *arch __maybe_unused, struct ins_operands *op · 238 unmodified lines | |||
| 239 | const char *s = strchr(ops->raw, '+'); | 239 | const char *s = strchr(ops->raw, '+'); |
| 240 | const char *c = strchr(ops->raw, ','); | 240 | const char *c = strchr(ops->raw, ','); |
| 241 | 241 | ||
| 242 | if (c++ != NULL) | 242 | /* |
| 243 | * skip over possible up to 2 operands to get to address, e.g.: | ||
| 244 | * tbnz w0, #26, ffff0000083cd190 <security_file_permission+0xd0> | ||
| 245 | */ | ||
| 246 | if (c++ != NULL) { | ||
| 243 | ops->target.addr = strtoull(c, NULL, 16); | 247 | ops->target.addr = strtoull(c, NULL, 16); |
| 244 | else | 248 | if (!ops->target.addr) { |
| 249 | c = strchr(c, ','); | ||
| 250 | if (c++ != NULL) | ||
| 251 | ops->target.addr = strtoull(c, NULL, 16); | ||
| 252 | } | ||
| 253 | } else { | ||
| 245 | ops->target.addr = strtoull(ops->raw, NULL, 16); | 254 | ops->target.addr = strtoull(ops->raw, NULL, 16); |
| 255 | } | ||
| 246 | 256 | ||
| 247 | if (s++ != NULL) { | 257 | if (s++ != NULL) { |
| 248 | ops->target.offset = strtoull(s, NULL, 16); | 258 | ops->target.offset = strtoull(s, NULL, 16); |
| @@ -257,10 +267,27 @@ static int jump__parse(struct arch *arch __maybe_unused, struct ins_operands *op · 8 unmodified lines | |||
| 257 | static int jump__scnprintf(struct ins *ins, char *bf, size_t size, | 267 | static int jump__scnprintf(struct ins *ins, char *bf, size_t size, |
| 258 | struct ins_operands *ops) | 268 | struct ins_operands *ops) |
| 259 | { | 269 | { |
| 270 | const char *c = strchr(ops->raw, ','); | ||
| 271 | |||
| 260 | if (!ops->target.addr || ops->target.offset < 0) | 272 | if (!ops->target.addr || ops->target.offset < 0) |
| 261 | return ins__raw_scnprintf(ins, bf, size, ops); | 273 | return ins__raw_scnprintf(ins, bf, size, ops); |
| 262 | 274 | ||
| 263 | return scnprintf(bf, size, "%-6.6s %" PRIx64, ins->name, ops->target.offset); | 275 | if (c != NULL) { |
| 276 | const char *c2 = strchr(c + 1, ','); | ||
| 277 | |||
| 278 | /* check for 3-op insn */ | ||
| 279 | if (c2 != NULL) | ||
| 280 | c = c2; | ||
| 281 | c++; | ||
| 282 | |||
| 283 | /* mirror arch objdump's space-after-comma style */ | ||
| 284 | if (*c == ' ') | ||
| 285 | c++; | ||
| 286 | } | ||
| 287 | |||
| 288 | return scnprintf(bf, size, "%-6.6s %.*s%" PRIx64, | ||
| 289 | ins->name, c ? c - ops->raw : 0, ops->raw, | ||
| 290 | ops->target.offset); | ||
| 264 | } | 291 | } |
| 265 | 292 | ||
| 266 | static struct ins_ops jump_ops = { | 293 | static struct ins_ops jump_ops = { |
| @@ -1294,6 +1321,7 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil · 1027 unmodified lines | |||
| 1294 | char linkname[PATH_MAX]; | 1321 | char linkname[PATH_MAX]; |
| 1295 | char *build_id_filename; | 1322 | char *build_id_filename; |
| 1296 | char *build_id_path = NULL; | 1323 | char *build_id_path = NULL; |
| 1324 | char *pos; | ||
| 1297 | 1325 | ||
| 1298 | if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && | 1326 | if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && |
| 1299 | !dso__is_kcore(dso)) | 1327 | !dso__is_kcore(dso)) |
| @@ -1313,7 +1341,14 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil · 13 unmodified lines | |||
| 1313 | if (!build_id_path) | 1341 | if (!build_id_path) |
| 1314 | return -1; | 1342 | return -1; |
| 1315 | 1343 | ||
| 1316 | dirname(build_id_path); | 1344 | /* |
| 1345 | * old style build-id cache has name of XX/XXXXXXX.. while | ||
| 1346 | * new style has XX/XXXXXXX../{elf,kallsyms,vdso}. | ||
| 1347 | * extract the build-id part of dirname in the new style only. | ||
| 1348 | */ | ||
| 1349 | pos = strrchr(build_id_path, '/'); | ||
| 1350 | if (pos && strlen(pos) < SBUILD_ID_SIZE - 2) | ||
| 1351 | dirname(build_id_path); | ||
| 1317 | 1352 | ||
| 1318 | if (dso__is_kcore(dso) || | 1353 | if (dso__is_kcore(dso) || |
| 1319 | readlink(build_id_path, linkname, sizeof(linkname)) < 0 || | 1354 | readlink(build_id_path, linkname, sizeof(linkname)) < 0 || |
| @@ -1396,31 +1431,10 @@ int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_na · 76 unmodified lines | |||
| 1396 | sizeof(symfs_filename)); | 1431 | sizeof(symfs_filename)); |
| 1397 | } | 1432 | } |
| 1398 | } else if (dso__needs_decompress(dso)) { | 1433 | } else if (dso__needs_decompress(dso)) { |
| 1399 | char tmp[PATH_MAX]; | 1434 | char tmp[KMOD_DECOMP_LEN]; |
| 1400 | struct kmod_path m; | ||
| 1401 | int fd; | ||
| 1402 | bool ret; | ||
| 1403 | |||
| 1404 | if (kmod_path__parse_ext(&m, symfs_filename)) | ||
| 1405 | goto out; | ||
| 1406 | |||
| 1407 | snprintf(tmp, PATH_MAX, "/tmp/perf-kmod-XXXXXX"); | ||
| 1408 | |||
| 1409 | fd = mkstemp(tmp); | ||
| 1410 | if (fd < 0) { | ||
| 1411 | free(m.ext); | ||
| 1412 | goto out; | ||
| 1413 | } | ||
| 1414 | |||
| 1415 | ret = decompress_to_file(m.ext, symfs_filename, fd); | ||
| 1416 | |||
| 1417 | if (ret) | ||
| 1418 | pr_err("Cannot decompress %s %s\n", m.ext, symfs_filename); | ||
| 1419 | |||
| 1420 | free(m.ext); | ||
| 1421 | close(fd); | ||
| 1422 | 1435 | ||
| 1423 | if (!ret) | 1436 | if (dso__decompress_kmodule_path(dso, symfs_filename, |
| 1437 | tmp, sizeof(tmp)) < 0) | ||
| 1424 | goto out; | 1438 | goto out; |
| 1425 | 1439 | ||
| 1426 | strcpy(symfs_filename, tmp); | 1440 | strcpy(symfs_filename, tmp); |
| @@ -1429,7 +1443,7 @@ int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_na · 2 unmodified lines | |||
| 1429 | snprintf(command, sizeof(command), | 1443 | snprintf(command, sizeof(command), |
| 1430 | "%s %s%s --start-address=0x%016" PRIx64 | 1444 | "%s %s%s --start-address=0x%016" PRIx64 |
| 1431 | " --stop-address=0x%016" PRIx64 | 1445 | " --stop-address=0x%016" PRIx64 |
| 1432 | " -l -d %s %s -C %s 2>/dev/null|grep -v %s:|expand", | 1446 | " -l -d %s %s -C \"%s\" 2>/dev/null|grep -v \"%s:\"|expand", |
| 1433 | objdump_path ? objdump_path : "objdump", | 1447 | objdump_path ? objdump_path : "objdump", |
| 1434 | disassembler_style ? "-M " : "", | 1448 | disassembler_style ? "-M " : "", |
| 1435 | disassembler_style ? disassembler_style : "", | 1449 | disassembler_style ? disassembler_style : "", |
| @@ -278,51 +278,6 @@ char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size) · 277 unmodified lines | |||
| 278 | return bf; | 278 | return bf; |
| 279 | } | 279 | } |
| 280 | 280 | ||
| 281 | bool dso__build_id_is_kmod(const struct dso *dso, char *bf, size_t size) | ||
| 282 | { | ||
| 283 | char *id_name = NULL, *ch; | ||
| 284 | struct stat sb; | ||
| 285 | char sbuild_id[SBUILD_ID_SIZE]; | ||
| 286 | |||
| 287 | if (!dso->has_build_id) | ||
| 288 | goto err; | ||
| 289 | |||
| 290 | build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id); | ||
| 291 | id_name = build_id_cache__linkname(sbuild_id, NULL, 0); | ||
| 292 | if (!id_name) | ||
| 293 | goto err; | ||
| 294 | if (access(id_name, F_OK)) | ||
| 295 | goto err; | ||
| 296 | if (lstat(id_name, &sb) == -1) | ||
| 297 | goto err; | ||
| 298 | if ((size_t)sb.st_size > size - 1) | ||
| 299 | goto err; | ||
| 300 | if (readlink(id_name, bf, size - 1) < 0) | ||
| 301 | goto err; | ||
| 302 | |||
| 303 | bf[sb.st_size] = '\0'; | ||
| 304 | |||
| 305 | /* | ||
| 306 | * link should be: | ||
| 307 | * ../../lib/modules/4.4.0-rc4/kernel/net/ipv4/netfilter/nf_nat_ipv4.ko/a09fe3eb3147dafa4e3b31dbd6257e4d696bdc92 | ||
| 308 | */ | ||
| 309 | ch = strrchr(bf, '/'); | ||
| 310 | if (!ch) | ||
| 311 | goto err; | ||
| 312 | if (ch - 3 < bf) | ||
| 313 | goto err; | ||
| 314 | |||
| 315 | free(id_name); | ||
| 316 | return strncmp(".ko", ch - 3, 3) == 0; | ||
| 317 | err: | ||
| 318 | pr_err("Invalid build id: %s\n", id_name ? : | ||
| 319 | dso->long_name ? : | ||
| 320 | dso->short_name ? : | ||
| 321 | "[unknown]"); | ||
| 322 | free(id_name); | ||
| 323 | return false; | ||
| 324 | } | ||
| 325 | |||
| 326 | #define dsos__for_each_with_build_id(pos, head) \ | 281 | #define dsos__for_each_with_build_id(pos, head) \ |
| 327 | list_for_each_entry(pos, head, node) \ | 282 | list_for_each_entry(pos, head, node) \ |
| 328 | if (!pos->has_build_id) \ | 283 | if (!pos->has_build_id) \ |
| @@ -17,7 +17,6 @@ char *build_id_cache__kallsyms_path(const char *sbuild_id, char *bf, · 16 unmodified lines | |||
| 17 | size_t size); | 17 | size_t size); |
| 18 | 18 | ||
| 19 | char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size); | 19 | char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size); |
| 20 | bool dso__build_id_is_kmod(const struct dso *dso, char *bf, size_t size); | ||
| 21 | 20 | ||
| 22 | int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event, | 21 | int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event, |
| 23 | struct perf_sample *sample, struct perf_evsel *evsel, | 22 | struct perf_sample *sample, struct perf_evsel *evsel, |
| @@ -248,6 +248,64 @@ bool dso__needs_decompress(struct dso *dso) · 247 unmodified lines | |||
| 248 | dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP; | 248 | dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP; |
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | static int decompress_kmodule(struct dso *dso, const char *name, char *tmpbuf) | ||
| 252 | { | ||
| 253 | int fd = -1; | ||
| 254 | struct kmod_path m; | ||
| 255 | |||
| 256 | if (!dso__needs_decompress(dso)) | ||
| 257 | return -1; | ||
| 258 | |||
| 259 | if (kmod_path__parse_ext(&m, dso->long_name)) | ||
| 260 | return -1; | ||
| 261 | |||
| 262 | if (!m.comp) | ||
| 263 | goto out; | ||
| 264 | |||
| 265 | fd = mkstemp(tmpbuf); | ||
| 266 | if (fd < 0) { | ||
| 267 | dso->load_errno = errno; | ||
| 268 | goto out; | ||
| 269 | } | ||
| 270 | |||
| 271 | if (!decompress_to_file(m.ext, name, fd)) { | ||
| 272 | dso->load_errno = DSO_LOAD_ERRNO__DECOMPRESSION_FAILURE; | ||
| 273 | close(fd); | ||
| 274 | fd = -1; | ||
| 275 | } | ||
| 276 | |||
| 277 | out: | ||
| 278 | free(m.ext); | ||
| 279 | return fd; | ||
| 280 | } | ||
| 281 | |||
| 282 | int dso__decompress_kmodule_fd(struct dso *dso, const char *name) | ||
| 283 | { | ||
| 284 | char tmpbuf[] = KMOD_DECOMP_NAME; | ||
| 285 | int fd; | ||
| 286 | |||
| 287 | fd = decompress_kmodule(dso, name, tmpbuf); | ||
| 288 | unlink(tmpbuf); | ||
| 289 | return fd; | ||
| 290 | } | ||
| 291 | |||
| 292 | int dso__decompress_kmodule_path(struct dso *dso, const char *name, | ||
| 293 | char *pathname, size_t len) | ||
| 294 | { | ||
| 295 | char tmpbuf[] = KMOD_DECOMP_NAME; | ||
| 296 | int fd; | ||
| 297 | |||
| 298 | fd = decompress_kmodule(dso, name, tmpbuf); | ||
| 299 | if (fd < 0) { | ||
| 300 | unlink(tmpbuf); | ||
| 301 | return -1; | ||
| 302 | } | ||
| 303 | |||
| 304 | strncpy(pathname, tmpbuf, len); | ||
| 305 | close(fd); | ||
| 306 | return 0; | ||
| 307 | } | ||
| 308 | |||
| 251 | /* | 309 | /* |
| 252 | * Parses kernel module specified in @path and updates | 310 | * Parses kernel module specified in @path and updates |
| 253 | * @m argument like: | 311 | * @m argument like: |
| @@ -335,6 +393,21 @@ int __kmod_path__parse(struct kmod_path *m, const char *path, · 81 unmodified lines | |||
| 335 | return 0; | 393 | return 0; |
| 336 | } | 394 | } |
| 337 | 395 | ||
| 396 | void dso__set_module_info(struct dso *dso, struct kmod_path *m, | ||
| 397 | struct machine *machine) | ||
| 398 | { | ||
| 399 | if (machine__is_host(machine)) | ||
| 400 | dso->symtab_type = DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE; | ||
| 401 | else | ||
| 402 | dso->symtab_type = DSO_BINARY_TYPE__GUEST_KMODULE; | ||
| 403 | |||
| 404 | /* _KMODULE_COMP should be next to _KMODULE */ | ||
| 405 | if (m->kmod && m->comp) | ||
| 406 | dso->symtab_type++; | ||
| 407 | |||
| 408 | dso__set_short_name(dso, strdup(m->name), true); | ||
| 409 | } | ||
| 410 | |||
| 338 | /* | 411 | /* |
| 339 | * Global list of open DSOs and the counter. | 412 | * Global list of open DSOs and the counter. |
| 340 | */ | 413 | */ |
| @@ -381,7 +454,7 @@ static int do_open(char *name) · 40 unmodified lines | |||
| 381 | 454 | ||
| 382 | static int __open_dso(struct dso *dso, struct machine *machine) | 455 | static int __open_dso(struct dso *dso, struct machine *machine) |
| 383 | { | 456 | { |
| 384 | int fd; | 457 | int fd = -EINVAL; |
| 385 | char *root_dir = (char *)""; | 458 | char *root_dir = (char *)""; |
| 386 | char *name = malloc(PATH_MAX); | 459 | char *name = malloc(PATH_MAX); |
| 387 | 460 | ||
| @@ -392,15 +465,30 @@ static int __open_dso(struct dso *dso, struct machine *machine) · 4 unmodified lines | |||
| 392 | root_dir = machine->root_dir; | 465 | root_dir = machine->root_dir; |
| 393 | 466 | ||
| 394 | if (dso__read_binary_type_filename(dso, dso->binary_type, | 467 | if (dso__read_binary_type_filename(dso, dso->binary_type, |
| 395 | root_dir, name, PATH_MAX)) { | 468 | root_dir, name, PATH_MAX)) |
| 396 | free(name); | 469 | goto out; |
| 397 | return -EINVAL; | ||
| 398 | } | ||
| 399 | 470 | ||
| 400 | if (!is_regular_file(name)) | 471 | if (!is_regular_file(name)) |
| 401 | return -EINVAL; | 472 | goto out; |
| 473 | |||
| 474 | if (dso__needs_decompress(dso)) { | ||
| 475 | char newpath[KMOD_DECOMP_LEN]; | ||
| 476 | size_t len = sizeof(newpath); | ||
| 477 | |||
| 478 | if (dso__decompress_kmodule_path(dso, name, newpath, len) < 0) { | ||
| 479 | fd = -dso->load_errno; | ||
| 480 | goto out; | ||
| 481 | } | ||
| 482 | |||
| 483 | strcpy(name, newpath); | ||
| 484 | } | ||
| 402 | 485 | ||
| 403 | fd = do_open(name); | 486 | fd = do_open(name); |
| 487 | |||
| 488 | if (dso__needs_decompress(dso)) | ||
| 489 | unlink(name); | ||
| 490 | |||
| 491 | out: | ||
| 404 | free(name); | 492 | free(name); |
| 405 | return fd; | 493 | return fd; |
| 406 | } | 494 | } |
| @@ -244,6 +244,12 @@ bool is_supported_compression(const char *ext); · 243 unmodified lines | |||
| 244 | bool is_kernel_module(const char *pathname, int cpumode); | 244 | bool is_kernel_module(const char *pathname, int cpumode); |
| 245 | bool decompress_to_file(const char *ext, const char *filename, int output_fd); | 245 | bool decompress_to_file(const char *ext, const char *filename, int output_fd); |
| 246 | bool dso__needs_decompress(struct dso *dso); | 246 | bool dso__needs_decompress(struct dso *dso); |
| 247 | int dso__decompress_kmodule_fd(struct dso *dso, const char *name); | ||
| 248 | int dso__decompress_kmodule_path(struct dso *dso, const char *name, | ||
| 249 | char *pathname, size_t len); | ||
| 250 | |||
| 251 | #define KMOD_DECOMP_NAME "/tmp/perf-kmod-XXXXXX" | ||
| 252 | #define KMOD_DECOMP_LEN sizeof(KMOD_DECOMP_NAME) | ||
| 247 | 253 | ||
| 248 | struct kmod_path { | 254 | struct kmod_path { |
| 249 | char *name; | 255 | char *name; |
| @@ -259,6 +265,9 @@ int __kmod_path__parse(struct kmod_path *m, const char *path, · 9 unmodified lines | |||
| 259 | #define kmod_path__parse_name(__m, __p) __kmod_path__parse(__m, __p, true , false) | 265 | #define kmod_path__parse_name(__m, __p) __kmod_path__parse(__m, __p, true , false) |
| 260 | #define kmod_path__parse_ext(__m, __p) __kmod_path__parse(__m, __p, false, true) | 266 | #define kmod_path__parse_ext(__m, __p) __kmod_path__parse(__m, __p, false, true) |
| 261 | 267 | ||
| 268 | void dso__set_module_info(struct dso *dso, struct kmod_path *m, | ||
| 269 | struct machine *machine); | ||
| 270 | |||
| 262 | /* | 271 | /* |
| 263 | * The dso__data_* external interface provides following functions: | 272 | * The dso__data_* external interface provides following functions: |
| 264 | * dso__data_get_fd | 273 | * dso__data_get_fd |
| @@ -1469,8 +1469,16 @@ static int __event_process_build_id(struct build_id_event *bev, · 1468 unmodified lines | |||
| 1469 | 1469 | ||
| 1470 | dso__set_build_id(dso, &bev->build_id); | 1470 | dso__set_build_id(dso, &bev->build_id); |
| 1471 | 1471 | ||
| 1472 | if (!is_kernel_module(filename, cpumode)) | 1472 | if (dso_type != DSO_TYPE_USER) { |
| 1473 | dso->kernel = dso_type; | 1473 | struct kmod_path m = { .name = NULL, }; |
| 1474 | |||
| 1475 | if (!kmod_path__parse_name(&m, filename) && m.kmod) | ||
| 1476 | dso__set_module_info(dso, &m, machine); | ||
| 1477 | else | ||
| 1478 | dso->kernel = dso_type; | ||
| 1479 | |||
| 1480 | free(m.name); | ||
| 1481 | } | ||
| 1474 | 1482 | ||
| 1475 | build_id__sprintf(dso->build_id, sizeof(dso->build_id), | 1483 | build_id__sprintf(dso->build_id, sizeof(dso->build_id), |
| 1476 | sbuild_id); | 1484 | sbuild_id); |
| @@ -572,16 +572,7 @@ static struct dso *machine__findnew_module_dso(struct machine *machine, · 571 unmodified lines | |||
| 572 | if (dso == NULL) | 572 | if (dso == NULL) |
| 573 | goto out_unlock; | 573 | goto out_unlock; |
| 574 | 574 | ||
| 575 | if (machine__is_host(machine)) | 575 | dso__set_module_info(dso, m, machine); |
| 576 | dso->symtab_type = DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE; | ||
| 577 | else | ||
| 578 | dso->symtab_type = DSO_BINARY_TYPE__GUEST_KMODULE; | ||
| 579 | |||
| 580 | /* _KMODULE_COMP should be next to _KMODULE */ | ||
| 581 | if (m->kmod && m->comp) | ||
| 582 | dso->symtab_type++; | ||
| 583 | |||
| 584 | dso__set_short_name(dso, strdup(m->name), true); | ||
| 585 | dso__set_long_name(dso, strdup(filename), true); | 576 | dso__set_long_name(dso, strdup(filename), true); |
| 586 | } | 577 | } |
| 587 | 578 | ||
| @@ -1219,7 +1219,7 @@ static int python_generate_script(struct pevent *pevent, const char *outfile) · 1218 unmodified lines | |||
| 1219 | fprintf(ofp, "# be retrieved using Python functions of the form " | 1219 | fprintf(ofp, "# be retrieved using Python functions of the form " |
| 1220 | "common_*(context).\n"); | 1220 | "common_*(context).\n"); |
| 1221 | 1221 | ||
| 1222 | fprintf(ofp, "# See the perf-trace-python Documentation for the list " | 1222 | fprintf(ofp, "# See the perf-script-python Documentation for the list " |
| 1223 | "of available functions.\n\n"); | 1223 | "of available functions.\n\n"); |
| 1224 | 1224 | ||
| 1225 | fprintf(ofp, "import os\n"); | 1225 | fprintf(ofp, "import os\n"); |
| @@ -637,43 +637,6 @@ static int dso__swap_init(struct dso *dso, unsigned char eidata) · 636 unmodified lines | |||
| 637 | return 0; | 637 | return 0; |
| 638 | } | 638 | } |
| 639 | 639 | ||
| 640 | static int decompress_kmodule(struct dso *dso, const char *name, | ||
| 641 | enum dso_binary_type type) | ||
| 642 | { | ||
| 643 | int fd = -1; | ||
| 644 | char tmpbuf[] = "/tmp/perf-kmod-XXXXXX"; | ||
| 645 | struct kmod_path m; | ||
| 646 | |||
| 647 | if (type != DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP && | ||
| 648 | type != DSO_BINARY_TYPE__GUEST_KMODULE_COMP && | ||
| 649 | type != DSO_BINARY_TYPE__BUILD_ID_CACHE) | ||
| 650 | return -1; | ||
| 651 | |||
| 652 | if (type == DSO_BINARY_TYPE__BUILD_ID_CACHE) | ||
| 653 | name = dso->long_name; | ||
| 654 | |||
| 655 | if (kmod_path__parse_ext(&m, name) || !m.comp) | ||
| 656 | return -1; | ||
| 657 | |||
| 658 | fd = mkstemp(tmpbuf); | ||
| 659 | if (fd < 0) { | ||
| 660 | dso->load_errno = errno; | ||
| 661 | goto out; | ||
| 662 | } | ||
| 663 | |||
| 664 | if (!decompress_to_file(m.ext, name, fd)) { | ||
| 665 | dso->load_errno = DSO_LOAD_ERRNO__DECOMPRESSION_FAILURE; | ||
| 666 | close(fd); | ||
| 667 | fd = -1; | ||
| 668 | } | ||
| 669 | |||
| 670 | unlink(tmpbuf); | ||
| 671 | |||
| 672 | out: | ||
| 673 | free(m.ext); | ||
| 674 | return fd; | ||
| 675 | } | ||
| 676 | |||
| 677 | bool symsrc__possibly_runtime(struct symsrc *ss) | 640 | bool symsrc__possibly_runtime(struct symsrc *ss) |
| 678 | { | 641 | { |
| 679 | return ss->dynsym || ss->opdsec; | 642 | return ss->dynsym || ss->opdsec; |
| @@ -705,9 +668,11 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, · 25 unmodified lines | |||
| 705 | int fd; | 668 | int fd; |
| 706 | 669 | ||
| 707 | if (dso__needs_decompress(dso)) { | 670 | if (dso__needs_decompress(dso)) { |
| 708 | fd = decompress_kmodule(dso, name, type); | 671 | fd = dso__decompress_kmodule_fd(dso, name); |
| 709 | if (fd < 0) | 672 | if (fd < 0) |
| 710 | return -1; | 673 | return -1; |
| 674 | |||
| 675 | type = dso->symtab_type; | ||
| 711 | } else { | 676 | } else { |
| 712 | fd = open(name, O_RDONLY); | 677 | fd = open(name, O_RDONLY); |
| 713 | if (fd < 0) { | 678 | if (fd < 0) { |
| @@ -1562,10 +1562,6 @@ int dso__load(struct dso *dso, struct map *map) · 1561 unmodified lines | |||
| 1562 | if (!runtime_ss && syms_ss) | 1562 | if (!runtime_ss && syms_ss) |
| 1563 | runtime_ss = syms_ss; | 1563 | runtime_ss = syms_ss; |
| 1564 | 1564 | ||
| 1565 | if (syms_ss && syms_ss->type == DSO_BINARY_TYPE__BUILD_ID_CACHE) | ||
| 1566 | if (dso__build_id_is_kmod(dso, name, PATH_MAX)) | ||
| 1567 | kmod = true; | ||
| 1568 | |||
| 1569 | if (syms_ss) | 1565 | if (syms_ss) |
| 1570 | ret = dso__load_sym(dso, map, syms_ss, runtime_ss, kmod); | 1566 | ret = dso__load_sym(dso, map, syms_ss, runtime_ss, kmod); |
| 1571 | else | 1567 | else |
| @@ -39,6 +39,14 @@ static int __report_module(struct addr_location *al, u64 ip, · 38 unmodified lines | |||
| 39 | return 0; | 39 | return 0; |
| 40 | 40 | ||
| 41 | mod = dwfl_addrmodule(ui->dwfl, ip); | 41 | mod = dwfl_addrmodule(ui->dwfl, ip); |
| 42 | if (mod) { | ||
| 43 | Dwarf_Addr s; | ||
| 44 | |||
| 45 | dwfl_module_info(mod, NULL, &s, NULL, NULL, NULL, NULL, NULL); | ||
| 46 | if (s != al->map->start) | ||
| 47 | mod = 0; | ||
| 48 | } | ||
| 49 | |||
| 42 | if (!mod) | 50 | if (!mod) |
| 43 | mod = dwfl_report_elf(ui->dwfl, dso->short_name, | 51 | mod = dwfl_report_elf(ui->dwfl, dso->short_name, |
| 44 | dso->long_name, -1, al->map->start, | 52 | dso->long_name, -1, al->map->start, |
| @@ -224,7 +232,7 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg, · 179 unmodified lines | |||
| 224 | 232 | ||
| 225 | err = dwfl_getthread_frames(ui->dwfl, thread->tid, frame_callback, ui); | 233 | err = dwfl_getthread_frames(ui->dwfl, thread->tid, frame_callback, ui); |
| 226 | 234 | ||
| 227 | if (err && !ui->max_stack) | 235 | if (err && ui->max_stack != max_stack) |
| 228 | err = 0; | 236 | err = 0; |
| 229 | 237 | ||
| 230 | /* | 238 | /* |