From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14252 invoked by alias); 11 Jul 2010 11:53:07 -0000 Received: (qmail 14241 invoked by uid 22791); 11 Jul 2010 11:53:05 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-pz0-f41.google.com (HELO mail-pz0-f41.google.com) (209.85.210.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 11 Jul 2010 11:53:00 +0000 Received: by pzk33 with SMTP id 33so2187508pzk.0 for ; Sun, 11 Jul 2010 04:52:59 -0700 (PDT) Received: by 10.142.223.12 with SMTP id v12mr15643383wfg.86.1278849179214; Sun, 11 Jul 2010 04:52:59 -0700 (PDT) MIME-Version: 1.0 Received: by 10.143.5.21 with HTTP; Sun, 11 Jul 2010 04:52:39 -0700 (PDT) In-Reply-To: <1278675336-2822-1-git-send-email-crquan@gmail.com> References: <1278643999-4237-1-git-send-email-crquan@gmail.com> <1278675336-2822-1-git-send-email-crquan@gmail.com> From: Hui Zhu Date: Sun, 11 Jul 2010 11:53:00 -0000 Message-ID: Subject: Re: [PATCH] disassemble support start,+length format To: crquan@gmail.com Cc: Eli Zaretskii , gdb-patches@sourceware.org, Tom Tromey , 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-07/txt/msg00198.txt.bz2 On Fri, Jul 9, 2010 at 19:35, 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. We are in 7.2 now. So I think you need add new entry for them. Thanks, Hui > > =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 28 +++++++++++++++++++++++++--- > =A05 files changed, 61 insertions(+), 11 deletions(-) > > --- > rebased onto cvs latest today 2010-07-09. > > 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.11979 > diff -u -p -r1.11979 ChangeLog > --- gdb/ChangeLog =A0 =A0 =A0 9 Jul 2010 02:39:57 -0000 =A0 =A0 =A0 1.119= 79 > +++ gdb/ChangeLog =A0 =A0 =A0 9 Jul 2010 11:23:30 -0000 > @@ -1,3 +1,11 @@ > +2010-07-09 =A0CHENG Renquan =A0 > + > + =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". > + =A0 =A0 =A0 * cli/cli-cmds.c (disassemble_command): Add support of disa= ssemble > + =A0 =A0 =A0 "start,+length" form of arguments. > + > =A02010-07-09 =A0Hui Zhu =A0 > > =A0 =A0 =A0 =A0* source.c (print_source_lines_base): Add check for noprin= t. > 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.392 > diff -u -p -r1.392 NEWS > --- gdb/NEWS =A0 =A08 Jul 2010 15:41:56 -0000 =A0 =A0 =A0 1.392 > +++ gdb/NEWS =A0 =A09 Jul 2010 11:23:31 -0000 > @@ -184,6 +184,11 @@ strace FN | FILE:LINE | *ADDR | -m MARKE > =A0 Define a static tracepoint by probing a marker at the given > =A0 function, line, address, or marker ID. > > +* Changed commands > + > +disassemble > + =A0The disassemble command now supports "start,+length" form of two arg= uments. > + > =A0* Python scripting > > =A0** GDB now provides a new directory location, called the python direct= ory, > @@ -518,8 +523,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. > > =A0* Process record and replay > > @@ -611,9 +617,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.104 > diff -u -p -r1.104 cli-cmds.c > --- gdb/cli/cli-cmds.c =A017 May 2010 19:28:12 -0000 =A0 =A0 =A01.104 > +++ gdb/cli/cli-cmds.c =A09 Jul 2010 11:23:31 -0000 > @@ -1108,8 +1108,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*/ > @@ -1180,8 +1181,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 (isspace (*arg)) > + =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); > @@ -1615,7 +1626,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.1083 > diff -u -p -r1.1083 ChangeLog > --- gdb/doc/ChangeLog =A0 1 Jul 2010 17:40:04 -0000 =A0 =A0 =A0 1.1083 > +++ gdb/doc/ChangeLog =A0 9 Jul 2010 11:23:31 -0000 > @@ -1,3 +1,8 @@ > +2010-07-09 =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-07-01 =A0Pedro Alves =A0 > > =A0 =A0 =A0 =A0* gdb.texinfo (Create and Delete Tracepoints): Add more in= dex > 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.737 > diff -u -p -r1.737 gdb.texinfo > --- gdb/doc/gdb.texinfo 1 Jul 2010 17:40:04 -0000 =A0 =A0 =A0 1.737 > +++ gdb/doc/gdb.texinfo 9 Jul 2010 11:23:32 -0000 > @@ -6735,9 +6735,19 @@ program counter of the selected frame. > =A0command is a program counter value; @value{GDBN} dumps the function > =A0surrounding this value. =A0When two arguments are given, they should > =A0be separated by a comma, possibly surrounded by whitespace. =A0The > -arguments specify a range of addresses (first inclusive, second exclusiv= e) > -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}. > @@ -6789,6 +6799,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.1.1 > > CHENG Renquan > 38 St Thomas Walk, Singapore 238118 =A0 =A0 =A0http://crquan.fedorapeople= .org >