This is the mail archive of the gdb-patches@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]

Re: RFA: fix GDB casts when pointers are not addresses



Andrew Cagney <ac131313@cygnus.com> writes:
> This only leaves ``x/...''.  How does that behavour compare?

Yes, the commands you gave above still work; see below.  There are no
new regressions on the test suite, other than those I mentioned in my
original I-hate-the-D10V patch, so I assume the data commands still
work, too.

Michael Snyder asked privately about whether assigning values to $pc
still worked (he's thinking of a bug someone reported internal to Red
Hat).  The transcript below shows that that still works, too.


> The most 
> important thing was that given:
> 
> (gdb) print main
> $1 = {int ()} 0x101405c <main>
> (gdb) print/x &main
> 
> things like:
> 
> (gdb) x/i main
> disassembled <main>
> (gdb) x/i 0x101405c
> disassembled <main>
> (gdb) x/b 0x101405c
> hex dump of main
> 
> and
> 
> (gdb) disassemble main
> disassembled <main>
> (gdb) disassemble 0x101405c
> 
> continued to work (assuming that they did before :-/).  Similar for data 
> values.

Here's the demo:

$ $DD10v/gdb/gdb pointer
GNU gdb 2001-07-06-cvs (MI_OUT)
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=d10v-elf"...
(gdb) x/3i main
0x101405c <main>:       st      r11, @-sp       ->      st      r13, @-sp
0x1014060 <main+4>:     mv      r11, sp ||      nop
0x1014064 <main+8>:     ldi.l   r0, 0x4

(These are the correct instructions, according to objdump -d.)

(gdb) x/3i 0x101405c
0x101405c <main>:       st      r11, @-sp       ->      st      r13, @-sp
0x1014060 <main+4>:     mv      r11, sp ||      nop
0x1014064 <main+8>:     ldi.l   r0, 0x4
(gdb) x/4b 0x101405c
0x101405c <main>:       0x76    0xbf    0xed    0xbf

(Those are the correct bytes, according to objdump -d.)

(gdb) disassemble main
Dump of assembler code for function main:
0x101405c <main>:       st      r11, @-sp       ->      st      r13, @-sp
0x1014060 <main+4>:     mv      r11, sp ||      nop
0x1014064 <main+8>:     ldi.l   r0, 0x4
0x1014068 <main+12>:    ldi.s   r1, 0x2 ||      nop
0x101406c <main+16>:    bl.l    0x1014130 <printf>
0x1014070 <main+20>:    ldi.l   r0, 0x1c
0x1014074 <main+24>:    ldi.s   r1, 0x2 ||      nop
0x1014078 <main+28>:    bl.l    0x1014130 <printf>
0x101407c <main+32>:    ldi.l   r0, 0x39
0x1014080 <main+36>:    ldi.l   r1, 0x5017
0x1014084 <main+40>:    bl.l    0x1014130 <printf>
0x1014088 <main+44>:    add3    sp, r11, 0x0
0x101408c <main+48>:    ld      r13, @sp+       ->      ld      r11, @sp+
0x1014090 <main+52>:    jmp     r13     ||      nop
End of assembler dump.
(gdb) disassemble 0x101405c
Dump of assembler code for function main:
0x101405c <main>:       st      r11, @-sp       ->      st      r13, @-sp
0x1014060 <main+4>:     mv      r11, sp ||      nop
0x1014064 <main+8>:     ldi.l   r0, 0x4
0x1014068 <main+12>:    ldi.s   r1, 0x2 ||      nop
0x101406c <main+16>:    bl.l    0x1014130 <printf>
0x1014070 <main+20>:    ldi.l   r0, 0x1c
0x1014074 <main+24>:    ldi.s   r1, 0x2 ||      nop
0x1014078 <main+28>:    bl.l    0x1014130 <printf>
0x101407c <main+32>:    ldi.l   r0, 0x39
0x1014080 <main+36>:    ldi.l   r1, 0x5017
0x1014084 <main+40>:    bl.l    0x1014130 <printf>
0x1014088 <main+44>:    add3    sp, r11, 0x0
0x101408c <main+48>:    ld      r13, @sp+       ->      ld      r11, @sp+
0x1014090 <main+52>:    jmp     r13     ||      nop
End of assembler dump.
(gdb) break main
Breakpoint 1 at 0x1014064: file pointer.c, line 10.
(gdb) target sim
Connected to the simulator.
(gdb) load
Loading section .rodata, size 0x26a lma 0x2000004
Loading section .data, size 0x3cc lma 0x2000270
Loading section .text, size 0x8990 lma 0x1014000
Start address 0x1014000
Transfer rate: 294448 bits in <1 sec.
(gdb) run
Starting program: /home/jimb/d10v/play/pointer 

Breakpoint 1, main () at pointer.c:10
10        EXPR (sizeof (void *));
(gdb) p/x $pc
$1 = 0x1014064
(gdb) x/3i $pc
0x1014064 <main+8>:     ldi.l   r0, 0x4
0x1014068 <main+12>:    ldi.s   r1, 0x2 ||      nop
0x101406c <main+16>:    bl.l    0x1014130 <printf>
(gdb) set $pc = 0x1014070
(gdb) p/x $pc
$2 = 0x1014070
(gdb) 


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