Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jason Molenda <jmolenda@apple.com>
To: Nick Roberts <nickrob@gnu.org>
Cc: alain@qnx.com, gdb@sources.redhat.com
Subject: Re: MI level command
Date: Mon, 12 Jul 2004 21:14:00 -0000	[thread overview]
Message-ID: <77A4A21B-D443-11D8-B25E-000A9569836A@apple.com> (raw)
In-Reply-To: <16625.48298.119562.285317@nick.uklinux.net>

[-- Attachment #1: Type: text/plain, Size: 1469 bytes --]


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.


[-- Attachment #2: pa.txt --]
[-- Type: text/plain, Size: 3129 bytes --]

--- /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");
     }
 

[-- Attachment #3: Type: text/plain, Size: 4 bytes --]




J

  reply	other threads:[~2004-07-12 20:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-11 22:49 Nick Roberts
2004-07-12 21:14 ` Jason Molenda [this message]
     [not found] <20040709012815.GA4464@white>
2004-07-12 17:38 ` Alain Magloire
  -- strict thread matches above, loose matches on Subject: below --
2004-07-08 23:33 Alain Magloire
2004-07-09 20:49 ` Jason Molenda
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

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=77A4A21B-D443-11D8-B25E-000A9569836A@apple.com \
    --to=jmolenda@apple.com \
    --cc=alain@qnx.com \
    --cc=gdb@sources.redhat.com \
    --cc=nickrob@gnu.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