From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7075 invoked by alias); 4 Mar 2009 02:29:07 -0000 Received: (qmail 7066 invoked by uid 22791); 4 Mar 2009 02:29:06 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from ti-out-0910.google.com (HELO ti-out-0910.google.com) (209.85.142.185) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 04 Mar 2009 02:28:53 +0000 Received: by ti-out-0910.google.com with SMTP id y8so3117838tia.12 for ; Tue, 03 Mar 2009 18:28:49 -0800 (PST) MIME-Version: 1.0 Received: by 10.110.43.18 with SMTP id q18mr2701714tiq.21.1236133728817; Tue, 03 Mar 2009 18:28:48 -0800 (PST) In-Reply-To: <20090303170422.GA15154@caradoc.them.org> References: <20090303170422.GA15154@caradoc.them.org> Date: Wed, 04 Mar 2009 02:29:00 -0000 Message-ID: Subject: Re: What about add a interface to output the assembly codes follow inferior execution From: teawater To: Doug Evans , Daniel Jacobowitz Cc: gdb ml Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-03/txt/msg00031.txt.bz2 Hi Doug and Daniel, Thanks for your reply. I think I didn't talk clear of my idea. When exec-disassemble is on, If the $pc doesn't have the line message, gdb will output the assembly code for $pc. If the $pc has the line message, gdb will output the assembly codes of this line. For example: (gdb) set exec-disassemble on (gdb) n 26 printf ("a =3D %d b =3D %d c =3D %d\n", a, b, c); 80483fe: 8b 15 84 96 04 08 mov 0x8049684,%edx 8048404: 8b 45 f4 mov -0xc(%ebp),%eax 8048407: 89 44 24 0c mov %eax,0xc(%esp) 804840b: 8b 45 f8 mov -0x8(%ebp),%eax 804840e: 89 44 24 08 mov %eax,0x8(%esp) 8048412: 89 54 24 04 mov %edx,0x4(%esp) 8048416: c7 04 24 58 85 04 08 movl $0x8048558,(%esp) 804841d: e8 b6 fe ff ff call 80482d8 This assembly codes is for line 26 printf ("a =3D %d b =3D %d c =3D %d\n", = a, b, c); (gdb) n 21 int c =3D 1; 80483c8: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp) This assembly codes is for line 21 int c =3D 1; It will make user clear what instructions will be execute in next line. The "disp/8i $pc" just can output 8 instructions, even if the next line just have 1 instruction. For example: (gdb) n 21 int c =3D 1; 1: x/8i $pc 0x80483c8 : movl $0x1,-0xc(%ebp) 0x80483cf : mov 0x8049684,%edx 0x80483d5 : mov -0xc(%ebp),%eax 0x80483d8 : mov %eax,0xc(%esp) 0x80483dc : mov -0x8(%ebp),%eax 0x80483df : mov %eax,0x8(%esp) 0x80483e3 : mov %edx,0x4(%esp) 0x80483e7 : movl $0x8048558,(%esp) Just 1 line for line 21. Thanks, Hui On Wed, Mar 4, 2009 at 01:04, Daniel Jacobowitz wrote: > On Tue, Mar 03, 2009 at 08:41:53AM -0800, Doug Evans wrote: >> Are you looking for behaviour different than what "disp/8i $pc" would gi= ve you? > > I often run with display/i $pc. =A0But I think the 'auto' setting is a > nice idea; it's when I don't have source code that this is most useful. > > -- > Daniel Jacobowitz > CodeSourcery >