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] [day] [month] [year] [list]
Date:   Wed, 1 Nov 2023 14:35:55 +0800
From:   Yang Jihong <yangjihong1@...wei.com>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
CC:     <peterz@...radead.org>, <mingo@...hat.com>, <mark.rutland@....com>,
        <alexander.shishkin@...ux.intel.com>, <jolsa@...nel.org>,
        <namhyung@...nel.org>, <irogers@...gle.com>,
        <adrian.hunter@...el.com>, <linux-perf-users@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] perf debug: List available options when no variable is
 specified

Hello,

On 2023/10/31 23:42, Arnaldo Carvalho de Melo wrote:
> Em Tue, Oct 31, 2023 at 08:08:23AM +0000, Yang Jihong escreveu:
>> Before:
>   
>>    # perf --debug
>>    No variable specified for --debug.
>   
>> After:
>   
>>    # perf --debug
>>    No variable specified for --debug, available options: verbose,ordered-events,stderr,data-convert,perf-event-open.
> 
> Looks useful, but the implementation can be different to reduce
> maintainership costs, see below:
> 
>> +++ b/tools/perf/perf.c
>> @@ -279,7 +279,9 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
>>   		} else if (!strcmp(cmd, "--debug")) {
>>   			if (*argc < 2) {
>> -				fprintf(stderr, "No variable specified for --debug.\n");
>> +				fprintf(stderr,
>> +					"No variable specified for --debug, available options: %s.\n",
>> +					perf_debug_options_string);
>>   				usage(perf_usage_string);
> 
>> +++ b/tools/perf/util/debug.c
>> @@ -215,6 +215,9 @@ void trace_event(union perf_event *event)
>>   		     trace_event_printer, event);
>>   }
>>   
>> +const char perf_debug_options_string[] =
>> +	"verbose,ordered-events,stderr,data-convert,perf-event-open";
> 
> Instead of adding a new variable that has to be kept in sync with
> debug_opts[], you could provide a function that iterates debug_opts,
> printing its options names, then use that function on perf.c handle_options.

Thanks for the advice.
OK, will send a v2 patch according to this scheme.

Thanks,
Yang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