[prev in list] [next in list] [prev in thread] [next in thread]
List: gdb
Subject: arm-elf-gdb -- finish command issue
From: "Michael Anburaj" <embeddedeng () hotmail ! com>
Date: 2005-02-19 8:32:24
Message-ID: BAY12-F15A2569C4DF17F05E48CC4AD6F0 () phx ! gbl
[Download RAW message or body]
This issue is to do with arm-elf-gdb –w (insight - 5.3) not doing the
expected thing (I may be wrong) when “finish” command is issued while the PC
is inside a routine. It is supposed to finish the current routine & go back
to the caller & break at the statement next to the call made to this
function. But, it’s not happening.
Details:
--------
Setup: “arm-elf-gdb –w” invoked with the elf image build with –g option.
Target: remote serial <LPC board with remote serial gdb stubs>.
Observation: Loads fine, can see all the registers, breakpoints & single
step works great.
Now to the problem:
Assembly dump of code portion I was debugging:
4000128a: 4843 ldr r0, [pc, #268] (40001398 <.text+0x398>)
4000128c: f950f000 bl 40001530 <CONSOL_SendString>
40001290: 2400 mov r4, #0
40001292: 2101 mov r1, #1
40001294: 2200 mov r2, #0
40001530 <CONSOL_SendString>:
40001530: b510 push {r4, lr}
40001532: 1c04 mov r4, r0 (add r4, r0, #0)
40001534: e003 b 4000153e <CONSOL_SendString+0xe>
40001536: 0e00 lsr r0, r0, #24
40001538: 3401 add r4, #1
4000153a: ffe9f7ff bl 40001510 <CONSOL_SendCh>
4000153e: 7820 ldrb r0, [r4, #0]
40001540: 0600 lsl r0, r0, #24
40001542: 2800 cmp r0, #0
40001544: d1f7 bne 40001536 <CONSOL_SendString+0x6>
40001546: bc10 pop {r4}
40001548: bc01 pop {r0}
4000154a: 4700 bx r0
I stepped into CONSOL_SendString called from 0x4000128c. Then, while PC is
still inside this function I issued the “finish” command. Instead of
stopping at 0x40001290, it just continued without stopping.
GDB protocol dump (close to the problem area):
c printf "Program stopped at 0x%lx",0x40001536
c finish
w $m4000fcf0,4#f0
r +$91120040#91
w +$m40001274,2#5d
r +$10b5#f8
w +$m40001276,2#5f
r +$81b0#fb
w +$m40001274,2#5d
r +$10b5#f8
w +$M40001274,2:bebe#05
r +$OK#9a
w +$m40001290,2#5b
r +$0024#c6
w +$M40001290,2:bebe#03
r +$OK#9a
w +$c#63
r +$S05#b8
w +$g#67
r
+$911200400a00000014c000e00b0000000000000000000000000000000000000000000000000000000000 \
00000000000075120040f4fc00402115004090120040000000000000000000000000000000000000000000 \
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000 \
00000000000000000000000000000000000000000000000000000000000000003300002033000060#cc w \
+$M40001274,2:10b5#6f r +$OK#9a
w +$M40001290,2:0024#3b
r +$OK#9a
w +$Hc0#db
r +$#00
w +$s#73
r +$S05#b8
w +$g#67
r
+$911200400a00000014c000e00b0000000000000000000000000000000000000000000000000000000000 \
00000000000075120040f4fc00402115004092120040000000000000000000000000000000000000000000 \
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000 \
00000000000000000000000000000000000000000000000000000000000000003300006033000060#d2 w \
+$m40001274,2#5d r +$10b5#f8
w +$M40001274,2:bebe#05
r +$OK#9a
w +$m40001290,2#5b
r +$0024#c6
w +$M40001290,2:bebe#03
r +$OK#9a
w +$Hc0#db
r +$#00
w +$c#63
The follow things happen after the “finish” command was issued:
User: issues a “finish” command
GDB: sets a breakpoint at the right location, 0x40001290. The right place at
the caller just after the function call.
GDB: issues a “continue” command
Target: breaks at 0x40001290
GDB: clears the breakpoint & issues a single step command
Target: stops at the next location, 0x40001292
GDB: sets the breakpoint back at 0x40001290 & issues a continue command
Steps 2 & 3 are the expected ones & after the target breaks at the
0x40001290 (the right spot at the caller for the finish command), GDB should
return to the user for further commands. Why is it doing steps 5 & 7 on its
own?
I tried the same with mips-isa32elf-gdb. It does steps 2 & 3 only & returns
the control to the user after 4.
Let me know the reason for this.
Thanks,
-Mike.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic