[binutils-gdb] Improve remote attach round-trips without btrace

Pedro Alves palves@sourceware.org
Tue Aug 20 14:24:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=aedbe3bb9f03be12ad714adca1fefc391317bd94

commit aedbe3bb9f03be12ad714adca1fefc391317bd94
Author: Conrad Meyer <cem@FreeBSD.org>
Date:   Mon Aug 19 00:02:19 2019 -0700

    Improve remote attach round-trips without btrace
    
    For remotes which do not support btrace at all, we can save several
    round trips for each thread.  This is especially significant when your
    remote is a kernel with 100s or 1000s of threads and latency is
    intercontinental.
    
    Previously, with target, remote, and infrun debugging enabled, one
    might see:
    
        Sending packet: $Hg18aee#43...Ack
        Packet received: OK
        Sending packet: $Hg186f7#eb...Ack
        Packet received: OK
        remote:target_xfer_partial (24, , 0x805454000, 0x0, 0x0, 4096) = -1, 0
    
    repeated for all non-exited threads.
    
    Afterwards, if the remote does not specify 'qXfer:btrace-conf:read+'
    in qSupported stub features, these unnecessary thread switches are
    avoided.
    
    gdb/ChangeLog:
    
    	* remote.c (remote_target::remote_btrace_maybe_reopen): Avoid
    	unnecessary thread walk if remote doesn't support the packet.

Diff:
---
 gdb/ChangeLog | 5 +++++
 gdb/remote.c  | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2dce609..d9e676a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-08-20  Conrad Meyer  <cem@FreeBSD.org>
+
+	* remote.c (remote_target::remote_btrace_maybe_reopen): Avoid
+	unnecessary thread walk if remote doesn't support the packet.
+
 2019-08-19  Tom Tromey  <tromey@adacore.com>
 
 	* python/py-value.c (value_has_field): Fix indentation.
diff --git a/gdb/remote.c b/gdb/remote.c
index 7ea9cd4..ae06c4b 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -13700,6 +13700,11 @@ remote_target::remote_btrace_maybe_reopen ()
   int warned = 0;
 #endif
 
+  /* Don't bother walking the entirety of the remote thread list when
+     we know the feature isn't supported by the remote.  */
+  if (packet_support (PACKET_qXfer_btrace_conf) != PACKET_ENABLE)
+    return;
+
   scoped_restore_current_thread restore_thread;
 
   for (thread_info *tp : all_non_exited_threads ())



More information about the Gdb-cvs mailing list