public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] disassemble support start,+length format
@ 2010-04-08 15:09 crquan
  2010-04-09  2:16 ` Hui Zhu
                   ` (3 more replies)
  0 siblings, 4 replies; 25+ messages in thread
From: crquan @ 2010-04-08 15:09 UTC (permalink / raw)
  To: gdb-patches

From: CHENG Renquan <rqcheng@smu.edu.sg>

add new support for disassemble by "start,+length" format

 gdb/cli/cli-cmds.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

--- gdb/cli/cli-cmds.c.orig	2010-01-18 14:25:22.000000000 +0800
+++ gdb/cli/cli-cmds.c	2010-04-08 23:06:25.816107001 +0800
@@ -1045,8 +1045,9 @@ disassemble_current_function (int flags)
        - dump the assembly code for the function of the current pc
      disassemble [/mr] addr
        - dump the assembly code for the function at ADDR
-     disassemble [/mr] low high
-       - dump the assembly code in the range [LOW,HIGH)
+     disassemble [/mr] low,high
+     disassemble [/mr] low,+length
+       - dump the assembly code in the range [LOW,HIGH), or [LOW,LOW+length)
 
    A /m modifier will include source code with the assembly.
    A /r modifier will include raw instructions in hex with the assembly.  */
@@ -1117,8 +1118,16 @@ disassemble_command (char *arg, int from
   else
     {
       /* Two arguments.  */
+      int incl_flag = 0;
+
       low = pc;
+      if (arg[0] == '+') {
+	++arg;
+	incl_flag = 1;
+      }
       high = parse_and_eval_address (arg);
+      if (incl_flag)
+	high += low;
     }
 
   print_disassembly (gdbarch, name, low, high, flags);
@@ -1546,7 +1555,8 @@ Default is the function surrounding the 
 With a /m modifier, source lines are included (if available).\n\
 With a /r modifier, raw instructions in hex are included.\n\
 With a single argument, the function surrounding that address is dumped.\n\
-Two arguments (separated by a comma) are taken as a range of memory to dump."));
+Two arguments (separated by a comma) are taken as a range of memory to dump,\n\
+  in the form of \"start,end\", or \"start,+length\"."));
   set_cmd_completer (c, location_completer);
   if (xdb_commands)
     add_com_alias ("va", "disassemble", class_xdb, 0);

--
git v1.7.0.4, rqcheng at smu edu sg

^ permalink raw reply	[flat|nested] 25+ messages in thread
* [PATCH] disassemble support start,+length format
@ 2010-04-09  4:11 crquan
  2010-04-09  8:22 ` Eli Zaretskii
  2010-04-09 18:14 ` Tom Tromey
  0 siblings, 2 replies; 25+ messages in thread
From: crquan @ 2010-04-09  4:11 UTC (permalink / raw)
  To: gdb-patches, Hui Zhu; +Cc: Joel Brobecker, Eli Zaretskii

From: CHENG Renquan <rqcheng@smu.edu.sg>

add new support for disassemble by "start,+length" format;

ChangeLog,NEWS,doc/gdb.texinfo udpated, accordingly.

BTW, I found two disassemble Changes in GDB 7.0 in NEWS, separated in two
paragraphs, so I merged them into one paragraph.

 gdb/ChangeLog       |    5 +++++
 gdb/NEWS            |   13 ++++++++-----
 gdb/cli/cli-cmds.c  |   16 +++++++++++++---
 gdb/doc/gdb.texinfo |    8 +++++---
 4 files changed, 31 insertions(+), 11 deletions(-)

Index: gdb/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.11594
diff -u -p -r1.11594 ChangeLog
--- gdb/ChangeLog	9 Apr 2010 03:00:56 -0000	1.11594
+++ gdb/ChangeLog	9 Apr 2010 03:51:39 -0000
@@ -1,3 +1,8 @@
+2010-04-09  CHENG Renquan <rqcheng@smu.edu.sg>
+
+	* gdb/cli/cli-cmds.c (disassemble_command): disassemble add support
+	"start,+length" format
+
 2010-04-08  Stan Shebs  <stan@codesourcery.com>
 	    Pedro Alves  <pedro@codesourcery.com>
 
Index: gdb/NEWS
===================================================================
RCS file: /cvs/src/src/gdb/NEWS,v
retrieving revision 1.367
diff -u -p -r1.367 NEWS
--- gdb/NEWS	1 Apr 2010 14:11:22 -0000	1.367
+++ gdb/NEWS	9 Apr 2010 03:51:40 -0000
@@ -39,6 +39,11 @@ regular breakpoints.
 
 ARM Symbian			arm*-*-symbianelf*
 
+* Changed commands
+
+disassemble
+  The disassemble command, add "start,+length" form of two arguments support.
+
 *** Changes in GDB 7.1
 
 * C++ Improvements
@@ -334,8 +339,9 @@ or the "condition" command is available.
 the target for evaluation using the same bytecode format as is used
 for tracepoint actions.
 
-* "disassemble" command with a /r modifier, print the raw instructions
-in hex as well as in symbolic form.
+* The "disassemble" command with an optional /r modifier, print the raw
+instructions in hex as well as in symbolic form; optional /m modifier to
+print mixed source+assembly.
 
 * Process record and replay
 
@@ -427,9 +433,6 @@ qXfer:siginfo:write
   packet that permited the stub to pass a process id was removed.
   Remote servers should use the `T' stop reply packet instead.
 
-* The "disassemble" command now supports an optional /m modifier to print mixed
-source+assembly.
-
 * GDB now supports multiple function calling conventions according to the
 DWARF-2 DW_AT_calling_convention function attribute.
   
Index: gdb/cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.100
diff -u -p -r1.100 cli-cmds.c
--- gdb/cli/cli-cmds.c	9 Apr 2010 03:00:58 -0000	1.100
+++ gdb/cli/cli-cmds.c	9 Apr 2010 03:51:40 -0000
@@ -1047,8 +1047,9 @@ disassemble_current_function (int flags)
        - dump the assembly code for the function of the current pc
      disassemble [/mr] addr
        - dump the assembly code for the function at ADDR
-     disassemble [/mr] low high
-       - dump the assembly code in the range [LOW,HIGH)
+     disassemble [/mr] low,high
+     disassemble [/mr] low,+length
+       - dump the assembly code in the range [LOW,HIGH), or [LOW,LOW+length)
 
    A /m modifier will include source code with the assembly.
    A /r modifier will include raw instructions in hex with the assembly.  */
@@ -1119,8 +1120,16 @@ disassemble_command (char *arg, int from
   else
     {
       /* Two arguments.  */
+      int incl_flag = 0;
+
       low = pc;
+      if (arg[0] == '+') {
+	++arg;
+	incl_flag = 1;
+      }
       high = parse_and_eval_address (arg);
+      if (incl_flag)
+	high += low;
     }
 
   print_disassembly (gdbarch, name, low, high, flags);
@@ -1548,7 +1557,8 @@ Default is the function surrounding the 
 With a /m modifier, source lines are included (if available).\n\
 With a /r modifier, raw instructions in hex are included.\n\
 With a single argument, the function surrounding that address is dumped.\n\
-Two arguments (separated by a comma) are taken as a range of memory to dump."));
+Two arguments (separated by a comma) are taken as a range of memory to dump,\n\
+  in the form of \"start,end\", or \"start,+length\"."));
   set_cmd_completer (c, location_completer);
   if (xdb_commands)
     add_com_alias ("va", "disassemble", class_xdb, 0);
Index: gdb/doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.699
diff -u -p -r1.699 gdb.texinfo
--- gdb/doc/gdb.texinfo	9 Apr 2010 03:00:58 -0000	1.699
+++ gdb/doc/gdb.texinfo	9 Apr 2010 03:51:44 -0000
@@ -6549,9 +6549,11 @@ program counter of the selected frame.  
 command is a program counter value; @value{GDBN} dumps the function
 surrounding this value.  When two arguments are given, they should
 be separated by a comma, possibly surrounded by whitespace.  The
-arguments specify a range of addresses (first inclusive, second exclusive)
-to dump.  In that case, the name of the function is also printed (since
-there could be several functions in the given range).
+arguments specify a range of addresses, in the form of "start,end" or
+"start,+length", stand for [start,end) and [start,start+length), (first
+inclusive, second exclusive) to dump.  In that case, the name of the
+function is also printed (since there could be several functions in the
+given range).
 
 The argument(s) can be any expression yielding a numeric value, such as
 @samp{0x32c4}, @samp{&main+10} or @samp{$pc - 8}.

--
git v1.7.0.4, rqcheng at smu edu sg

^ permalink raw reply	[flat|nested] 25+ messages in thread
* [PATCH] disassemble support start,+length format
@ 2010-04-10 21:01 crquan
  2010-04-10 21:16 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: crquan @ 2010-04-10 21:01 UTC (permalink / raw)
  To: gdb-patches, Tom Tromey; +Cc: Hui Zhu, Joel Brobecker, Eli Zaretskii

From: CHENG Renquan <rqcheng@smu.edu.sg>

add new support for disassemble by "start,+length" format;

and updated ChangeLog,NEWS,doc/gdb.texinfo, accordingly.

BTW, I found two disassemble Changes in GDB 7.0 in NEWS, separated in two
paragraphs, so I merged them into one paragraph.

Signed-off-by: CHENG Renquan <rqcheng@smu.edu.sg>
Reviewed-by: Eli Zaretskii <eliz@gnu.org>
Reviewed-by: Tom Tromey <tromey@redhat.com>

 gdb/ChangeLog       |    5 +++++
 gdb/NEWS            |   13 ++++++++-----
 gdb/cli/cli-cmds.c  |   16 +++++++++++++---
 gdb/doc/gdb.texinfo |   16 +++++++++++++---
 4 files changed, 39 insertions(+), 11 deletions(-)

Index: gdb/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.11603
diff -u -p -r1.11603 ChangeLog
--- gdb/ChangeLog	9 Apr 2010 20:46:39 -0000	1.11603
+++ gdb/ChangeLog	10 Apr 2010 19:23:58 -0000
@@ -1,3 +1,8 @@
+2010-04-09  CHENG Renquan <rqcheng@smu.edu.sg>
+
+	* gdb/cli/cli-cmds.c (disassemble_command): disassemble add support
+	"start,+length" format
+
 2010-04-09  Stan Shebs  <stan@codesourcery.com>
 
 	* tracepoint.c (trace_status_mi): Report frames created.
Index: gdb/NEWS
===================================================================
RCS file: /cvs/src/src/gdb/NEWS,v
retrieving revision 1.369
diff -u -p -r1.369 NEWS
--- gdb/NEWS	9 Apr 2010 15:26:54 -0000	1.369
+++ gdb/NEWS	10 Apr 2010 19:24:01 -0000
@@ -44,6 +44,11 @@ regular breakpoints.
 
 ARM Symbian			arm*-*-symbianelf*
 
+* Changed commands
+
+disassemble
+  The disassemble command now supports "start,+length" form of two arguments.
+
 *** Changes in GDB 7.1
 
 * C++ Improvements
@@ -339,8 +344,9 @@ or the "condition" command is available.
 the target for evaluation using the same bytecode format as is used
 for tracepoint actions.
 
-* "disassemble" command with a /r modifier, print the raw instructions
-in hex as well as in symbolic form.
+* The disassemble command now supports: an optional /r modifier, print the raw
+instructions in hex as well as in symbolic form; and an optional /m modifier
+to print mixed source+assembly.
 
 * Process record and replay
 
@@ -432,9 +438,6 @@ qXfer:siginfo:write
   packet that permited the stub to pass a process id was removed.
   Remote servers should use the `T' stop reply packet instead.
 
