Extract map_pgoff parameter from the dictionary, and adjust start/end range passed to objdump based on the value. A zero start_addr is filtered to prevent output of dso address range check failures. This script repeatedly sees a zero value passed in for start_addr = cpu_data[str(cpu) + 'addr'] These zero values are not a new problem. The start_addr/stop_addr warning clutters the instruction trace output, hence this change.
Showing the changes to tools/perf/scripts/python (1 of 1 file). Show all
Unified · Split
| @@ -251,6 +251,10 @@ def process_event(param_dict): · 250 unmodified lines | ||
| 251 | 251 | dso_start = get_optional(param_dict, "dso_map_start") |
| 252 | 252 | dso_end = get_optional(param_dict, "dso_map_end") |
| 253 | 253 | symbol = get_optional(param_dict, "symbol") |
| 254 | + map_pgoff = get_optional(param_dict, "map_pgoff") | |
| 255 | + # check for valid map offset | |
| 256 | + if (str(map_pgoff) == '[unknown]'): | |
| 257 | + map_pgoff = 0 | |
| 254 | 258 | |
| 255 | 259 | cpu = sample["cpu"] |
| 256 | 260 | ip = sample["ip"] |
| @@ -318,9 +322,10 @@ def process_event(param_dict): · 61 unmodified lines | ||
| 318 | 322 | # Record for previous sample packet |
| 319 | 323 | cpu_data[str(cpu) + 'addr'] = addr |
| 320 | 324 | |
| 321 | − # Handle CS_ETM_TRACE_ON packet if start_addr=0 and stop_addr=4 | |
| 322 | − if (start_addr == 0 and stop_addr == 4): | |
| 323 | − print("CPU%d: CS_ETM_TRACE_ON packet is inserted" % cpu) | |
| 325 | + # Filter out zero start_address. Optionally identify CS_ETM_TRACE_ON packet | |
| 326 | + if (start_addr == 0): | |
| 327 | + if ((stop_addr == 4) and (options.verbose == True)): | |
| 328 | + print("CPU%d: CS_ETM_TRACE_ON packet is inserted" % cpu) | |
| 324 | 329 | return |
| 325 | 330 | |
| 326 | 331 | if (start_addr < int(dso_start) or start_addr > int(dso_end)): |
| @@ -337,13 +342,14 @@ def process_event(param_dict): · 10 unmodified lines | ||
| 337 | 342 | # vm_start to zero. |
| 338 | 343 | if (dso == "[kernel.kallsyms]" or dso_start == 0x400000): |
| 339 | 344 | dso_vm_start = 0 |
| 345 | + map_pgoff = 0 | |
| 340 | 346 | else: |
| 341 | 347 | dso_vm_start = int(dso_start) |
| 342 | 348 | |
| 343 | 349 | dso_fname = get_dso_file_path(dso, dso_bid) |
| 344 | 350 | if path.exists(dso_fname): |
| 345 | − print_disam(dso_fname, dso_vm_start, start_addr, stop_addr) | |
| 351 | + print_disam(dso_fname, dso_vm_start, start_addr + map_pgoff, stop_addr + map_pgoff) | |
| 346 | 352 | else: |
| 347 | − print("Failed to find dso %s for address range [ 0x%x .. 0x%x ]" % (dso, start_addr, stop_addr)) | |
| 353 | + print("Failed to find dso %s for address range [ 0x%x .. 0x%x ]" % (dso, start_addr + map_pgoff, stop_addr + map_pgoff)) | |
| 348 | 354 | |
| 349 | 355 | print_srccode(comm, param_dict, sample, symbol, dso) |