Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: John Lindal <support_0384@newplanetsoftware.com>
To: gdb-patches@sourceware.org
Subject: Re: Allow -data-disassemble to run with only -s option
Date: Tue, 09 Aug 2011 01:00:00 -0000	[thread overview]
Message-ID: <3DBE6912-1DE6-4B8B-8353-96855B07268E@newplanetsoftware.com> (raw)
In-Reply-To: <m362m7veed.fsf@fleche.redhat.com>

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

> This patch needs a documentation update.

Attached are the updated patches, which hopefully won't get mangled in  
MIME format.

> A test case would be nice.

Without the patch, you have to specify both -s and -e.  With the  
patch, you can do this:

   -data-disassemble -s main

Thanks,
John

[-- Attachment #2: ChangeLog --]
[-- Type: application/octet-stream, Size: 198 bytes --]

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.

[-- Attachment #3: patch --]
[-- Type: application/octet-stream, Size: 2165 bytes --]

*** gdb-7.3-orig/gdb/mi/mi-cmd-disas.c	2011-03-09 12:31:50.000000000 -0800
--- gdb-7.3/gdb/mi/mi-cmd-disas.c	2011-08-08 15:18:49.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,148 ----
    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)
--- 150,160 ----
  	|| (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)

[-- Attachment #4: patch_doc --]
[-- Type: application/octet-stream, Size: 1185 bytes --]

*** doc/gdb.texinfo-orig	2011-08-08 17:51:19.000000000 -0700
--- doc/gdb.texinfo	2011-08-08 17:55:37.000000000 -0700
*************** examine memory and registers, evaluate e
*** 28271,28277 ****
  
  @smallexample
   -data-disassemble
!     [ -s @var{start-addr} -e @var{end-addr} ]
    | [ -f @var{filename} -l @var{linenum} [ -n @var{lines} ] ]
    -- @var{mode}
  @end smallexample
--- 28271,28277 ----
  
  @smallexample
   -data-disassemble
!     [ -s @var{start-addr} [ -e @var{end-addr} ] ]
    | [ -f @var{filename} -l @var{linenum} [ -n @var{lines} ] ]
    -- @var{mode}
  @end smallexample
*************** Where:
*** 28283,28289 ****
  @item @var{start-addr}
  is the beginning address (or @code{$pc})
  @item @var{end-addr}
! is the end address
  @item @var{filename}
  is the name of the file to disassemble
  @item @var{linenum}
--- 28283,28289 ----
  @item @var{start-addr}
  is the beginning address (or @code{$pc})
  @item @var{end-addr}
! is the end address.  If only @var{start-addr} is specified, then @var{end-addr} is set to the end of the function containing @var{start-addr}.
  @item @var{filename}
  is the name of the file to disassemble
  @item @var{linenum}

  reply	other threads:[~2011-08-09  1:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-06 22:29 John Lindal
2011-08-08 20:26 ` Tom Tromey
2011-08-09  1:00   ` John Lindal [this message]
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

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=3DBE6912-1DE6-4B8B-8353-96855B07268E@newplanetsoftware.com \
    --to=support_0384@newplanetsoftware.com \
    --cc=gdb-patches@sourceware.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