-* The "disassemble" command now supports an optional /m modifier to print mixed
-source+assembly.
-
 * GDB now supports multiple function calling conventions according to the
 DWARF-2 DW_AT_calling_convention function attribute.
   
Index: gdb/cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.100
diff -u -p -r1.100 cli-cmds.c
--- gdb/cli/cli-cmds.c	9 Apr 2010 03:00:58 -0000	1.100
+++ gdb/cli/cli-cmds.c	10 Apr 2010 19:24:02 -0000
@@ -1047,8 +1047,9 @@ disassemble_current_function (int flags)
        - dump the assembly code for the function of the current pc
      disassemble [/mr] addr
        - dump the assembly code for the function at ADDR
-     disassemble [/mr] low high
-       - dump the assembly code in the range [LOW,HIGH)
+     disassemble [/mr] low,high
+     disassemble [/mr] low,+length
+       - dump the assembly code in the range [LOW,HIGH), or [LOW,LOW+length)
 
    A /m modifier will include source code with the assembly.
    A /r modifier will include raw instructions in hex with the assembly.  */
@@ -1119,8 +1120,16 @@ disassemble_command (char *arg, int from
   else
     {
       /* Two arguments.  */
+      int incl_flag = 0;
       low = pc;
+      if (arg[0] == '+')
+      {
+	++arg;
+	incl_flag = 1;
+      }
       high = parse_and_eval_address (arg);
+      if (incl_flag)
+	high += low;
     }
 
   print_disassembly (gdbarch, name, low, high, flags);
@@ -1548,7 +1557,8 @@ Default is the function surrounding the 
 With a /m modifier, source lines are included (if available).\n\
 With a /r modifier, raw instructions in hex are included.\n\
 With a single argument, the function surrounding that address is dumped.\n\
-Two arguments (separated by a comma) are taken as a range of memory to dump."));
+Two arguments (separated by a comma) are taken as a range of memory to dump,\n\
+  in the form of \"start,end\", or \"start,+length\"."));
   set_cmd_completer (c, location_completer);
   if (xdb_commands)
     add_com_alias ("va", "disassemble", class_xdb, 0);
