[PATCH 0/7] Range stepping

Yao Qi
2013-03-11T12:52:53Z

Hi,
When user types "next" command on the following line of source,

a = b + c + d * e - a;

GDB will single step every instruction belongs to this source line
and stop when program goes to the next line, the following is the
assembly of this source line

0x08048434 <+65>: mov 0x1c(%esp),%eax
0x08048438 <+69>: mov 0x30(%esp),%edx
0x0804843c <+73>: add %eax,%edx
0x0804843e <+75>: mov 0x18(%esp),%eax
0x08048442 <+79>: imul 0x2c(%esp),%eax
0x08048447 <+84>: add %edx,%eax
0x08048449 <+86>: sub 0x34(%esp),%eax
0x0804844d <+90>: mov %eax,0x34(%esp)
0x08048451 <+94>: mov 0x1c(%esp),%eax

the following will happen between GDB and GDBserver in remote
debugging,

--> vCont;s:p2e13.2e13;c
<-- T0505:68efffbf;04:30efffbf;08:3c840408;thread:p2e13.2e13;core:1;
--> vCont;s:p2e13.2e13;c
<-- T0505:68efffbf;04:30efffbf;08:3e840408;thread:p2e13.2e13;core:2;
--> vCont;s:p2e13.2e13;c
<-- T0505:68efffbf;04:30efffbf;08:42840408;thread:p2e13.2e13;core:2;
--> vCont;s:p2e13.2e13;c
<-- T0505:68efffbf;04:30efffbf;08:47840408;thread:p2e13.2e13;core:0;
--> vCont;s:p2e13.2e13;c
<-- T0505:68efffbf;04:30efffbf;08:49840408;thread:p2e13.2e13;core:0;
--> vCont;s:p2e13.2e13;c
<-- T0505:68efffbf;04:30efffbf;08:4d840408;thread:p2e13.2e13;core:0;
--> vCont;s:p2e13.2e13;c
<-- T0505:68efffbf;04:30efffbf;08:51840408;thread:p2e13.2e13;core:0;

There are some round-trip between GDB and GDBserver. Isn't it boring
and inefficient? so GDB has to say something
different to GDBserver, that is, "keep stepping and report a stop
to me until program goes out of the range of [0x08048434, 0x08048451)"
then, the RSP traffic looks like this,

--> vCont;r8048434,8048451:p2db0.2db0;c
<-- T0505:68efffbf;04:30efffbf;08:51840408;thread:p2db0.2db0;core:1;

As we can see, GDB tells GDBserver a range of stepping, and GDBserver
only sends stop reply back when programs goes out of the range.
The number of packets is reduced dramatically, and as a result,
the performance of stepping a source line is improved. We call it
"range stepping".

In this patch series, we add range stepping support in GDBserver on
x86/linux and in GDB. GDB is able to send "vCont;r" packet for other
remote stubs if "vCont;r" is supported. We tested GDB with GDBserver
on x86_64-linux, and also test mips-sde-elf GDB with a stub understands
range stepping. No regressions.

Is it OK after the release branch is created?

--
1.7.7.6