This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
I'm using GDB 4.16 as cross-debugger to a M68010 machine (AT&T 3B1 hardware without an OS). I'm having problems continuing after a breakpoint. Source level stepping after a breakpoint doesn't work, but NEXTI does. --> GDB 4.16 (sparc-sun-solaris2.5 --target m68k-unknown-aout), I started the GDB 4.13 m68k-stub.c which a previous guy had used. I did diffs against 4.16's m68k-stub.c, and then used `patch' to forward merge the changes. I'm curious if these two are compatible. Should I try the whole forward merge again. Is the m68k-stub a victim of bit rot? Should I just hack it to work? It runs with "mc68020" defined. I've already modified mem2hex() to access in 16-bit words if address and count are even. Is "qOffsets" important. It seems to find variables OK without it. The code loads into a specific location. There is no dynamically placed code. (Gosh, this message got long...) Anyone got any ideas to help me out? Description ----------- The problem in my code is the push before the call to sbrk() is getting skipped. Garbage is used and sbrk() sez "too much" and returns -1. The second word of "pea 0x2000" turns into "movel d0,d0". It seems the PC sent to the host is *after* the breakpoint (normal processing for the TRAP #15 instruction). The breakpoint occurs as it should. GDB resumes execution starting at the next short (2-bytes) after the breakpoint (after the inserted TRAP instruction). In most cases is needs to be backed up once the original instruction is restored by GDB. For instance (with "set remotedebug 1 ; set remote_debug = 1") Address 0x35c2 is an instruction boundary ("pea 0x2000") which is "whole_block = sbrk(0x2000);". Address 0x7efec is on the stack. ------------------------- 68-gdb> tbreak main Breakpoint 1 at 0x35c2: file try.cc, line 455. 68-gdb> cont Continuing. Sending packet: $m35c2,2#c8...Ack Packet received: 4878 Sending packet: $M35c2,2:4e4f#15...Ack <-- inserts TRAP. Packet received: OK Sending packet: $m35d4,2#cb...Ack Packet received: 4878 Sending packet: $M35d4,2:4e4f#18...Ack Packet received: OK Sending packet: $Hc0#db...Ack Packet received: Sending packet: $c#63...Ack Packet received: S05 Sending packet: $g#67...Ack Packet received: 0000000100000036061c0000062000000624000006280000062c000000000000000000d8000772fc063c00000640000006440000064800000007efec0007efec00002700000035c4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 Program received signal SIGTRAP, Trace/breakpoint trap. Sending packet: $M35c2,2:4878#bd...Ack <-- restores original word. Packet received: OK Sending packet: $M35d4,2:4878#c0...Ack Packet received: OK 0x35c4 in main () at try.cc:455 455 whole_block = sbrk(PAGE_SIZE*2); Current language: auto; currently c++ 68-gdb> set remotedebug 0 68-gdb> x /6i $pc 0x35c4 <main+12>: movel %d0,%d0 0x35c6 <main+14>: jsr 0x4fac <sbrk> 0x35cc <main+20>: addqw #4,%sp 0x35ce <main+22>: movel %d0,0x63be <whole_block> 0x35d4 <main+28>: pea 0x1000 0x35d8 <main+32>: movel %d0,%sp@- 68-gdb> x /4i $pc -2 0x35c2 <main+10>: pea 0x2000 0x35c6 <main+14>: jsr 0x4fac <sbrk> 0x35cc <main+20>: addqw #4,%sp 0x35ce <main+22>: movel %d0,0x63be <whole_block> 68-gdb> ------------------------- A little examination reveals GDB believes the PC has advanced, when it really should not have. The second "display" shows the correct opcode. ------------------------- 68-gdb> info reg pc pc 0x35c4 0x35c4 ========================= ------------------------- Now if I NEXTI, the first instruction is at 0x35c4, which is the operand to the "pea" where the breakpoint was set. Uuuggghhhh!!!! ------------------------- 68-gdb> display /i $pc 1: x/i $pc 0x35c4 <main+12>: movel %d0,%d0 68-gdb> set remotedebug 1 68-gdb> nexti Sending packet: $m35c2,2#c8...Ack Packet received: 4878 Sending packet: $M35c2,2:4e4f#15...Ack Packet received: OK Sending packet: $s#73...Ack Packet received: S05 Sending packet: $g#67...Ack Packet received: 0000000100000036061c0000062000000624000006280000062c000000000000000000d8000772fc063c00000640000006440000064800000007efec0007efec0000a700000035c6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 Sending packet: $M35c2,2:4878#bd...Ack Packet received: OK 0x35c6 455 whole_block = sbrk(PAGE_SIZE*2); 1: x/i $pc 0x35c6 <main+14>: Sending packet: $m35c6,1#cb...Ack Packet received: 4e Sending packet: $m35c6,2#cc...Ack Packet received: 4eb9 Sending packet: $m35c8,4#d0...Ack Packet received: 00004fac jsr 0x4fac <sbrk> 68-gdb> ------------------------- After a while of NEXT comamnds I start getting SIGILL instead of breakpoints. The source line does not change (the PC reg does not advance)... ------------------------- NEXT Sending packet: $m35c2,2#c8...Ack Packet received: 4878 Sending packet: $M35c2,2:4e4f#15...Ack Packet received: OK Sending packet: $S04#b7...Ack Packet received: Can't send signals to this remote system. SIGILL not sent. Sending packet: $s#73...Ack Packet received: S04 Sending packet: $g#67...Ack Packet received: 000000000000002b061c0000062000000624000006280000062c00000000000000e50000ffffffef063c00000640000006440000064800000007efec0007efd80000a714000035fc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 Program received signal SIGILL, Illegal instruction. Sending packet: $M35c2,2:4878#bd...Ack Packet received: OK 0x35fc in main () at try.cc:457 457 printf( "Located block at $%p (whole at $%p)\n", block, whole_block ); 1: x/i $pc 0x35fc <main+68>: Sending packet: $m35fc,1#fb...Ack Packet received: 00 Sending packet: $m35fc,2#fc...Ack Packet received: 000c Sending packet: $m35fe,2#fe...Ack Packet received: 72ff orib #-1,%a4 68-gdb> --------------------------------------