Index: gdb/doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.703
diff -u -p -r1.703 gdb.texinfo
--- gdb/doc/gdb.texinfo	9 Apr 2010 20:46:40 -0000	1.703
+++ gdb/doc/gdb.texinfo	10 Apr 2010 19:24:25 -0000
@@ -6549,9 +6549,19 @@ program counter of the selected frame.  
 command is a program counter value; @value{GDBN} dumps the function
 surrounding this value.  When two arguments are given, they should
 be separated by a comma, possibly surrounded by whitespace.  The
-arguments specify a range of addresses (first inclusive, second exclusive)
-to dump.  In that case, the name of the function is also printed (since
-there could be several functions in the given range).
+arguments specify a range of addresses to dump, in one of two forms:
+
+@table @code
+@item @var{start},@var{end}
+the addresses from @var{start} (inclusive) to @var{end} (exclusive)
+@item @var{start},+@var{length}
+the addresses from @var{start} (inclusive) to
+@code{@var{start}+@var{length}} (exclusive).
+@end table
+
+@noindent
+When 2 arguments are specified, the name of the function is also
+printed (since there could be several functions in the given range).
 
 The argument(s) can be any expression yielding a numeric value, such as
 @samp{0x32c4}, @samp{&main+10} or @samp{$pc - 8}.

--
git v1.7.0.4, rqcheng at smu edu sg

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

end of thread, other threads:[~2010-07-27 16:04 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-08 15:09 [PATCH] disassemble support start,+length format crquan
2010-04-09  2:16 ` Hui Zhu
2010-04-15  7:44 ` crquan
2010-04-15 17:08   ` Eli Zaretskii
2010-04-15 17:14     ` Nathan Froyd
2010-04-15 17:38       ` Eli Zaretskii
2010-04-16  1:36 ` crquan
2010-04-20 15:43   ` Tom Tromey
2010-04-20 18:43 ` crquan
2010-04-30 14:21   ` Hui Zhu
2010-07-09  2:53   ` crquan
2010-07-09  8:23     ` Eli Zaretskii
2010-07-09 11:32     ` crquan
2010-07-11 11:53       ` Hui Zhu
2010-07-11 17:28         ` Cheng Renquan
2010-07-27 16:04       ` Joel Brobecker
2010-04-09  4:11 crquan
2010-04-09  8:22 ` Eli Zaretskii
2010-04-09  9:35   ` Cheng Renquan
2010-04-09 10:29     ` Eli Zaretskii
2010-04-09 18:14 ` Tom Tromey
2010-04-10 21:01 crquan
2010-04-10 21:16 ` Eli Zaretskii
2010-04-10 21:23 ` Cheng Renquan
2010-04-13 23:29 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).