[8/9] Make the default sysroot be "target:"

Message ID 1426870087-32654-9-git-send-email-gbenson@redhat.com
State Superseded
Headers

Commit Message

Gary Benson March 20, 2015, 4:48 p.m. UTC
  This commit makes GDB default to a sysroot of "target:".
One testcase needed updating as a result of this change.

gdb/ChangeLog:

	* main.c (captured_main): Set gdb_sysroot to "target:"
	if not otherwise set.

gdb/testsuite/ChangeLog:

	* gdb.base/break-probes.exp: Cope with "target:" sysroot.
---
 gdb/ChangeLog                           |    5 +++++
 gdb/main.c                              |    6 ++++++
 gdb/testsuite/ChangeLog                 |    4 ++++
 gdb/testsuite/gdb.base/break-probes.exp |    2 +-
 4 files changed, 16 insertions(+), 1 deletions(-)
  

Comments

Pedro Alves April 1, 2015, 12:15 p.m. UTC | #1
On 03/20/2015 04:48 PM, Gary Benson wrote:
> This commit makes GDB default to a sysroot of "target:".
> One testcase needed updating as a result of this change.

That's because when the sysroot is "target:" and the filesystem
is remote, the sysroot is stripped from the "Inferior loaded"
message, right?  A short comment in the test would help.

OK with that change.

Thanks,
Pedro Alves

> 
> gdb/ChangeLog:
> 
> 	* main.c (captured_main): Set gdb_sysroot to "target:"
> 	if not otherwise set.
> 
> gdb/testsuite/ChangeLog:
> 
> 	* gdb.base/break-probes.exp: Cope with "target:" sysroot.
> ---
>  gdb/ChangeLog                           |    5 +++++
>  gdb/main.c                              |    6 ++++++
>  gdb/testsuite/ChangeLog                 |    4 ++++
>  gdb/testsuite/gdb.base/break-probes.exp |    2 +-
>  4 files changed, 16 insertions(+), 1 deletions(-)
> 
> diff --git a/gdb/main.c b/gdb/main.c
> index 72b8714..8f276b4 100644
> --- a/gdb/main.c
> +++ b/gdb/main.c
> @@ -548,6 +548,12 @@ captured_main (void *data)
>    gdb_sysroot = relocate_gdb_directory (TARGET_SYSTEM_ROOT,
>  					TARGET_SYSTEM_ROOT_RELOCATABLE);
>  
> +  if (gdb_sysroot == NULL || *gdb_sysroot == '\0')
> +    {
> +      xfree (gdb_sysroot);
> +      gdb_sysroot = xstrdup (TARGET_SYSROOT_PREFIX);
> +    }
> +
>    debug_file_directory = relocate_gdb_directory (DEBUGDIR,
>  						 DEBUGDIR_RELOCATABLE);
>  
> diff --git a/gdb/testsuite/gdb.base/break-probes.exp b/gdb/testsuite/gdb.base/break-probes.exp
> index 1591c33..d4d756f 100644
> --- a/gdb/testsuite/gdb.base/break-probes.exp
> +++ b/gdb/testsuite/gdb.base/break-probes.exp
> @@ -72,7 +72,7 @@ if { $using_probes } {
>      while { $not_loaded_library } {
>  	set not_loaded_library 0
>  	gdb_test_multiple "c" $test {
> -	    -re "Inferior loaded $sysroot$binfile_lib\\M.*$gdb_prompt $" {
> +	    -re "Inferior loaded ($sysroot)?$binfile_lib\\M.*$gdb_prompt $" {
>  		pass $test
>  	    }
>  	    -re "Stopped due to shared library event\\M.*$gdb_prompt $" {
  

Patch

diff --git a/gdb/main.c b/gdb/main.c
index 72b8714..8f276b4 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -548,6 +548,12 @@  captured_main (void *data)
   gdb_sysroot = relocate_gdb_directory (TARGET_SYSTEM_ROOT,
 					TARGET_SYSTEM_ROOT_RELOCATABLE);
 
+  if (gdb_sysroot == NULL || *gdb_sysroot == '\0')
+    {
+      xfree (gdb_sysroot);
+      gdb_sysroot = xstrdup (TARGET_SYSROOT_PREFIX);
+    }
+
   debug_file_directory = relocate_gdb_directory (DEBUGDIR,
 						 DEBUGDIR_RELOCATABLE);
 
diff --git a/gdb/testsuite/gdb.base/break-probes.exp b/gdb/testsuite/gdb.base/break-probes.exp
index 1591c33..d4d756f 100644
--- a/gdb/testsuite/gdb.base/break-probes.exp
+++ b/gdb/testsuite/gdb.base/break-probes.exp
@@ -72,7 +72,7 @@  if { $using_probes } {
     while { $not_loaded_library } {
 	set not_loaded_library 0
 	gdb_test_multiple "c" $test {
-	    -re "Inferior loaded $sysroot$binfile_lib\\M.*$gdb_prompt $" {
+	    -re "Inferior loaded ($sysroot)?$binfile_lib\\M.*$gdb_prompt $" {
 		pass $test
 	    }
 	    -re "Stopped due to shared library event\\M.*$gdb_prompt $" {