From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19978 invoked by alias); 19 Oct 2009 19:55:33 -0000 Received: (qmail 19966 invoked by uid 22791); 19 Oct 2009 19:55:33 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 19 Oct 2009 19:55:27 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 090D1105BB; Mon, 19 Oct 2009 19:55:25 +0000 (GMT) Received: from caradoc.them.org (209.195.188.212.nauticom.net [209.195.188.212]) by nan.false.org (Postfix) with ESMTP id AD9A710576; Mon, 19 Oct 2009 19:55:24 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1MzyKB-0006w5-KB; Mon, 19 Oct 2009 15:55:23 -0400 Date: Mon, 19 Oct 2009 19:55:00 -0000 From: Daniel Jacobowitz To: Eli Zaretskii Cc: ppluzhnikov@google.com, tromey@redhat.com, gdb-patches@sourceware.org Subject: Re: [RFC][patch] Allow to disassemble line. Message-ID: <20091019195523.GA25499@caradoc.them.org> Mail-Followup-To: Eli Zaretskii , ppluzhnikov@google.com, tromey@redhat.com, gdb-patches@sourceware.org References: <20091002004954.8966C76B2B@ppluzhnikov.mtv.corp.google.com> <8ac60eac0910080916i5a2eb49an5f21f3b5c7fb96ef@mail.gmail.com> <20091008162350.GA8625@caradoc.them.org> <8ac60eac0910080952p46f15693x6ed339473db0139d@mail.gmail.com> <8ac60eac0910161607k55fee22cs379c5b7635d7b6a@mail.gmail.com> <8ac60eac0910191109v62794c33g6712090912b5c11f@mail.gmail.com> <20091019184853.GA18564@caradoc.them.org> <83ljj7gop6.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83ljj7gop6.fsf@gnu.org> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2009-10/txt/msg00448.txt.bz2 On Mon, Oct 19, 2009 at 09:37:25PM +0200, Eli Zaretskii wrote: > It's really hard to believe that 1 or 2 or 3 extra columns can make > such a difference. Listing the source, GDB is unable to show most of > the lines in the call stack without wrapping them, and we live with > that. How on Earth can disassembly do worse? Disassembly can do worse because so much of the line is usually unintersting. The three columns won't be a huge difference, even though they're a noticeable percentage of the screen real estate; mostly they prompted me to start this conversation. I usually use a 104 column terminal. Here's a sample from GDB; the places most likely to wrap and be hard to write are calls: 0x080ec87f : call 0x8101d90 GDB wrote that on one line and let it hard wrap. Or one from GNU libstdc++: 0xc6bc7 <_ZSt17rethrow_exceptionNSt15__exception_ptr13exception_ptrE+87>: callq 0x58e20 <_Unwind_RaiseException@plt> GDB wrapped that before the callq. I can't figure out when it does this versus when it lets things run off the end of the line; I've seen both today. Neither of these are unusual functions. > > We've got this layout here with nicely aligned columns but tons of > > whitespace. In a halfway modern world we could do this with color. > > Or bold the address of the current instruction. > > I have nothing against this, but it will have to be an option, because > dumb terminals, non-Posix emulations of termcap, and some front ends > will need to turn it off (and then the arrow should re-appear). Agreed. I hope that we could do this automatically in 99% of cases, using the termcap capabilities and isatty. We do already rely on readline which requires tgetent. > > Another possibility would be to factor out the name of the function. > > Something like this: > > > > (top) disas > > Dump of assembler code for function gdb_main: > > 0x0000000000454c9e (+0): push %rbp > > 0x0000000000454c9f (+1): mov %rsp,%rbp > > 0x0000000000454ca2 (+4): sub $0x10,%rsp > > 0x0000000000454ca6 (+8): mov %rdi,-0x8(%rbp) > > => 0x0000000000454caa (+12): mov -0x8(%rbp),%rax > > 0x0000000000454cae (+16): mov 0x10(%rax),%eax > > I don't like this: disassembly should look like it looks elsewhere. > However, we could offer an optional removal of the leftmost column, > the address, and the next one, which shows the symbol and offset from > it. Stripping leading zeros, as you point out, will help even more, > especially on 64-bit platforms. I use both of those pieces of information... it's the function name that I don't use. Joel raised a good point about the function name in x/i though. -- Daniel Jacobowitz CodeSourcery