[v12,09/32] Change sysroot to ":target:"
Commit Message
Hi,
that is try "" first and "target:" second.
Various performance problems should be fixed by trying to look up the remote
file first on local filesystem. Thanks to build-ids it is quick and safe to
verify both files are the same build.
Jan
gdb/ChangeLog
2015-08-18 Jan Kratochvil <jan.kratochvil@redhat.com>
* NEWS (Changes since GDB 7.10): Mention sysroot.
* main.c (captured_main): Initialize new gdb_sysroot.
gdb/testsuite/ChangeLog
* gdb.base/attach.exp (do_attach_tests): Update sysroot parsing.
* gdb.base/break-probes.exp: Likewise.
---
gdb/testsuite/gdb.base/attach.exp | 7 +++++--
gdb/testsuite/gdb.base/break-probes.exp | 7 +++++--
2 files changed, 10 insertions(+), 4 deletions(-)
@@ -38,6 +38,9 @@ show debug bfd-cache
* The "set sysroot" (and "show sysroot") commands now permit multiple
directory paths.
+* Default sysroot has changed to ":target:", that is first host files
+ and then target files are tried.
+
* New options
set validate-build-id (on|off)
@@ -548,7 +548,11 @@ captured_main (void *data)
if (gdb_sysroot == NULL || *gdb_sysroot == '\0')
{
xfree (gdb_sysroot);
- gdb_sysroot = xstrdup (TARGET_SYSROOT_PREFIX);
+
+ /* Try first the local filesystem,
+ TARGET_SYSROOT_PREFIX is a fallback. */
+ gdb_sysroot = xstrprintf ("%c%s", DIRNAME_SEPARATOR,
+ TARGET_SYSROOT_PREFIX);
}
debug_file_directory = relocate_gdb_directory (DEBUGDIR,
@@ -67,7 +67,7 @@ proc do_attach_tests {} {
global timeout
# Figure out a regular expression that will match the sysroot,
- # noting that the default sysroot is "target:", and also noting
+ # noting that the default sysroot is ":target:", and also noting
# that GDB will strip "target:" from the start of filenames when
# operating on the local filesystem
set sysroot ""
@@ -77,7 +77,10 @@ proc do_attach_tests {} {
set sysroot $expect_out(1,string)
}
}
- regsub "^target:" "$sysroot" "(target:)?" sysroot
+ # Use only the first element of $sysroot which will hopefully
+ # successfully match the filename.
+ regsub "^target:(\[^:\]*):.*$" "$sysroot" "" sysroot
+ regsub "^(?!target:)(\[^:\]*):.*$" "$sysroot" "" sysroot
# Start the program running and then wait for a bit, to be sure
# that it can be attached to.
@@ -67,8 +67,11 @@ if { $using_probes } {
}
# GDB strips "target:" from the start of filenames
- # when operating on the local filesystem
- regsub "^target:" "$sysroot" "(target:)?" sysroot
+ # when operating on the local filesystem.
+ # Also use only the first element of $sysroot which will hopefully
+ # successfully match the filename.
+ regsub "^target:(\[^:\]*):.*$" "$sysroot" "" sysroot
+ regsub "^(?!target:)(\[^:\]*):.*$" "$sysroot" "" sysroot
# Run til it loads our library
set test "run til our library loads"