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

Ganapatrao Kulkarni gankulkarni at os.amperecomputing.com
Wed Aug 7 21:36:41 PDT 2024



On 08-08-2024 12:50 am, Leo Yan wrote:
> 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.

Kept bail out with force option since I though it is not good to hide 
the error in normal use, otherwise we never able to notice this error in 
the future and it becomes default hidden. Eventually this error should 
be fixed.

Having said that, It is also seems OK to avoid the error with the 
warning message as you suggested.

> 
>            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,
Ganapat



More information about the linux-arm-kernel mailing list