Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jason Molenda <jmolenda@apple.com>
To: Alain Magloire <alain@qnx.com>
Cc: gdb@sources.redhat.com
Subject: Re: MI level command
Date: Fri, 09 Jul 2004 20:49:00 -0000	[thread overview]
Message-ID: <83333EB4-D1E9-11D8-B84C-000A9569836A@apple.com> (raw)
In-Reply-To: <200407082333.TAA25718@smtp.ott.qnx.com>


On Jul 8, 2004, at 4:33 PM, Alain Magloire wrote:

> So would a patch implementing
>
>  -gdb-mi-level
>  ^done,level=1
>
> be a good thing ?


It would probably help some, but I don't see it as solving the problem. 
  The MI version # changes very rarely, and individual MI commands can 
change quite a bit within a single MI version.  On the good side, the 
changes to MI commands' output are mostly additional information that 
can be ignored if not recognized (and, hopefully, worked around if 
absent).

My bigger concern is the way MI commands are invoked -- many of the 
commands are (IMHO) poorly written, either written as if a human was 
typing them in or using numeric constants positionally to indicate 
different behaviors.  Sometimes the entropy is reversed, e.g. Nick 
Roberts' addition of the "--all-values", "--no-values", and 
"--simple-values" arguments to -stack-list-locals was a change in the 
right direction.  But consider -var-list-children.  Long ago at Apple 
we'd extended this command so that the arguments to -var-list-children 
was "VAROBJ-HANDLE SHOW-VALUE" where SHOW-VALUE was an integer with 
magical meanings, akin to what -stack-list-locals did (we had a '2' 
that did created varobj's and the like).

So anyway, Nick makes a similar change, but with the order of arguments 
being "SHOW-VALUE VAROBJ-HANDLE".  Ouch.  He also added the --no-values 
and --all-values command line arguments at the same time.

I don't mean to rag on Nick of course, but this illustrates the limited 
extensibility of MI commands that work like this.  And I certainly 
don't mean to imply that Apple hasn't made similar misjudgements in our 
own MI commands -- just yesterday I was looking at an MI command that 
takes a thread number, a source filename, and a line number (so the 
user can move the PC around in a function), and the command looks like 
"-thread-set-pc THREADNO SOURCE:LINE".  And now is the time in our 
program when we parse.

I much prefer the -data-disassemble command where each piece of 
information is passed with a separate command argument flag (except for 
its "mixed mode" boolean integer as the optional last argument on the 
line, sigh).


Oh, I got a little off topic.

BTW one convenient thing we have in the Apple gdb is a 
-mi-verify-command MI command, so the GUI can see if a given command is 
available or not.  It's very helpful, and the implementation is a snap, 
of course.

enum mi_cmd_result
mi_cmd_mi_verify_command (char *command, char **argv, int argc)
{
   char          *command_name = argv[0];
   struct mi_cmd *cmd;

   if (argc != 1)
     error ("mi_cmd_mi_verify_command: Usage: MI_COMMAND_NAME.");

   cmd = mi_lookup (command_name);

   ui_out_field_string (uiout, "name", command_name);
   if (cmd != NULL)
     {
        ui_out_field_string (uiout, "defined", "true");
        ui_out_field_string (uiout, "implemented",
             ((cmd->cli.cmd != NULL) ||
              (cmd->argv_func != NULL) ||
              (cmd->args_func != NULL)) ? "true" : "false");
     }
   else
     {
        ui_out_field_string (uiout, "defined", "false");
     }

   return MI_CMD_DONE;
}


  reply	other threads:[~2004-07-09 20:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-08 23:33 Alain Magloire
2004-07-09 20:49 ` Jason Molenda [this message]
2004-07-10 17:18   ` Arnaud Charlet
2004-07-10 22:51     ` Bob Rossi
2004-07-12 17:51   ` Alain Magloire
2004-08-24 22:04 ` Andrew Cagney
2004-08-24 23:54   ` Bob Rossi
2004-08-25 13:23   ` Alain Magloire
2004-07-11 22:49 Nick Roberts
2004-07-12 21:14 ` Jason Molenda
     [not found] <20040709012815.GA4464@white>
2004-07-12 17:38 ` Alain Magloire

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=83333EB4-D1E9-11D8-B84C-000A9569836A@apple.com \
    --to=jmolenda@apple.com \
    --cc=alain@qnx.com \
    --cc=gdb@sources.redhat.com \
    /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