Send qXfer:traceframe-info:read when traceframe is selected.
When I do 'si', I find many 'qXfer:traceframe-info:read' packets are sent,
which is not necessary. It slows down the single step.
(gdb) si
Sending packet: $qTStatus#49...Packet received: T0;tnotrun:0;tframes:0;tcreated:0;tfree:500000;tsize:500000;circular:0;disconn:0;starttime:0;stoptime:0;username:;notes::
Sending packet: $Z0,
80483c7,1#b4...Packet received: OK
Sending packet: $Z0,
4ce5b6b0,1#6e...Packet received: OK
Sending packet: $QPassSignals:e;10;14;17;1a;1b;1c;21;24;25;2c;4c;#5f...Packet received: OK
Sending packet: $vCont;s:p1b15.1b15;c#20...Packet received: T0505:
44efffbf;04:
44efffbf;08:
d1830408;thread:p1b15.1b15;core:3;
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $mbfffef40,40#c0...Packet received: d183040878efffbf2e840408030000000000a040030000000500000070efffbf07000000010000004984040807000000030000000500000000000000b396e84c
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $z0,
80483c7,1#d4...Packet received: OK
Sending packet: $z0,
4ce5b6b0,1#8e...Packet received: OK
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
Sending packet: $qXfer:traceframe-info:read::0,fff#0b...Packet received: E01
This problem was introduced by this patch
(https://sourceware.org/ml/gdb-patches/2013-04/msg00000.html), in
which get_traceframe_number is not checked before calling
traceframe_available_memory. This patch moves the check to
remote_traceframe_info, say, if GDB doesn't have traceframe selected, GDB
doesn't need to send qXfer:traceframe-info:read packets.
With this patch applied, there is no qXfer:traceframe-info:read sent
out and single step is speed up a little bit.
Here is the experiment I did:
Num of single step Original Patched
single-step cpu_time 10000 8.08 7.57
single-step cpu_time 20000 16.23 14.23
single-step cpu_time 30000 24.19 21.59
single-step cpu_time 40000 32.49 28.0
single-step wall_time 10000 14.
1974210739 13.
2641420364
single-step wall_time 20000 28.
5278921127 25.
0541369915
single-step wall_time 30000 42.
5864038467 38.
0038759708
single-step wall_time 40000 57.
2107698917 49.
2350611687
single-step vmsize 10000 16128 16388
single-step vmsize 20000 16128 16388
single-step vmsize 30000 16260 16520
single-step vmsize 40000 16444 16704
The patch is tested on x86_64-linux.
gdb:
2013-10-24 Yao Qi <yao@codesourcery.com>
* remote.c (remote_traceframe_info): Return early if
traceframe is not selected.