From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26799 invoked by alias); 9 Jul 2004 20:49:51 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 26780 invoked from network); 9 Jul 2004 20:49:50 -0000 Received: from unknown (HELO mail-out3.apple.com) (17.254.13.22) by sourceware.org with SMTP; 9 Jul 2004 20:49:50 -0000 Received: from mailgate2.apple.com (a17-128-100-204.apple.com [17.128.100.204]) by mail-out3.apple.com (8.12.11/8.12.11) with ESMTP id i69KoRoO023917 for ; Fri, 9 Jul 2004 13:50:27 -0700 (PDT) Received: from relay2.apple.com (relay2.apple.com) by mailgate2.apple.com (Content Technologies SMTPRS 4.3.6) with ESMTP id ; Fri, 9 Jul 2004 13:49:50 -0700 Received: from [17.201.22.21] (moleja.apple.com [17.201.22.21]) by relay2.apple.com (8.12.11/8.12.11) with ESMTP id i69Knl3h015372; Fri, 9 Jul 2004 13:49:48 -0700 (PDT) In-Reply-To: <200407082333.TAA25718@smtp.ott.qnx.com> References: <200407082333.TAA25718@smtp.ott.qnx.com> Mime-Version: 1.0 (Apple Message framework v668) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <83333EB4-D1E9-11D8-B84C-000A9569836A@apple.com> Cc: gdb@sources.redhat.com Content-Transfer-Encoding: 7bit From: Jason Molenda Subject: Re: MI level command Date: Fri, 09 Jul 2004 20:49:00 -0000 To: Alain Magloire X-SW-Source: 2004-07/txt/msg00090.txt.bz2 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; }