[PATCH] perf scripts python arm-cs-trace-disasm.py: Skip disasm if address continuity is broken

Leo Yan leo.yan at arm.com
Wed Aug 7 12:20:40 PDT 2024


On 8/7/2024 5:18 PM, Ganapatrao Kulkarni wrote:

> Is below diff with force option looks good?
> 
> diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py
> b/tools/perf/scripts/python/arm-cs-trace-disasm.py
> index d973c2baed1c..efe34f308beb 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("-f", "--force", dest="force",
> +                   action="store_true", default=False,
> +                   help="Force decoder to continue")
>  ]
> 
>  parser = OptionParser(option_list=option_list)
> @@ -257,6 +260,12 @@ def process_event(param_dict):
>                 print("Stop address 0x%x is out of range [ 0x%x .. 0x%x
> ] for dso %s" % (stop_addr, int(dso_start), int(dso_end), dso))
>                 return
> 
> +       if (stop_addr < start_addr):
> +               if (options.verbose == True or options.force):
> +                       print("Packet Discontinuity detected [stop_add:0x%x start_addr:0x%x ] for dso %s" % (stop_addr, start_addr, dso))
> +               if (options.force):
> +                       return

I struggled a bit for the code - it is confused that force mode bails out
and the non-force mode continues to run. I prefer to always bail out for
the discontinuity case, as it is pointless to continue in this case. 

          if (stop_addr <= start_addr):
              print("Packet Discontinuity detected [stop_add:0x%x start_addr:0x%x ] for dso %s" % \
                    (stop_addr, start_addr, dso))
              return

Thanks,
Leo



More information about the linux-arm-kernel mailing list