public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFC/PATCH] Testsuite: set sysroot when using gdbserver
@ 2019-03-27 16:40 Alan Hayward
  2019-03-27 20:49 ` Kevin Buettner
  2019-04-12 20:08 ` Regression on gdb.base/break-probes.exp - native-{,extended-}gdbserver (was: Re: [RFC/PATCH] Testsuite: set sysroot when using gdbserver) Sergio Durigan Junior
  0 siblings, 2 replies; 8+ messages in thread
From: Alan Hayward @ 2019-03-27 16:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: nd, Alan Hayward

When testing using native-gdbserver and native-extended-gdbserver, the sysroot
is not set.  This results in a warning from GDB and files are sent via the
remote protocol, which can be slow.

On Ubuntu 18.04 (unlike most distros) the debug versions of the standard
libraries are included by default in /usr/lib/debug/

Example log of a test on Ubuntu 18.04 AArch64:

Listening on port 2346
target remote localhost:2346
Remote debugging using localhost:2346
Reading /lib/ld-linux-aarch64.so.1 from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
Reading /lib/ld-linux-aarch64.so.1 from remote target...
Reading symbols from target:/lib/ld-linux-aarch64.so.1...
Reading /lib/ld-2.27.so from remote target...
Reading /lib/.debug/ld-2.27.so from remote target...
Reading /usr/lib/debug//lib/ld-2.27.so from remote target...
Reading /usr/lib/debug/lib//ld-2.27.so from remote target...
Reading target:/usr/lib/debug/lib//ld-2.27.so from remote target...
(No debugging symbols found in target:/lib/ld-linux-aarch64.so.1)
0x0000ffffbf6d31c0 in ?? () from target:/lib/ld-linux-aarch64.so.1
(gdb) continue
Continuing.
Reading /lib/aarch64-linux-gnu/libc.so.6 from remote target...
Reading /lib/aarch64-linux-gnu/libc-2.27.so from remote target...
Reading /lib/aarch64-linux-gnu/.debug/libc-2.27.so from remote target...
Reading /usr/lib/debug//lib/aarch64-linux-gnu/libc-2.27.so from remote target...
Reading /usr/lib/debug//lib/aarch64-linux-gnu/libc-2.27.so from remote target...

These file reads are causing a complete native-gdbserver run on the AArch64
buildbot slave to timeout after 2.5 hours.  This is also causing the builds
to back up on the slave.

The solution is to ensure the sysroot is set to / immediately after connecting.

This drastically reduces the time of a test. For example, gdb.base/sigall.exp
drops from 23 seconds to 4 seconds.
A full native-gdbserver run on the AArch64 slave now takes 8 minutes.

However, I'm not sure if putting the sysroot into gdbserver_start will break
other remote setups.  In addition, I don't think gdb_test is the correct
function to call within the library - for the mi tests this causes a timeout
as it expect to use mi_gdb_test.

gdb/testsuite/ChangeLog:

2019-03-27  Alan Hayward  <alan.hayward@arm.com>

	* lib/gdbserver-support.exp (gdbserver_start): Set sysroot.
---
 gdb/testsuite/lib/gdbserver-support.exp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
index dbd885aa22..065946eb8d 100644
--- a/gdb/testsuite/lib/gdbserver-support.exp
+++ b/gdb/testsuite/lib/gdbserver-support.exp
@@ -336,6 +336,9 @@ proc gdbserver_start { options arguments } {
 	break
     }
 
+    # Set sysroot to ensure files are read locally instead of via the remote protocol
+    gdb_test "set sysroot /" ""
+
     return [list $protocol [$get_remote_address $debughost $portnum]]
 }
 
-- 
2.20.1 (Apple Git-117)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-04-12 20:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-27 16:40 [RFC/PATCH] Testsuite: set sysroot when using gdbserver Alan Hayward
2019-03-27 20:49 ` Kevin Buettner
2019-03-28  5:14   ` Kevin Buettner
2019-03-28 11:02     ` Alan Hayward
2019-03-28 11:32       ` Pedro Alves
2019-03-28 12:50         ` Alan Hayward
2019-03-28 14:03           ` Pedro Alves
2019-04-12 20:08 ` Regression on gdb.base/break-probes.exp - native-{,extended-}gdbserver (was: Re: [RFC/PATCH] Testsuite: set sysroot when using gdbserver) Sergio Durigan Junior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).