lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 24 Dec 2023 16:33:32 +0800
From: Leo Yan <leo.yan@...aro.org>
To: Ruidong Tian <tianruidong@...ux.alibaba.com>
Cc: James Clark <james.clark@....com>, linux-kernel@...r.kernel.org,
	coresight@...ts.linaro.org, suzuki.poulose@....com,
	mike.leach@...aro.org, alexander.shishkin@...ux.intel.com,
	linux-arm-kernel@...ts.infradead.org, adrian.hunter@...el.com,
	linux-perf-users@...r.kernel.org, al.grant@....com,
	mathieu.poirier@...aro.org, tor@...com, acme@...hat.com
Subject: Re: [PATCH 1/3] perf scripts python: arm-cs-trace-disasm.py: print
 dso base address

Hi Ruidong,

On Fri, Dec 22, 2023 at 03:29:18PM +0800, Ruidong Tian wrote:

[...]

> > Although it's also not that clear what this is useful for, given that
> > all the other output is relative too? Maybe you could add an example to
> > the commit message, even if it's just for debugging. Would an option
> > that turned _all_ the output into virtual addresses not be more useful?
>
> I want to use arm-cs-trace-disasm.py output associate with PMU and SPE data
> to explore more CPU performance info, all the PMU/SPE/Coresight informations
> generated by `perf report` and `perf script` include virtual address, so i
> want this script do the same thing.

I think James' suggestion is valid for replacing all offsets with
virtual addresses, in addition to introducing a new option.

Below change works well at my side. Hope this is helpful.

  diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py b/tools/perf/scripts/python/arm-cs-trace-disasm.py
  index de58991c78bb..6c94ff2287cd 100755
  --- a/tools/perf/scripts/python/arm-cs-trace-disasm.py
  +++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py
  @@ -36,7 +36,10 @@ option_list = [
                      help="Set path to objdump executable file"),
          make_option("-v", "--verbose", dest="verbose",
                      action="store_true", default=False,
  -                   help="Enable debugging log")
  +                   help="Enable debugging log"),
  +       make_option("-a", "--vaddr", dest="vaddr",
  +                   action="store_true", default=False,
  +                   help="Enable virtual address")
   ]
  
   parser = OptionParser(option_list=option_list)
  @@ -108,6 +111,14 @@ def print_disam(dso_fname, dso_start, start_addr, stop_addr):
                          m = disasm_re.search(line)
                          if m is None:
                                  continue
  +
  +               # Replace offset with virtual address
  +               if (options.vaddr == True):
  +                       offset = re.search(r"^\s*([0-9a-fA-F]+)", line).group()
  +                       if offset:
  +                               virt_addr = dso_start + int(offset, 16)
  +                               line = line.replace(offset.lstrip(), "0x%016x" % virt_addr)
  +
                  print("\t" + line)
  
   def print_sample(sample):

Thanks,
Leo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