From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6288 invoked by alias); 12 Jul 2004 20:38:49 -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 6281 invoked from network); 12 Jul 2004 20:38:48 -0000 Received: from unknown (HELO mail-out4.apple.com) (17.254.13.23) by sourceware.org with SMTP; 12 Jul 2004 20:38:48 -0000 Received: from mailgate2.apple.com (a17-128-100-204.apple.com [17.128.100.204]) by mail-out4.apple.com (8.12.11/8.12.11) with ESMTP id i6CKdQPe002364 for ; Mon, 12 Jul 2004 13:39:26 -0700 (PDT) Received: from relay2.apple.com (relay2.apple.com) by mailgate2.apple.com (Content Technologies SMTPRS 4.3.6) with ESMTP id ; Mon, 12 Jul 2004 13:38:47 -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 i6CKcjAV027681; Mon, 12 Jul 2004 13:38:45 -0700 (PDT) In-Reply-To: <16625.48298.119562.285317@nick.uklinux.net> References: <16625.48298.119562.285317@nick.uklinux.net> Mime-Version: 1.0 (Apple Message framework v668) Content-Type: multipart/mixed; boundary=Apple-Mail-4--311625383 Message-Id: <77A4A21B-D443-11D8-B25E-000A9569836A@apple.com> Cc: alain@qnx.com, gdb@sources.redhat.com From: Jason Molenda Subject: Re: MI level command Date: Mon, 12 Jul 2004 21:14:00 -0000 To: Nick Roberts X-SW-Source: 2004-07/txt/msg00116.txt.bz2 --Apple-Mail-4--311625383 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Content-length: 1469 On Jul 11, 2004, at 3:18 PM, Nick Roberts wrote: >> 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 think I *did* have the arguments the other way round initially and > Andrew > Cagney advised me to reverse them. It's not really an important detail - my gripe is more with the general way that MI commands take their arguments and how they're extended over time to handle more behaviors. There's no way you could have known that we did it differently in the Apple sources. (and to merge the two, I changed our gdb to handle both argument styles, with the obvious problem that varobjs can't be named "1"/"0" 'cause it's ambiguous.) >> 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). > > This is one command I find awkward as it doesn't do what the CLI > command > "disassemble" does. I guess it shows that we all want different things > out > of the same interface. Yeah, in our version we extended the -data-disassemble command to have the CLI type behavior as well. e.g. provide a start address and optionally the # of insns to disassemble, and -data-disassemble does what you'd expect. i.e. --Apple-Mail-4--311625383 Content-Transfer-Encoding: 7bit Content-Type: text/plain; x-unix-mode=0644; name="pa.txt" Content-Disposition: attachment; filename=pa.txt Content-length: 3129 --- /Network/Servers/madrid/Volumes/huis/jmolenda/j/sware/gdb/src/gdb/mi/mi-cmd-disas.c Mon Sep 30 08:57:26 2002 +++ mi-cmd-disas.c Fri Feb 6 17:28:03 2004 @@ -35,8 +35,13 @@ START-ADDRESS: address to start the disassembly at. END-ADDRESS: address to end the disassembly at. - or: + Optionally, you can leave out END-ADDRESS, in which case it + will disassemble the function around START-ADDRESS. In this + case we will also accept the HOW_MANY argument to throttle + the disassembly display at that number of assembly lines. + or: + FILENAME: The name of the file where we want disassemble from. LINE: The line around which we want to disassemble. It will disassemble the function that contins that line. @@ -51,8 +56,8 @@ enum mi_cmd_result mi_cmd_disassemble (char *command, char **argv, int argc) { - enum mi_cmd_result retval; - CORE_ADDR start; +/* APPLE LOCAL: hack to work around bug in our find_line_pc() replacement func */ + CORE_ADDR start = 0; int mixed_source_and_assembly; struct symtab *s; @@ -125,15 +130,22 @@ mi_cmd_disassemble (char *command, char /* Allow only filename + linenum (with how_many which is not required) OR start_addr + and_addr */ + /* APPLE LOCAL: Allow only the start addr, and interpret this to mean + the same thing as in the disassemble command - disassemble the function + around the -s address. */ + if (!((line_seen && file_seen && num_seen && !start_seen && !end_seen) || (line_seen && file_seen && !num_seen && !start_seen && !end_seen) - || (!line_seen && !file_seen && !num_seen && start_seen && end_seen))) + || (!line_seen && !file_seen && !num_seen && start_seen && end_seen) + || (!line_seen && !file_seen && start_seen && !end_seen))) error - ("mi_cmd_disassemble: Usage: ( [-f filename -l linenum [-n howmany]] | [-s startaddr -e endaddr]) [--] mixed_mode."); + ("mi_cmd_disassemble: Usage: ( [-f filename -l linenum [-n howmany]] | [-s startaddr -e endaddr] | " + "[-s startaddr [-n howmany]]) [--] mixed_mode."); if (argc != 1) error - ("mi_cmd_disassemble: Usage: [-f filename -l linenum [-n howmany]] [-s startaddr -e endaddr] [--] mixed_mode."); + ("mi_cmd_disassemble: Usage: [-f filename -l linenum [-n howmany]] [-s startaddr -e endaddr] | " + "[-s startaddr [-n howmany]] [--] mixed_mode."); mixed_source_and_assembly = atoi (argv[0]); if ((mixed_source_and_assembly != 0) && (mixed_source_and_assembly != 1)) @@ -151,6 +163,13 @@ mi_cmd_disassemble (char *command, char if (!find_line_pc (s, line_num, &start)) error ("mi_cmd_disassemble: Invalid line number"); if (find_pc_partial_function (start, NULL, &low, &high) == 0) + error ("mi_cmd_disassemble: No function contains specified address"); + } + else if (start_seen && !end_seen) + { + /* APPLE LOCAL: See above, if only start address, disassemble + the function around the start address. */ + if (find_pc_partial_function (low, NULL, &low, &high) == 0) error ("mi_cmd_disassemble: No function contains specified address"); } --Apple-Mail-4--311625383 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Content-length: 4 J --Apple-Mail-4--311625383--