From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8718 invoked by alias); 30 Apr 2010 14:21:43 -0000 Received: (qmail 8704 invoked by uid 22791); 30 Apr 2010 14:21:40 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SARE_MSGID_LONG45,TW_QC,TW_RQ,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-pv0-f169.google.com (HELO mail-pv0-f169.google.com) (74.125.83.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 30 Apr 2010 14:21:32 +0000 Received: by pva4 with SMTP id 4so169368pva.0 for ; Fri, 30 Apr 2010 07:21:31 -0700 (PDT) Received: by 10.142.3.26 with SMTP id 26mr6697542wfc.165.1272637290147; Fri, 30 Apr 2010 07:21:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.143.4.9 with HTTP; Fri, 30 Apr 2010 07:21:10 -0700 (PDT) In-Reply-To: <1271788793-26862-1-git-send-email-crquan@gmail.com> References: <1270739689-28732-1-git-send-email-crquan@gmail.com> <1271788793-26862-1-git-send-email-crquan@gmail.com> From: Hui Zhu Date: Fri, 30 Apr 2010 14:21:00 -0000 Message-ID: Subject: Re: [PATCH] disassemble support start,+length format To: crquan@gmail.com Cc: gdb-patches@sourceware.org, Tom Tromey , Eli Zaretskii , Nathan Froyd , Joel Brobecker Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-04/txt/msg00987.txt.bz2 On Wed, Apr 21, 2010 at 02:39, wrote: > From: CHENG Renquan > > add new support for disassemble by "start,+length" format; > > update 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. > > =A0gdb/ChangeLog =A0 =A0 =A0 | =A0 =A08 ++++++++ > =A0gdb/NEWS =A0 =A0 =A0 =A0 =A0 =A0| =A0 13 ++++++++----- > =A0gdb/cli/cli-cmds.c =A0| =A0 18 +++++++++++++++--- > =A0gdb/doc/ChangeLog =A0 | =A0 =A05 +++++ > =A0gdb/doc/gdb.texinfo | =A0 27 +++++++++++++++++++++++++-- > =A05 files changed, 61 insertions(+), 10 deletions(-) > > Index: gdb/ChangeLog > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/ChangeLog,v > retrieving revision 1.11645 > diff -u -p -r1.11645 ChangeLog > --- gdb/ChangeLog =A0 =A0 =A0 20 Apr 2010 17:33:13 -0000 =A0 =A0 =A01.116= 45 > +++ gdb/ChangeLog =A0 =A0 =A0 20 Apr 2010 18:26:10 -0000 > @@ -1,3 +1,11 @@ > +2010-04-21 =A0CHENG Renquan =A0 > + > + =A0 =A0 =A0 * cli/cli-cmds.c (disassemble_command): Add support of disa= ssemble > + =A0 =A0 =A0 "start,+length" form of arguments. > + =A0 =A0 =A0 * NEWS: Add "Changed commands" (disassemble) section for "C= hanges > + =A0 =A0 =A0 since GDB 7.1"; and merge two separated paragraphs of disas= semble > + =A0 =A0 =A0 description in "Changes in GDB 7.0". > + > =A02010-04-20 =A0Tom Tromey =A0 > > =A0 =A0 =A0 =A0* dwarf2-frame.c (decode_frame_entry_1): Handle CIE versio= n 4. > Index: gdb/NEWS > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/NEWS,v > retrieving revision 1.373 > diff -u -p -r1.373 NEWS > --- gdb/NEWS =A0 =A019 Apr 2010 00:48:43 -0000 =A0 =A0 =A01.373 > +++ gdb/NEWS =A0 =A020 Apr 2010 18:26:13 -0000 > @@ -76,6 +76,11 @@ regular breakpoints. > > =A0ARM Symbian =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0arm*-*-symbianelf* > > +* Changed commands > + > +disassemble > + =A0The disassemble command now supports "start,+length" form of two arg= uments. > + > =A0*** Changes in GDB 7.1 > > =A0* C++ Improvements > @@ -371,8 +376,9 @@ or the "condition" command is available. > =A0the target for evaluation using the same bytecode format as is used > =A0for 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 t= he > +raw instructions in hex as well as in symbolic form, and an optional /m > +modifier to print mixed source+assembly. > Do we need change this part? Thanks, Hui > =A0* Process record and replay > > @@ -464,9 +470,6 @@ qXfer:siginfo:write > =A0 packet that permited the stub to pass a process id was removed. > =A0 Remote servers should use the `T' stop reply packet instead. > > -* The "disassemble" command now supports an optional /m modifier to prin= t mixed > -source+assembly. > - > =A0* GDB now supports multiple function calling conventions according to = the > =A0DWARF-2 DW_AT_calling_convention function attribute. > > Index: gdb/cli/cli-cmds.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v > retrieving revision 1.101 > diff -u -p -r1.101 cli-cmds.c > --- gdb/cli/cli-cmds.c =A015 Apr 2010 17:45:52 -0000 =A0 =A0 =A01.101 > +++ gdb/cli/cli-cmds.c =A020 Apr 2010 18:26:15 -0000 > @@ -1105,8 +1105,9 @@ disassemble_current_function (int flags) > =A0 =A0 =A0 =A0- dump the assembly code for the function of the current pc > =A0 =A0 =A0disassemble [/mr] addr > =A0 =A0 =A0 =A0- dump the assembly code for the function at ADDR > - =A0 =A0 disassemble [/mr] low high > - =A0 =A0 =A0 - dump the assembly code in the range [LOW,HIGH) > + =A0 =A0 disassemble [/mr] low,high > + =A0 =A0 disassemble [/mr] low,+length > + =A0 =A0 =A0 - dump the assembly code in the range [LOW,HIGH), or [LOW,L= OW+length) > > =A0 =A0A /m modifier will include source code with the assembly. > =A0 =A0A /r modifier will include raw instructions in hex with the assemb= ly. =A0*/ > @@ -1177,8 +1178,18 @@ disassemble_command (char *arg, int from > =A0 else > =A0 =A0 { > =A0 =A0 =A0 /* Two arguments. =A0*/ > + =A0 =A0 =A0int incl_flag =3D 0; > =A0 =A0 =A0 low =3D pc; > + =A0 =A0 =A0while (*arg =3D=3D ' ' || *arg =3D=3D '\t') > + =A0 =A0 =A0 arg++; > + =A0 =A0 =A0if (arg[0] =3D=3D '+') > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 ++arg; > + =A0 =A0 =A0 =A0 incl_flag =3D 1; > + =A0 =A0 =A0 } > =A0 =A0 =A0 high =3D parse_and_eval_address (arg); > + =A0 =A0 =A0if (incl_flag) > + =A0 =A0 =A0 high +=3D low; > =A0 =A0 } > > =A0 print_disassembly (gdbarch, name, low, high, flags); > @@ -1610,7 +1621,8 @@ Default is the function surrounding the > =A0With a /m modifier, source lines are included (if available).\n\ > =A0With a /r modifier, raw instructions in hex are included.\n\ > =A0With a single argument, the function surrounding that address is dumpe= d.\n\ > -Two arguments (separated by a comma) are taken as a range of memory to d= ump.")); > +Two arguments (separated by a comma) are taken as a range of memory to d= ump,\n\ > + =A0in the form of \"start,end\", or \"start,+length\".")); > =A0 set_cmd_completer (c, location_completer); > =A0 if (xdb_commands) > =A0 =A0 add_com_alias ("va", "disassemble", class_xdb, 0); > Index: gdb/doc/ChangeLog > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/doc/ChangeLog,v > retrieving revision 1.1051 > diff -u -p -r1.1051 ChangeLog > --- gdb/doc/ChangeLog =A0 19 Apr 2010 01:08:25 -0000 =A0 =A0 =A01.1051 > +++ gdb/doc/ChangeLog =A0 20 Apr 2010 18:26:19 -0000 > @@ -1,3 +1,8 @@ > +2010-04-21 =A0CHENG Renquan =A0 > + > + =A0 =A0 =A0 * gdb.texinfo (Machine Code): Update description of two for= ms of > + =A0 =A0 =A0 arguments, and add new example to demonstrate the new form. > + > =A02010-04-19 =A0Pedro Alves =A0 > > =A0 =A0 =A0 =A0PR breakpoints/8554. > Index: gdb/doc/gdb.texinfo > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v > retrieving revision 1.708 > diff -u -p -r1.708 gdb.texinfo > --- gdb/doc/gdb.texinfo 19 Apr 2010 00:48:44 -0000 =A0 =A0 =A01.708 > +++ gdb/doc/gdb.texinfo 20 Apr 2010 18:26:40 -0000 > @@ -6576,8 +6576,19 @@ command is a program counter value; @val > =A0surrounding this value. =A0When two arguments are given, they should > =A0be separated by a comma, possibly surrounded by whitespace. =A0The > =A0arguments specify a range of addresses (first inclusive, second exclus= ive) > -to dump. =A0In 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). > > =A0The argument(s) can be any expression yielding a numeric value, such as > =A0@samp{0x32c4}, @samp{&main+10} or @samp{$pc - 8}. > @@ -6629,6 +6640,18 @@ Dump of assembler code for function main > =A0End of assembler dump. > =A0@end smallexample > > +Here is another example showing raw instructions in hex for AMD x86-64, > + > +@smallexample > +(gdb) disas /r 0x400281,+10 > +Dump of assembler code from 0x400281 to 0x40028b: > + =A0 0x0000000000400281: =A038 36 =A0cmp =A0 =A0%dh,(%rsi) > + =A0 0x0000000000400283: =A02d 36 34 2e 73 sub =A0 =A0$0x732e3436,%eax > + =A0 0x0000000000400288: =A06f =A0 =A0 outsl =A0%ds:(%rsi),(%dx) > + =A0 0x0000000000400289: =A02e 32 00 =A0 =A0 =A0 xor =A0 =A0%cs:(%rax),%= al > +End of assembler dump. > +@end smallexample > + > =A0Some architectures have more than one commonly-used set of instruction > =A0mnemonics or other syntax. > > -- > git v1.7.0.5, rqcheng at smu edu sg >