Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Allow -data-disassemble to run with only -s option
@ 2011-08-06 22:29 John Lindal
  2011-08-08 20:26 ` Tom Tromey
  0 siblings, 1 reply; 7+ messages in thread
From: John Lindal @ 2011-08-06 22:29 UTC (permalink / raw)
  To: gdb-patches; +Cc: gdb

Since the "disassemble" command only requires the function name, I  
figured it would be nice if -data-disassemble did not require the  
ending address.  The attached patch makes the end address (-e option)  
optional.  This is backward compatible, since all existing code that  
calls -data-disassemble passes both -s and -e.

Sincerely,
John Lindal
New Planet Software
http://www.newplanetsoftware.com/
twitter: newplanetsw

-----

2011-08-06 John Lindal <gdb@newplanetsoftware.com>

	* mi-cmd-disas.c: Accept only -s option.  Automatically set end to end
	of function, or complain that start address is not part of any  
function.

-----

*** mi/mi-cmd-disas.c~	2011-03-09 12:31:50.000000000 -0800
--- mi/mi-cmd-disas.c	2011-08-06 15:14:55.000000000 -0700
***************
*** 37,42 ****
--- 37,47 ----

      or:

+    START-ADDRESS: address to start the disassembly at.
+    (END-ADDRESS is the end of the function.)
+
+    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.
*************** mi_cmd_disassemble (char *command, char
*** 127,132 ****
--- 132,147 ----
     argv += optind;
     argc -= optind;

+   if (!line_seen && !file_seen && !num_seen && start_seen && ! 
end_seen)
+     {
+       char* ignore_name;
+       CORE_ADDR ignore_low;
+       if (find_pc_partial_function (low, &ignore_name, &ignore_low,  
&high) == 0)
+ 	error (_("No function contains specified address"));
+
+       end_seen = 1;
+     }
+
     /* Allow only filename + linenum (with how_many which is not
        required) OR start_addr + and_addr */

*************** mi_cmd_disassemble (char *command, char
*** 134,144 ****
   	|| (line_seen && file_seen && !num_seen && !start_seen && !end_seen)
   	|| (!line_seen && !file_seen && !num_seen && start_seen &&  
end_seen)))
       error (_("-data-disassemble: Usage: ( [-f filename -l linenum [- 
n "
! 	     "howmany]] | [-s startaddr -e endaddr]) [--] mode."));

     if (argc != 1)
       error (_("-data-disassemble: Usage: [-f filename -l linenum "
! 	     "[-n howmany]] [-s startaddr -e endaddr] [--] mode."));

     mode = atoi (argv[0]);
     if (mode < 0 || mode > 3)
--- 149,159 ----
   	|| (line_seen && file_seen && !num_seen && !start_seen && !end_seen)
   	|| (!line_seen && !file_seen && !num_seen && start_seen &&  
end_seen)))
       error (_("-data-disassemble: Usage: ( [-f filename -l linenum [- 
n "
! 	     "howmany]] | [-s startaddr [-e endaddr]]) [--] mode."));

     if (argc != 1)
       error (_("-data-disassemble: Usage: [-f filename -l linenum "
! 	     "[-n howmany]] [-s startaddr [-e endaddr]] [--] mode."));

     mode = atoi (argv[0]);
     if (mode < 0 || mode > 3)


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-08-12 19:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-06 22:29 Allow -data-disassemble to run with only -s option John Lindal
2011-08-08 20:26 ` Tom Tromey
2011-08-09  1:00   ` John Lindal
2011-08-09  2:57     ` Sergio Durigan Junior
2011-08-09  3:06       ` Sergio Durigan Junior
2011-08-09 16:33       ` John Lindal
2011-08-12 19:32         ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox