* software single step
@ 2002-11-03 5:54 Stuart Hughes
2002-11-03 17:22 ` Daniel Jacobowitz
0 siblings, 1 reply; 7+ messages in thread
From: Stuart Hughes @ 2002-11-03 5:54 UTC (permalink / raw)
To: gdb
Hi,
I'm trying to use gdb/gdbserver to debug a strong-arm target. I'm
having problems with single stepping. If I try to step into the loop
shown below, it simply runs on printing all 10 loop iterations.
for ( i = 0; i < 10 ; i++ ) {
printf("loop count = %d\n", i);
}
If I disassemble, the problem seems to be the branch instructions, the
loop control looks like:
0x83c4 <main+36>: cmp r3, #9 ; 0x9
0x83c8 <main+40>: ble 0x83d0 <main+48>
0x83cc <main+44>: b 0x83ec <main+76>
0x83d0 <main+48>: ldr r0, [pc, #60] ; 0x8414 <main+116>
To investigate this further, I built a "native" gdb for the strong-arm
from the same code gdb code base. This worked correectly, I was able to
step into and control the flow through the loop.
It seems as though the problem is that gdbserver is implementing
software_single_step differently to a "native" gdb.
Has anyone else seen this problem ? Does anyone know of a work around,
or a fix ?
TIA, Stuart.
BTW: my environment is:
gdb/gdbserver - 5.2 or 5.3 CVS (same behaviour)
linux - 2.4.18
gcc - 2.95.3 or 3.1 (same behaviour)
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: software single step 2002-11-03 5:54 software single step Stuart Hughes @ 2002-11-03 17:22 ` Daniel Jacobowitz 2002-11-11 9:13 ` Stuart Hughes 0 siblings, 1 reply; 7+ messages in thread From: Daniel Jacobowitz @ 2002-11-03 17:22 UTC (permalink / raw) To: Stuart Hughes; +Cc: gdb On Sun, Nov 03, 2002 at 08:54:12AM -0500, Stuart Hughes wrote: > Hi, > > I'm trying to use gdb/gdbserver to debug a strong-arm target. I'm > having problems with single stepping. If I try to step into the loop > shown below, it simply runs on printing all 10 loop iterations. > > for ( i = 0; i < 10 ; i++ ) { > printf("loop count = %d\n", i); > } > > If I disassemble, the problem seems to be the branch instructions, the > loop control looks like: > > 0x83c4 <main+36>: cmp r3, #9 ; 0x9 > 0x83c8 <main+40>: ble 0x83d0 <main+48> > 0x83cc <main+44>: b 0x83ec <main+76> > 0x83d0 <main+48>: ldr r0, [pc, #60] ; 0x8414 <main+116> > > To investigate this further, I built a "native" gdb for the strong-arm > from the same code gdb code base. This worked correectly, I was able to > step into and control the flow through the loop. > > It seems as though the problem is that gdbserver is implementing > software_single_step differently to a "native" gdb. > > Has anyone else seen this problem ? Does anyone know of a work around, > or a fix ? gdbserver doesn't implement software single step; the connected GDB client handles it. You may want to 'set debug target 1' and 'set debug remote 1', and watch for differences. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: software single step 2002-11-03 17:22 ` Daniel Jacobowitz @ 2002-11-11 9:13 ` Stuart Hughes 2002-11-11 9:50 ` Daniel Jacobowitz 0 siblings, 1 reply; 7+ messages in thread From: Stuart Hughes @ 2002-11-11 9:13 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: gdb [-- Attachment #1: Type: text/plain, Size: 2386 bytes --] Daniel Jacobowitz wrote: > > On Sun, Nov 03, 2002 at 08:54:12AM -0500, Stuart Hughes wrote: > > Hi, > > > > I'm trying to use gdb/gdbserver to debug a strong-arm target. I'm > > having problems with single stepping. If I try to step into the loop > > shown below, it simply runs on printing all 10 loop iterations. > > > > for ( i = 0; i < 10 ; i++ ) { > > printf("loop count = %d\n", i); > > } > > [snip] > > > > Has anyone else seen this problem ? Does anyone know of a work around, > > or a fix ? > > gdbserver doesn't implement software single step; the connected GDB > client handles it. You may want to 'set debug target 1' and 'set debug > remote 1', and watch for differences. Hi Daniel, I've investigted this further. I tried the things you suggested, but I'm finding it hard to correlate the output from the native sesion and the remote session. The native session outputs a a huge slew of output before it first manages to control the inferior. Looking at the ouput from the remote debugging session, it looks okay, it seems to insert a breakpoint (I'm guessing, it writes 10300be5 to the point to break at), and then continues. When the inferior wakes up, it sends back a 'T' packet. I thought this should stop gdb, but it doesn't. The session carries on, without any user intervention until the end of the program. The code of the loop looks like this when disassembled: for ( i = 0; i < 10 ; i++ ) { 84b0: e3a03000 mov r3, #0 ; 0x0 84b4: e50b3010 str r3, [fp, -#16] 84b8: e51b3010 ldr r3, [fp, -#16] 84bc: e3530009 cmp r3, #9 ; 0x9 84c0: da000000 ble 84c8 <main+0x28> 84c4: ea000006 b 84e4 <main+0x44> printf("loop count = %d\n", i); 84c8: e59f0020 ldr r0, [pc, #32] ; 84f0 <main+0x50> 84cc: e51b1010 ldr r1, [fp, -#16] 84d0: ebffff9d bl 834c <_init+0x64> 84d4: e51b3010 ldr r3, [fp, -#16] 84d8: e2833001 add r3, r3, #1 ; 0x1 84dc: e50b3010 str r3, [fp, -#16] 84e0: eafffff4 b 84b8 <main+0x18> } I've attached the output captured from 'set debug remote' FYI. Do you have any suggestions where I could look next ?? Regards, Stuart [-- Attachment #2: gdb_remote.txt --] [-- Type: text/plain, Size: 8009 bytes --] Script started on Mon Nov 11 16:10:03 2002 $ gdb hello GNU gdb 5.2 Copyright 2002 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=arm-linux"... 0x40002980 in ?? () (gdb) b main Breakpoint 1 at 0x84b0: file hello.c, line 7. (gdb) set debug remote 1 (gdb) c Continuing. Sending packet: $Z0,4000ca4c,4#35...Ack Packet received: Packet Z0 (software-breakpoint) is NOT supported Sending packet: $m4000ca4c,4#ec...Ack Packet received: 98040000 Sending packet: $X4000ca4c,0:#0d...Ack Packet received: binary downloading NOT suppported by target Sending packet: $M4000ca4c,4:01009fef#31...Ack Packet received: OK Sending packet: $m84b0,4#cb...Ack Packet received: 0030a0e3 Sending packet: $M84b0,4:01009fef#10...Ack Packet received: OK Sending packet: $Hc0#db...Ack Packet received: OK Sending packet: $c#63...Ack Packet received: T050b:e4fcffbf;0d:d4fcffbf;0f:b0840000; Sending packet: $g#67...Ack Packet received: 0100000014fdffbf1cfdffbf0000000024e7014014fdffbfe882000040d9004001000000a084000080071240e4fcffbfe8fcffbfd4fcffbff0d20340b08400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 Sending packet: $m84b0,4#cb...Ack Packet received: 01009fef Sending packet: $m84b0,4#cb...Ack Packet received: 01009fef Sending packet: $m84a0,4#ca...Ack Packet received: 0dc0a0e1 Sending packet: $m84a4,4#ce...Ack Packet received: 00d82de9 Sending packet: $m84a8,4#d2...Ack Packet received: 04b04ce2 Sending packet: $m84ac,4#fd...Ack Packet received: 04d04de2 Sending packet: $m84b0,4#cb...Ack Packet received: 01009fef Sending packet: $m84b4,4#cf...Ack Packet received: 10300be5 Sending packet: $m84b8,4#d3...Ack Packet received: 10301be5 Sending packet: $m84bc,4#fe...Ack Packet received: 090053e3 Sending packet: $m84c0,4#cc...Ack Packet received: 000000da Sending packet: $M4000ca4c,4:98040000#9b...Ack Packet received: OK Sending packet: $M84b0,4:0030a0e3#d1...Ack Packet received: OK Breakpoint 1, main () at hello.c:7 7 for ( i = 0; i < 10 ; i++ ) { (gdb) step Sending packet: $m84b0,4#cb...Ack Packet received: 0030a0e3 Sending packet: $m84b4,4#cf...Ack Packet received: 10300be5 Sending packet: $M84b4,4:01009fef#14...Ack Packet received: OK Sending packet: $Hc0#db...Ack Packet received: OK Sending packet: $c#63...Ack Packet received: T050b:e4fcffbf;0d:d4fcffbf;0f:b4840000; Sending packet: $M84b4,4:10300be5#d9...Ack Packet received: OK Sending packet: $m84b4,4#cf...Ack Packet received: 10300be5 Sending packet: $m4000ca4c,4#ec...Ack Packet received: 98040000 Sending packet: $M4000ca4c,4:01009fef#31...Ack Packet received: OK Sending packet: $m84b0,4#cb...Ack Packet received: 0030a0e3 Sending packet: $M84b0,4:01009fef#10...Ack Packet received: OK Sending packet: $m84b4,4#cf...Ack Packet received: 10300be5 Sending packet: $g#67...Ack Packet received: 0100000014fdffbf1cfdffbf0000000024e7014014fdffbfe882000040d9004001000000a084000080071240e4fcffbfe8fcffbfd4fcffbff0d20340b48400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 Sending packet: $m84b8,4#d3...Ack Packet received: 10301be5 Sending packet: $M84b8,4:01009fef#18...Ack Packet received: OK Sending packet: $Hc0#db...Ack Packet received: OK Sending packet: $c#63...Ack Packet received: T050b:e4fcffbf;0d:d4fcffbf;0f:b8840000; Sending packet: $M84b8,4:10301be5#de...Ack Packet received: OK Sending packet: $m84b8,4#d3...Ack Packet received: 10301be5 Sending packet: $g#67...Ack Packet received: 0100000014fdffbf1cfdffbf0000000024e7014014fdffbfe882000040d9004001000000a084000080071240e4fcffbfe8fcffbfd4fcffbff0d20340b88400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 Sending packet: $m84bc,4#fe...Ack Packet received: 090053e3 Sending packet: $M84bc,4:01009fef#43...Ack Packet received: OK Sending packet: $c#63...Ack Packet received: T050b:e4fcffbf;0d:d4fcffbf;0f:bc840000; Sending packet: $M84bc,4:090053e3#e1...Ack Packet received: OK Sending packet: $m84bc,4#fe...Ack Packet received: 090053e3 Sending packet: $g#67...Ack Packet received: 0100000014fdffbf1cfdffbf0000000024e7014014fdffbfe882000040d9004001000000a084000080071240e4fcffbfe8fcffbfd4fcffbff0d20340bc8400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 Sending packet: $m84c0,4#cc...Ack Packet received: 000000da Sending packet: $M84c0,4:01009fef#11...Ack Packet received: OK Sending packet: $c#63...Ack Packet received: T050b:e4fcffbf;0d:d4fcffbf;0f:c0840000; Sending packet: $M84c0,4:000000da#cb...Ack Packet received: OK Sending packet: $m84c0,4#cc...Ack Packet received: 000000da Sending packet: $g#67...Ack Packet received: 0100000014fdffbf1cfdffbf0000000024e7014014fdffbfe882000040d9004001000000a084000080071240e4fcffbfe8fcffbfd4fcffbff0d20340c08400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 Sending packet: $m84c4,4#d0...Ack Packet received: 060000ea Sending packet: $M84c4,4:01009fef#15...Ack Packet received: OK Sending packet: $c#63...Ack Packet received: T050b:e4fcffbf;0d:d4fcffbf;0f:c4840000; Sending packet: $M84c4,4:060000ea#d6...Ack Packet received: OK Sending packet: $m84c4,4#d0...Ack Packet received: 060000ea Sending packet: $g#67...Ack Packet received: 0f0000000f0000000f0000000a00000024e7014014fdffbfe882000040d9004001000000a084000080071240e4fcffbff0081240d4fcffbfd4840000c48400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 Sending packet: $m84e4,4#d2...Ack Packet received: 0030a0e3 Sending packet: $M84e4,4:01009fef#17...Ack Packet received: OK Sending packet: $c#63...Ack Packet received: T050b:e4fcffbf;0d:d4fcffbf;0f:e4840000; Sending packet: $M84e4,4:0030a0e3#d8...Ack Packet received: OK Sending packet: $m84e4,4#d2...Ack Packet received: 0030a0e3 Sending packet: $g#67...Ack Packet received: 0f0000000f0000000f0000000a00000024e7014014fdffbfe882000040d9004001000000a084000080071240e4fcffbff0081240d4fcffbfd4840000e48400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 Sending packet: $m84e4,4#d2...Ack Packet received: 0030a0e3 Sending packet: $m84e4,4#d2...Ack Packet received: 0030a0e3 Sending packet: $m84a0,4#ca...Ack Packet received: 0dc0a0e1 Sending packet: $m84a4,4#ce...Ack Packet received: 00d82de9 Sending packet: $m84a8,4#d2...Ack Packet received: 04b04ce2 Sending packet: $m84ac,4#fd...Ack Packet received: 04d04de2 Sending packet: $m84b0,4#cb...Ack Packet received: 01009fef Sending packet: $m84b4,4#cf...Ack Packet received: 10300be5 Sending packet: $m84b8,4#d3...Ack Packet received: 10301be5 Sending packet: $m84bc,4#fe...Ack Packet received: 090053e3 Sending packet: $m84c0,4#cc...Ack Packet received: 000000da Sending packet: $M4000ca4c,4:98040000#9b...Ack Packet received: OK Sending packet: $M84b0,4:0030a0e3#d1...Ack Packet received: OK 10 return 0; (gdb) quit ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: software single step 2002-11-11 9:13 ` Stuart Hughes @ 2002-11-11 9:50 ` Daniel Jacobowitz [not found] ` <3DCFEFA0.539D1767@zee2.com> 0 siblings, 1 reply; 7+ messages in thread From: Daniel Jacobowitz @ 2002-11-11 9:50 UTC (permalink / raw) To: Stuart Hughes; +Cc: gdb On Mon, Nov 11, 2002 at 05:12:32PM +0000, Stuart Hughes wrote: > Daniel Jacobowitz wrote: > > > > On Sun, Nov 03, 2002 at 08:54:12AM -0500, Stuart Hughes wrote: > > > Hi, > > > > > > I'm trying to use gdb/gdbserver to debug a strong-arm target. I'm > > > having problems with single stepping. If I try to step into the loop > > > shown below, it simply runs on printing all 10 loop iterations. > > > > > > for ( i = 0; i < 10 ; i++ ) { > > > printf("loop count = %d\n", i); > > > } > > > > [snip] > > > > > > Has anyone else seen this problem ? Does anyone know of a work around, > > > or a fix ? > > > > gdbserver doesn't implement software single step; the connected GDB > > client handles it. You may want to 'set debug target 1' and 'set debug > > remote 1', and watch for differences. > > > Hi Daniel, > > I've investigted this further. I tried the things you suggested, but > I'm finding it hard to correlate the output from the native sesion and > the remote session. The native session outputs a a huge slew of output > before it first manages to control the inferior. > > Looking at the ouput from the remote debugging session, it looks okay, > it seems to insert a breakpoint (I'm guessing, it writes 10300be5 to the > point to break at), and then continues. When the inferior wakes up, it > sends back a 'T' packet. I thought this should stop gdb, but it > doesn't. The session carries on, without any user intervention until > the end of the program. > > The code of the loop looks like this when disassembled: > > for ( i = 0; i < 10 ; i++ ) { > 84b0: e3a03000 mov r3, #0 ; 0x0 > 84b4: e50b3010 str r3, [fp, -#16] > 84b8: e51b3010 ldr r3, [fp, -#16] > 84bc: e3530009 cmp r3, #9 ; 0x9 > 84c0: da000000 ble 84c8 <main+0x28> > 84c4: ea000006 b 84e4 <main+0x44> > printf("loop count = %d\n", i); > 84c8: e59f0020 ldr r0, [pc, #32] ; 84f0 > <main+0x50> > 84cc: e51b1010 ldr r1, [fp, -#16] > 84d0: ebffff9d bl 834c <_init+0x64> > 84d4: e51b3010 ldr r3, [fp, -#16] > 84d8: e2833001 add r3, r3, #1 ; 0x1 > 84dc: e50b3010 str r3, [fp, -#16] > 84e0: eafffff4 b 84b8 <main+0x18> > } > > I've attached the output captured from 'set debug remote' FYI. > > > Do you have any suggestions where I could look next ?? Well, first let me explain the relevant bits of your transcript. What it's trying to do is to step one instruction at a time until the source line changes. > Sending packet: $m4000ca4c,4#ec...Ack > Packet received: 98040000 > Sending packet: $M4000ca4c,4:01009fef#31...Ack > Packet received: OK > Sending packet: $m84b0,4#cb...Ack > Packet received: 0030a0e3 > Sending packet: $M84b0,4:01009fef#10...Ack > Packet received: OK Set the shared library breakpoint and main breakpoint. > Sending packet: $Hc0#db...Ack > Packet received: OK > Sending packet: $c#63...Ack > Packet received: T050b:e4fcffbf;0d:d4fcffbf;0f:b0840000; Continue; stopped at main. > Sending packet: $M4000ca4c,4:98040000#9b...Ack > Packet received: OK > Sending packet: $M84b0,4:0030a0e3#d1...Ack > Packet received: OK Remove breakpoints. > Breakpoint 1, main () at hello.c:7 > 7 for ( i = 0; i < 10 ; i++ ) { > (gdb) step > Sending packet: $m84b0,4#cb...Ack > Packet received: 0030a0e3 > Sending packet: $m84b4,4#cf...Ack > Packet received: 10300be5 > Sending packet: $M84b4,4:01009fef#14...Ack > Packet received: OK > Sending packet: $Hc0#db...Ack > Packet received: OK > Sending packet: $c#63...Ack > Packet received: T050b:e4fcffbf;0d:d4fcffbf;0f:b4840000; Insert only the breakpoint at $pc+4, and continue; then we stop at $pc+4. 0x84b4. > Sending packet: $M84b4,4:10300be5#d9...Ack > Packet received: OK Remove the temporary step breakpoint. > Sending packet: $m4000ca4c,4#ec...Ack > Packet received: 98040000 > Sending packet: $M4000ca4c,4:01009fef#31...Ack > Packet received: OK > Sending packet: $m84b0,4#cb...Ack > Packet received: 0030a0e3 > Sending packet: $M84b0,4:01009fef#10...Ack > Packet received: OK Reinsert breakpoints. > Sending packet: $m84b4,4#cf...Ack > Packet received: 10300be5 > Sending packet: $g#67...Ack > Packet received: 0100000014fdffbf1cfdffbf0000000024e7014014fdffbfe882000040d9004001000000a084000080071240e4fcffbfe8fcffbfd4fcffbff0d20340b48400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 Fetch the instruction and the register values... > Sending packet: $m84b8,4#d3...Ack > Packet received: 10301be5 > Sending packet: $M84b8,4:01009fef#18...Ack > Packet received: OK Set a step breakpoint at 0x84b8. > Sending packet: $Hc0#db...Ack > Packet received: OK > Sending packet: $c#63...Ack > Packet received: T050b:e4fcffbf;0d:d4fcffbf;0f:b8840000; Continue, stopping at 0x84b8. > Sending packet: $M84b8,4:10301be5#de...Ack > Packet received: OK > Sending packet: $m84b8,4#d3...Ack > Packet received: 10301be5 > Sending packet: $g#67...Ack > Packet received: 0100000014fdffbf1cfdffbf0000000024e7014014fdffbfe882000040d9004001000000a084000080071240e4fcffbfe8fcffbfd4fcffbff0d20340b88400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 > Sending packet: $m84bc,4#fe...Ack > Packet received: 090053e3 > Sending packet: $M84bc,4:01009fef#43...Ack > Packet received: OK > Sending packet: $c#63...Ack > Packet received: T050b:e4fcffbf;0d:d4fcffbf;0f:bc840000; Same, to 0x84bc. > Sending packet: $M84bc,4:090053e3#e1...Ack > Packet received: OK > Sending packet: $m84bc,4#fe...Ack > Packet received: 090053e3 > Sending packet: $g#67...Ack > Packet received: 0100000014fdffbf1cfdffbf0000000024e7014014fdffbfe882000040d9004001000000a084000080071240e4fcffbfe8fcffbfd4fcffbff0d20340bc8400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 > Sending packet: $m84c0,4#cc...Ack > Packet received: 000000da > Sending packet: $M84c0,4:01009fef#11...Ack > Packet received: OK > Sending packet: $c#63...Ack > Packet received: T050b:e4fcffbf;0d:d4fcffbf;0f:c0840000; Same, to 0x84c0. > Sending packet: $M84c0,4:000000da#cb...Ack > Packet received: OK > Sending packet: $m84c0,4#cc...Ack > Packet received: 000000da > Sending packet: $g#67...Ack > Packet received: 0100000014fdffbf1cfdffbf0000000024e7014014fdffbfe882000040d9004001000000a084000080071240e4fcffbfe8fcffbfd4fcffbff0d20340c08400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 > Sending packet: $m84c4,4#d0...Ack > Packet received: 060000ea > Sending packet: $M84c4,4:01009fef#15...Ack > Packet received: OK > Sending packet: $c#63...Ack > Packet received: T050b:e4fcffbf;0d:d4fcffbf;0f:c4840000; Same, to 0x84c4. Now this is the strange one. What happened? It seems to have mispredicted the next instruction when placing the breakpoint; the branch was presumably taken. You might want to debug arm_get_next_pc when the argument is 0x84c0, and see how it's making this decision. > Sending packet: $M84c4,4:060000ea#d6...Ack > Packet received: OK > Sending packet: $m84c4,4#d0...Ack > Packet received: 060000ea > Sending packet: $g#67...Ack > Packet received: 0f0000000f0000000f0000000a00000024e7014014fdffbfe882000040d9004001000000a084000080071240e4fcffbff0081240d4fcffbfd4840000c48400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 > Sending packet: $m84e4,4#d2...Ack > Packet received: 0030a0e3 > Sending packet: $M84e4,4:01009fef#17...Ack > Packet received: OK > Sending packet: $c#63...Ack > Packet received: T050b:e4fcffbf;0d:d4fcffbf;0f:e4840000; Same, to 0x84e4. > Sending packet: $M84e4,4:0030a0e3#d8...Ack > Packet received: OK > Sending packet: $m84e4,4#d2...Ack > Packet received: 0030a0e3 > Sending packet: $g#67...Ack > Packet received: 0f0000000f0000000f0000000a00000024e7014014fdffbfe882000040d9004001000000a084000080071240e4fcffbff0081240d4fcffbfd4840000e48400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 > Sending packet: $m84e4,4#d2...Ack > Packet received: 0030a0e3 > Sending packet: $m84e4,4#d2...Ack > Packet received: 0030a0e3 > Sending packet: $m84a0,4#ca...Ack > Packet received: 0dc0a0e1 > Sending packet: $m84a4,4#ce...Ack > Packet received: 00d82de9 > Sending packet: $m84a8,4#d2...Ack > Packet received: 04b04ce2 > Sending packet: $m84ac,4#fd...Ack > Packet received: 04d04de2 > Sending packet: $m84b0,4#cb...Ack > Packet received: 01009fef > Sending packet: $m84b4,4#cf...Ack > Packet received: 10300be5 > Sending packet: $m84b8,4#d3...Ack > Packet received: 10301be5 > Sending packet: $m84bc,4#fe...Ack > Packet received: 090053e3 > Sending packet: $m84c0,4#cc...Ack > Packet received: 000000da > Sending packet: $M4000ca4c,4:98040000#9b...Ack > Packet received: OK > Sending packet: $M84b0,4:0030a0e3#d1...Ack > Packet received: OK > 10 return 0; > (gdb) quit -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <3DCFEFA0.539D1767@zee2.com>]
* Re: software single step [not found] ` <3DCFEFA0.539D1767@zee2.com> @ 2002-11-15 7:09 ` Stuart Hughes 2002-11-15 9:52 ` Robert Schwebel 0 siblings, 1 reply; 7+ messages in thread From: Stuart Hughes @ 2002-11-15 7:09 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: gdb [-- Attachment #1: Type: text/plain, Size: 1515 bytes --] Stuart Hughes wrote: > > Daniel Jacobowitz wrote: > > > > > > Sending packet: $m84c4,4#d0...Ack > > > Packet received: 060000ea > > > Sending packet: $M84c4,4:01009fef#15...Ack > > > Packet received: OK > > > Sending packet: $c#63...Ack > > > Packet received: T050b:e4fcffbf;0d:d4fcffbf;0f:c4840000; > > > > Same, to 0x84c4. Now this is the strange one. What happened? It > > seems to have mispredicted the next instruction when placing the > > breakpoint; the branch was presumably taken. > > > > Thanks for the pointer, I'll look into it and see if I can make any > sense of it. > Hi Daniel, Thanks for helping me track it down, I've modified the patch as you suggested and it still works on my strong-arm target. Some of the traffic for this problem went off the list, so to recap here's the reasoning for what I've done: When using gdb/gdbserver, when stepping at branches, gdb asks for a register dump by sending the 'g' remote command, gdbsever in the case of arm, sends back the first 15 registers (gdbserver/linux-arm-low.c defines num_regs to 16, and so gdbserver/linux-low.c:usr_fetch_inferior_registers actually asks for registers 0->15 via the regmap in linux-arm-low.c). If you look at gdbsever/reg-arm.c, the original regmap is only requesting register r0->pc, which doesn't include the status register. Clearly, without the status register being returned, it's not possible to correctly interpret condition codes (for branches) Thanks again for all those who helped. Regards, Stuart [-- Attachment #2: patch-arm-gdbserver-step --] [-- Type: text/plain, Size: 880 bytes --] diff --exclude CVS -uNr gdb-5.2/gdb/gdbserver/linux-arm-low.c gdb-5.2.modified/gdb/gdbserver/linux-arm-low.c --- gdb-5.2/gdb/gdbserver/linux-arm-low.c Wed Feb 27 07:07:39 2002 +++ gdb-5.2.modified/gdb/gdbserver/linux-arm-low.c Fri Nov 15 10:57:28 2002 @@ -26,11 +26,13 @@ #include <sys/reg.h> #endif -int num_regs = 16; +int num_regs = 26; int regmap[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, + -1, -1, -1, -1, -1, -1, -1, -1, -1, + 64 }; int diff --exclude CVS -uNr gdb-5.2/gdb/gdbserver/linux-low.c gdb-5.2.modified/gdb/gdbserver/linux-low.c --- gdb-5.2/gdb/gdbserver/linux-low.c Thu Mar 7 20:56:18 2002 +++ gdb-5.2.modified/gdb/gdbserver/linux-low.c Fri Nov 15 13:58:39 2002 @@ -171,8 +171,6 @@ error ("Invalid register number %d.", regnum); addr = regmap[regnum]; - if (addr == -1) - addr = 0; return addr; } ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: software single step 2002-11-15 7:09 ` Stuart Hughes @ 2002-11-15 9:52 ` Robert Schwebel 2002-11-16 1:23 ` Stuart Hughes 0 siblings, 1 reply; 7+ messages in thread From: Robert Schwebel @ 2002-11-15 9:52 UTC (permalink / raw) To: gdb Stuart, On Fri, Nov 15, 2002 at 03:08:09PM +0000, Stuart Hughes wrote: > I've modified the patch as you suggested and it still works on my > strong-arm target. I've tested this with your hello world program and it works now (breakpoints and steps). The patch has to be a little bit adjusted when you apply it against recent snapshots. Are there plans to make a new release in the near future? Robert -- Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de Pengutronix - Linux Solutions for Science and Industry Braunschweiger Str. 79, 31134 Hildesheim, Germany Handelsregister: Amtsgericht Hildesheim, HRA 2686 Phone: +49-5121-28619-0 | Fax: +49-5121-28619-4 Visit us at the SPS/IPC/Drives 2002 in Nuernberg! Hall 5, Booth 154 +++ Please contact us for details. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: software single step 2002-11-15 9:52 ` Robert Schwebel @ 2002-11-16 1:23 ` Stuart Hughes 0 siblings, 0 replies; 7+ messages in thread From: Stuart Hughes @ 2002-11-16 1:23 UTC (permalink / raw) To: Robert Schwebel; +Cc: gdb Robert Schwebel wrote: > > Stuart, > > On Fri, Nov 15, 2002 at 03:08:09PM +0000, Stuart Hughes wrote: > > I've modified the patch as you suggested and it still works on my > > strong-arm target. > That's good news. > I've tested this with your hello world program and it works now > (breakpoints and steps). The patch has to be a little bit adjusted when > you apply it against recent snapshots. > > Are there plans to make a new release in the near future? I'm not sure. I think Daniel's the maintainer, so I guess he'll get something along these lines checked in. At least the problem is known about now, and the solution is straightforward. Regards, Stuart ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2002-11-16 9:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-03 5:54 software single step Stuart Hughes
2002-11-03 17:22 ` Daniel Jacobowitz
2002-11-11 9:13 ` Stuart Hughes
2002-11-11 9:50 ` Daniel Jacobowitz
[not found] ` <3DCFEFA0.539D1767@zee2.com>
2002-11-15 7:09 ` Stuart Hughes
2002-11-15 9:52 ` Robert Schwebel
2002-11-16 1:23 ` Stuart Hughes
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox