mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 17:25:38 +00:00
perf script python: Adjust objdump start/end per map pgoff parameter
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. Signed-off-by: Steve Clevenger <scclevenger@os.amperecomputing.com> Reviewed-by: Leo Yan <leo.yan@arm.com> Cc: suzuki.poulose@arm.com Cc: james.clark@linaro.org Cc: mike.leach@linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: coresight@lists.linaro.org Cc: ilkka@os.amperecomputing.com Link: https://lore.kernel.org/r/21ccdd22e664bdeccb878672d4b2c0518873c1e5.1731027120.git.scclevenger@os.amperecomputing.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
26ec3d7cc3
commit
e8328bf3cd
@ -251,6 +251,10 @@ def process_event(param_dict):
|
|||||||
dso_start = get_optional(param_dict, "dso_map_start")
|
dso_start = get_optional(param_dict, "dso_map_start")
|
||||||
dso_end = get_optional(param_dict, "dso_map_end")
|
dso_end = get_optional(param_dict, "dso_map_end")
|
||||||
symbol = get_optional(param_dict, "symbol")
|
symbol = get_optional(param_dict, "symbol")
|
||||||
|
map_pgoff = get_optional(param_dict, "map_pgoff")
|
||||||
|
# check for valid map offset
|
||||||
|
if (str(map_pgoff) == '[unknown]'):
|
||||||
|
map_pgoff = 0
|
||||||
|
|
||||||
cpu = sample["cpu"]
|
cpu = sample["cpu"]
|
||||||
ip = sample["ip"]
|
ip = sample["ip"]
|
||||||
@ -318,9 +322,10 @@ def process_event(param_dict):
|
|||||||
# Record for previous sample packet
|
# Record for previous sample packet
|
||||||
cpu_data[str(cpu) + 'addr'] = addr
|
cpu_data[str(cpu) + 'addr'] = addr
|
||||||
|
|
||||||
# Handle CS_ETM_TRACE_ON packet if start_addr=0 and stop_addr=4
|
# Filter out zero start_address. Optionally identify CS_ETM_TRACE_ON packet
|
||||||
if (start_addr == 0 and stop_addr == 4):
|
if (start_addr == 0):
|
||||||
print("CPU%d: CS_ETM_TRACE_ON packet is inserted" % cpu)
|
if ((stop_addr == 4) and (options.verbose == True)):
|
||||||
|
print("CPU%d: CS_ETM_TRACE_ON packet is inserted" % cpu)
|
||||||
return
|
return
|
||||||
|
|
||||||
if (start_addr < int(dso_start) or start_addr > int(dso_end)):
|
if (start_addr < int(dso_start) or start_addr > int(dso_end)):
|
||||||
@ -337,13 +342,14 @@ def process_event(param_dict):
|
|||||||
# vm_start to zero.
|
# vm_start to zero.
|
||||||
if (dso == "[kernel.kallsyms]" or dso_start == 0x400000):
|
if (dso == "[kernel.kallsyms]" or dso_start == 0x400000):
|
||||||
dso_vm_start = 0
|
dso_vm_start = 0
|
||||||
|
map_pgoff = 0
|
||||||
else:
|
else:
|
||||||
dso_vm_start = int(dso_start)
|
dso_vm_start = int(dso_start)
|
||||||
|
|
||||||
dso_fname = get_dso_file_path(dso, dso_bid)
|
dso_fname = get_dso_file_path(dso, dso_bid)
|
||||||
if path.exists(dso_fname):
|
if path.exists(dso_fname):
|
||||||
print_disam(dso_fname, dso_vm_start, start_addr, stop_addr)
|
print_disam(dso_fname, dso_vm_start, start_addr + map_pgoff, stop_addr + map_pgoff)
|
||||||
else:
|
else:
|
||||||
print("Failed to find dso %s for address range [ 0x%x .. 0x%x ]" % (dso, start_addr, stop_addr))
|
print("Failed to find dso %s for address range [ 0x%x .. 0x%x ]" % (dso, start_addr + map_pgoff, stop_addr + map_pgoff))
|
||||||
|
|
||||||
print_srccode(comm, param_dict, sample, symbol, dso)
|
print_srccode(comm, param_dict, sample, symbol, dso)
|
||||||
|
Loading…
Reference in New Issue
Block a user