This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Send qXfer:traceframe-info:read when traceframe is selected.
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Thu, 24 Oct 2013 21:57:17 +0800
- Subject: [PATCH] Send qXfer:traceframe-info:read when traceframe is selected.
- Authentication-results: sourceware.org; auth=none
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.
---
gdb/remote.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/gdb/remote.c b/gdb/remote.c
index 83acec3..3694973 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -11210,6 +11210,11 @@ remote_traceframe_info (void)
{
char *text;
+ /* If current traceframe is not selected, don't bother the remote
+ stub. */
+ if (get_traceframe_number () < 0)
+ return NULL;
+
text = target_read_stralloc (¤t_target,
TARGET_OBJECT_TRACEFRAME_INFO, NULL);
if (text != NULL)
--
1.7.7.6