This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Make first and last lines of 'command help documentation' consistent.


On Thu, 2019-07-11 at 14:49 +0100, Pedro Alves wrote:
> On 6/16/19 8:58 PM, Philippe Waroquiers wrote:
> > @@ -448,8 +448,8 @@ _initialize_interpreter (void)
> >    c = add_cmd ("interpreter-exec", class_support,
> >  	       interpreter_exec_cmd, _("\
> >  Execute a command in an interpreter.\n\
> > -It takes two arguments:\n\
> > +Usage: interpreter-exec INTERPRETER COMMAND...\n\
> >  The first argument is the name of the interpreter to use.\n\
> > -The second argument is the command to execute."), &cmdlist);
> > +The following arguments are the commands to execute."), &cmdlist);
> 
> This sentence is incorrect -- there's only one command to execute.

The code loops over a set of strings,
and execute each of these strings.

When trying:
(gdb) interpreter-exec console bt bt
#0  0x00007ffff78fe603 in select () at ../sysdeps/unix/syscall-template.S:84
#1  0x0000555555554f5e in sleeper_or_burner (v=0x7fffffffdf30) at sleepers.c:86
#2  0x000055555555549d in main (argc=1, argv=0x7fffffffe0b8) at sleepers.c:194
#0  0x00007ffff78fe603 in select () at ../sysdeps/unix/syscall-template.S:84
#1  0x0000555555554f5e in sleeper_or_burner (v=0x7fffffffdf30) at sleepers.c:86
#2  0x000055555555549d in main (argc=1, argv=0x7fffffffe0b8) at sleepers.c:194
(gdb)

Now, I have to admit that at least for the console interpreter, unclear where
the syntax for the arguments is described.

Looks like the below works:
(gdb) interpreter-exec console bt\ 1 bt\ 2
#0  0x00007ffff78fe603 in select () at ../sysdeps/unix/syscall-template.S:84
(More stack frames follow...)
#0  0x00007ffff78fe603 in select () at ../sysdeps/unix/syscall-template.S:84
#1  0x0000555555554f5e in sleeper_or_burner (v=0x7fffffffdf30) at sleepers.c:86
(More stack frames follow...)
(gdb) 

This also works:
(gdb) interpreter-exec console "bt 1" "bt 2"
#0  0x00007ffff78fe603 in select () at ../sysdeps/unix/syscall-template.S:84
(More stack frames follow...)
#0  0x00007ffff78fe603 in select () at ../sysdeps/unix/syscall-template.S:84
#1  0x0000555555554f5e in sleeper_or_burner (v=0x7fffffffdf30) at sleepers.c:86
(More stack frames follow...)
(gdb) 


So, it looks like really several commands can be given, but I am not sure
if the commands and argument syntax is the same for all interpreters.

Also, when looking at some mi documentation, we again see only one command
mentionned:
The '-interpreter-exec' Command
-------------------------------

Synopsis
--------

     -interpreter-exec INTERPRETER COMMAND

   Execute the specified COMMAND in the given INTERPRETER.



> You meant to say that it's the command to execute and its arguments.
> As it was before was also correct, IMHO.
> 
> >    set_cmd_completer (c, interpreter_completer);
> >  }
> 
> Thanks,
> Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]