Re: [RFA] New GDB target iq2000

Corinna Vinschen
2005-03-04T15:51:50Z

On Mar 4 10:06, Daniel Jacobowitz wrote:
> On Fri, Mar 04, 2005 at 04:01:29PM +0100, Corinna Vinschen wrote:
> > All three cases don't look like simple coincidence. In all three cases
> > we suffer from either optimized code or unavailable debug information.
> > The target specific "knowledge", which is represented by the call to
> > iq2000_scan_prologue helps to master this situation.
>
> Would you mind posting disassembly, line table (readelf -wl), and GDB
> transcript for these failures?

Sure. First the both break.exp fails, which are interlocked:

FAIL: gdb.base/break.exp: breakpoint small function, optimized file
FAIL: gdb.base/break.exp: run until breakpoint set at small function, optimized file

- Disassembly of function marker4:

80000368 <marker4>:
80000368: 27 bd ff f0 addiu r29,r29,0xfff0

8000036c <$LCFI9>:
8000036c: af bb 00 08 sw r27,0x8(r29)

80000370 <$LCFI10>:
80000370: 00 1d d8 25 or r27,r0,r29

80000374 <$LCFI11>:
80000374: af 64 00 00 sw r4,0x0(r27)

80000378 <$LM8>:
80000378: 00 1b e8 25 or r29,r0,r27
8000037c: 8f bb 00 08 lw r27,0x8(r29)
80000380: 00 00 00 00 nop
80000384: 27 bd 00 10 addiu r29,r29,0x10
80000388: 03 e0 00 08 jr r31
8000038c: 00 00 00 00 nop

- Line table for file break1.c:

Line Number Statements:
Extended opcode 2: set Address to 0x800002e8
Special opcode 49: advance Address by 0 to 0x800002e8 and Line by 39 to 40
Extended opcode 2: set Address to 0x800002f4
Copy
Extended opcode 2: set Address to 0x80000310
Special opcode 11: advance Address by 0 to 0x80000310 and Line by 1 to 41
Extended opcode 2: set Address to 0x80000320
Copy
Extended opcode 2: set Address to 0x8000033c
Special opcode 11: advance Address by 0 to 0x8000033c and Line by 1 to 42
Extended opcode 2: set Address to 0x80000350
Copy
Extended opcode 2: set Address to 0x80000368
Special opcode 11: advance Address by 0 to 0x80000368 and Line by 1 to 43
Extended opcode 2: set Address to 0x80000378
Copy
Extended opcode 2: set Address to 0x80000390
Extended opcode 1: End of Sequence

- GDB testsuite result with iq2000_skip_prologue:

break marker4^M
Breakpoint 2 at 0x800001f0: file testsuite/gdb.base/break1.c, line 43.^M
(gdb) PASS: gdb.base/break.exp: breakpoint small function, optimized file
run^M
Starting program: testsuite/gdb.base/breako2 ^M
^M
Breakpoint 1, main (argc=0, argv=0x0, envp=0x0) at testsuite/gdb.base/break.c:85^M
85 {^M
(gdb) PASS: gdb.base/break.exp: run until function breakpoint, optimized file (code motion)
continue^M
Continuing.^M
720^M
^M
Breakpoint 2, marker4 (d=177601976) at testsuite/gdb.base/break1.c:43^M
43 void marker4 (d) long d; {} /* set breakpoint 13 here */^M
PASS: gdb.base/break.exp: run until breakpoint set at small function, optimized file

- GDB testsuite result with skip_prologue_using_sal:

break marker4^M
Breakpoint 2 at 0x800001f8^M
(gdb) FAIL: gdb.base/break.exp: breakpoint small function, optimized file
run^M
Starting program: testsuite/gdb.base/breako2 ^M
^M
Breakpoint 1, main (argc=0, argv=0x0, envp=0x0) at testsuite/gdb.base/break.c:85^M
85 {^M
(gdb) PASS: gdb.base/break.exp: run until function breakpoint, optimized file (code motion)
continue^M
Continuing.^M
720^M
^M
Breakpoint 2, 0x800001f8 in write_int ()^M
(gdb) FAIL: gdb.base/break.exp: run until breakpoint set at small function, optimized file

Now the nodebug.exp case:

FAIL: gdb.base/nodebug.exp: running to inner in runto

- Disassembly of function inner:

80000048 <inner>:
80000048: 27 bd ff f0 addiu r29,r29,0xfff0
8000004c: af bb 00 08 sw r27,0x8(r29)
80000050: 00 1d d8 25 or r27,r0,r29
80000054: af 64 00 00 sw r4,0x0(r27)
80000058: 3c 02 00 00 lui r2,0x0
8000005c: 8f 63 00 00 lw r3,0x0(r27)
80000060: 8c 42 10 00 lw r2,0x1000(r2)
80000064: 00 00 00 00 nop
80000068: 00 62 10 21 addu r2,r3,r2
8000006c: 3c 03 00 00 lui r3,0x0
80000070: 8c 63 10 04 lw r3,0x1004(r3)
80000074: 00 00 00 00 nop
80000078: 00 43 10 21 addu r2,r2,r3
8000007c: 3c 03 00 00 lui r3,0x0
80000080: 8c 63 19 b4 lw r3,0x19b4(r3)
80000084: 00 00 00 00 nop
80000088: 00 43 10 21 addu r2,r2,r3
8000008c: 3c 03 00 00 lui r3,0x0
80000090: 8c 63 19 74 lw r3,0x1974(r3)
80000094: 00 00 00 00 nop
80000098: 00 43 10 21 addu r2,r2,r3
8000009c: 00 1b e8 25 or r29,r0,r27
800000a0: 8f bb 00 08 lw r27,0x8(r29)
800000a4: 00 00 00 00 nop
800000a8: 27 bd 00 10 addiu r29,r29,0x10
800000ac: 03 e0 00 08 jr r31

- Line table for file nodebug.c:

There is none since nodebug.c is compiled without -g

- GDB testsuite result with iq2000_skip_prologue:

(gdb) file testsuite/gdb.base/nodebug^M
Reading symbols from testsuite/gdb.base/nodebug...done.^M
(gdb) target sim ^M
Connected to the simulator.^M
(gdb) load^M
Loading section .text, size 0x3858 lma 0x80000000^M
Loading section .data, size 0x7e0 lma 0x1000^M
Loading section .eh_frame, size 0x118 lma 0x17e0^M
Loading section .rodata, size 0x7c lma 0x18f8^M
Start address 0x80000000^M
Transfer rate: 134752 bits in <1 sec.^M
(gdb) delete breakpoints^M
(gdb) info breakpoints^M
No breakpoints or watchpoints.^M
(gdb) break inner^M
Breakpoint 1 at 0x80000058^M
(gdb) target sim ^M
Connected to the simulator.^M
(gdb) load^M
Loading section .text, size 0x3858 lma 0x80000000^M
Loading section .data, size 0x7e0 lma 0x1000^M
Loading section .eh_frame, size 0x118 lma 0x17e0^M
Loading section .rodata, size 0x7c lma 0x18f8^M
Start address 0x80000000^M
Transfer rate: 134752 bits in <1 sec.^M
(gdb) run ^M
Starting program: testsuite/gdb.base/nodebug ^M
^M
Breakpoint 1, 0x80000058 in inner ()^M

- GDB testsuite result with skip_prologue_using_sal:

(gdb) file testsuite/gdb.base/nodebug^M
Reading symbols from testsuite/gdb.base/nodebug...done.^M
(gdb) target sim ^M
Connected to the simulator.^M
(gdb) load^M
Loading section .text, size 0x3858 lma 0x80000000^M
Loading section .data, size 0x7e0 lma 0x1000^M
Loading section .eh_frame, size 0x118 lma 0x17e0^M
Loading section .rodata, size 0x7c lma 0x18f8^M
Start address 0x80000000^M
Transfer rate: 134752 bits in <1 sec.^M
(gdb) delete breakpoints^M
(gdb) info breakpoints^M
No breakpoints or watchpoints.^M
(gdb) break inner^M
Breakpoint 1 at 0x0^M
(gdb) target sim ^M
Connected to the simulator.^M
(gdb) load^M
Loading section .text, size 0x3858 lma 0x80000000^M
Loading section .data, size 0x7e0 lma 0x1000^M
Loading section .eh_frame, size 0x118 lma 0x17e0^M
Loading section .rodata, size 0x7c lma 0x18f8^M
Start address 0x80000000^M
Transfer rate: 134752 bits in <1 sec.^M
(gdb) run ^M
Starting program: testsuite/gdb.base/nodebug ^M
^M
*** EXIT code 28^M
^M
Program exited with code 034.^M
(gdb) FAIL: gdb.base/nodebug.exp: running to inner in runto

Note especially the `break inner' which sets a breakpoint to address 0.

Corinna

--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat, Inc.