This is the mail archive of the gdb@sources.redhat.com 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]

Consistent format for memory addresses


At one stage, the GDB command "disassemble" output seven hex digits for memory
addresses on 32 bit Intel (GNU/Linux):

(gdb) disassemble main     
Dump of assembler code for function main:
0x80484c6 <main>:       push   %ebp
0x80484c7 <main+1>:     mov    %esp,%ebp
0x80484c9 <main+3>:     sub    $0x238,%esp
0x80484cf <main+9>:     and    $0xfffffff0,%esp
0x80484d2 <main+12>:    mov    $0x0,%eax
0x80484d9 <main+19>:    movl   $0x0,0xffffff98(%ebp)
^^^^^^^^^

Now there are eight:

(gdb) disassemble main     
Dump of assembler code for function main:
0x080484c6 <main+0>:    push   %ebp
0x080484c7 <main+1>:    mov    %esp,%ebp
0x080484c9 <main+3>:    sub    $0x238,%esp
0x080484cf <main+9>:    and    $0xfffffff0,%esp
0x080484d2 <main+12>:   mov    $0x0,%eax
0x080484d7 <main+17>:   sub    %eax,%esp
0x080484d9 <main+19>:   movl   $0x0,0xffffff98(%ebp)
^^^^^^^^^^
Thats fine, eight sits better in the binary world and it makes it
consistent with the output of "info break"

(gdb) break main
(gdb) info break
Num Type           Disp Enb Address    What
1   breakpoint     keep y   0x080484d9 in main at myprog.c:55
                            ^^^^^^^^^^
However "info frame" gives:

(gdb) info frame
Stack level 0, frame at 0xbffff730:
 eip = 0x80484d9 in main (myprog.c:55); saved eip 0x4006015a
       ^^^^^^^^^

Still seven digits. The human mind adjusts easily to such differences, but
front ends---or at least the one I'm writing for Emacs---don't.

So that I don't have to keep making piecemeal changes, I suggest that
memory addresses in "info frame" has the same format as disassemble
and "info break". I've not looked at the internals but maybe they could
all be printed with the same procedure call.

WDYT?

Nick


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