This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] disassemble support start,+length format
- From: crquan at gmail dot com
- To: gdb-patches at sourceware dot org
- Date: Thu, 8 Apr 2010 23:14:49 +0800
- Subject: [PATCH] disassemble support start,+length format
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