This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC][patch] Allow to disassemble line.


> Date: Mon, 19 Oct 2009 14:48:53 -0400
> From: Daniel Jacobowitz <drow@false.org>
> Cc: tromey@redhat.com, gdb-patches@sourceware.org
> 
> On Mon, Oct 19, 2009 at 11:09:44AM -0700, Paul Pluzhnikov wrote:
> > I've also changed the "current PC marker" from "* " to "=> " (as Eli
> > suggested), so the output looks like this:
> > 
> > (top) disas
> > Dump of assembler code for function gdb_main:
> >    0x0000000000454c9e <gdb_main+0>:     push   %rbp
> >    0x0000000000454c9f <gdb_main+1>:     mov    %rsp,%rbp
> >    0x0000000000454ca2 <gdb_main+4>:     sub    $0x10,%rsp
> >    0x0000000000454ca6 <gdb_main+8>:     mov    %rdi,-0x8(%rbp)
> > => 0x0000000000454caa <gdb_main+12>:    mov    -0x8(%rbp),%rax
> >    0x0000000000454cae <gdb_main+16>:    mov    0x10(%rax),%eax
> >    0x0000000000454cb1 <gdb_main+19>:    mov    %eax,0x678475(%rip) #
> > 0xacd12c <use_windows>
> 
> For whatever it's worth, I miss the extra screen real estate stolen by
> the enlarged prompt (or even the narrower prompt).

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?

> I use a wider than average terminal

How wide is it?  Even on a 17" display I can easily have 130-column
text windows with very readable font, and almost 200 with slightly
less readable one.

> and most of the times I use disassemble it still runs
> off the right and wraps unreadably.  It's fine in examples because
> they have names like "gdb_main" or "bar"...

Please show your counter-examples.  I'm curious to see what kind of
symbols do you have there.

> 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).

> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]