linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] perf: Suggest inbuilt commands for unknown command
Date: Wed, 20 Mar 2024 12:00:15 -0300	[thread overview]
Message-ID: <Zfr5__Ej3-0C8sJj@x1> (raw)
In-Reply-To: <Zfr4jX_b8FCOG_x_@x1>

On Wed, Mar 20, 2024 at 11:54:09AM -0300, Arnaldo Carvalho de Melo wrote:
> On Fri, Mar 01, 2024 at 12:13:05PM -0800, Ian Rogers wrote:
> > The existing unknown command code looks for perf scripts like
> > perf-archive.sh and perf-iostat.sh, however, inbuilt commands aren't
> > suggested. Add the inbuilt commands so they may be suggested too.
> > 
> > Before:
> > ```
> > $ perf reccord
> > perf: 'reccord' is not a perf-command. See 'perf --help'.
> > ```
> > 
> > After:
> > ```
> > $ perf reccord
> > perf: 'reccord' is not a perf-command. See 'perf --help'.
> > 
> > Did you mean this?
> >         record
> > ```
> > 
> > Signed-off-by: Ian Rogers <irogers@google.com>
> > ---
> > v2. Drops a merged patch and rebases. No functional change. Arnaldo
> >     reported the patch not working for him, but I've not found a
> 
> Not working:
> 
> root@number:~# perf reccord
> Failed to run command 'reccord': No such file or directory
> root@number:~# 
> 
> ⬢[acme@toolbox perf-tools-next]$ git log --oneline -1
> a65ef8052854ba75 (HEAD) perf: Suggest inbuilt commands for unknown command
> ⬢[acme@toolbox perf-tools-next]$
> 
> I use O= with install-bin, trying:
> 
> ⬢[acme@toolbox perf-tools-next]$ make -C  tools/perf install-bin
> ⬢[acme@toolbox perf-tools-next]$ perf raccord
> Failed to run command 'raccord': No such file or directory
> ⬢[acme@toolbox perf-tools-next]$
> 
> Also didn't work
> 
> Trying to figure this out...

It somehow gets done_help set to 32767, and this will not run help_unknown_cmd(), continuing after a conf call...

(gdb) p *argv
$7 = 0x7fffffffe4c5 "raccord"
(gdb) s
run_argv (argcp=0x7fffffffdfbc, argv=0x7fffffffdfb0) at perf.c:445
445	{
(gdb) n
447		handle_internal_command(*argcp, *argv);
(gdb) n
450		execv_dashed_external(*argv);
(gdb) p *argv
$8 = (const char **) 0x7fffffffe1d0
(gdb) p **argv
$9 = 0x7fffffffe4c5 "raccord"
(gdb) n
[Detaching after fork from child process 3245070]
451		return 0;
(gdb) n
452	}
(gdb) n
main (argc=1, argv=0x7fffffffe1d0) at perf.c:565
565			if (errno != ENOENT)
(gdb) p; errno
Invalid character ';' in expression.
(gdb) p errno
$10 = 2
(gdb) n
568			if (!done_help) {
(gdb) p done_help
$11 = 32767
(gdb) list
563			run_argv(&argc, &argv);
564	
565			if (errno != ENOENT)
566				break;
567	
568			if (!done_help) {
569				struct cmdnames main_cmds;
570	
571				for (unsigned int i = 0; i < ARRAY_SIZE(commands); i++) {
572					add_cmdname(&main_cmds,
(gdb) 
573						    commands[i].cmd,
574						    strlen(commands[i].cmd));
575				}
576				cmd = argv[0] = help_unknown_cmd(cmd, &main_cmds);
577				clean_cmdnames(&main_cmds);
578				done_help = 1;
579				if (!cmd)
580					break;
581			} else
582				break;
(gdb)

  reply	other threads:[~2024-03-20 15:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01 20:13 [PATCH v2 1/2] perf: Suggest inbuilt commands for unknown command Ian Rogers
2024-03-01 20:13 ` [PATCH v2 2/2] perf help: Lower levenshtein penality for deleting character Ian Rogers
2024-03-20 14:54 ` [PATCH v2 1/2] perf: Suggest inbuilt commands for unknown command Arnaldo Carvalho de Melo
2024-03-20 15:00   ` Arnaldo Carvalho de Melo [this message]
2024-03-20 15:12     ` Ian Rogers
2024-03-20 15:20       ` Arnaldo Carvalho de Melo
2024-03-20 15:25         ` Ian Rogers
2024-03-20 15:32         ` Arnaldo Carvalho de Melo
2024-03-20 15:40           ` Ian Rogers
2024-03-20 15:41           ` Arnaldo Carvalho de Melo
2024-03-20 15:44             ` Arnaldo Carvalho de Melo
2024-03-20 17:07               ` Ian Rogers
2024-03-20 19:34                 ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zfr5__Ej3-0C8sJj@x1 \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).