gdb stepping

Leon Pollak leonp at plris.com
Sun Mar 2 17:38:29 UTC 2008


Hello, all.

As the question may be a bit off-topic, I ask your pardon ahead.
But it seems tome that this may be interesting to many embedded programmers.

Anyway, I am using the BDI2000  device for COP interface to the target and it 
has additional option to see what is happening via the telnet interface.
Using this interface I noticed the following:

The simplest operator IdleTaskCycles++ is translated by compiler into 5 
assembler comands (with -O0):

0x0002b4cc  _Thread_Idle_body+24    lis     r9,15
0x0002b4d0  _Thread_Idle_body+28    lwz     r9,-15912(r9)
0x0002b4d4  _Thread_Idle_body+32    addi    r0,r9,1
0x0002b4d8  _Thread_Idle_body+36    lis     r9,15
0x0002b4dc  _Thread_Idle_body+40    stw     r0,-15912(r9)

OK. Now, when, standing on this line (IdleTaskCycles++) I ask the gdp to 
do "next" command, it does it as required, but the BDI shows me that it has 
done 5 step commands!
The same is with "step" command, which seems obvious.
OK, now I put a break point on the next line - one start and one stop, and the 
result much faster.

Assuming that most of us work with some kind of remote connection, you 
understand that this takes 5 times slower to do a step!

What is the catch here? Why do the gdb uses such a strange technique?

Thanks.
-- 
Leon 



More information about the users mailing list