public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix gdb.compile/compile.exp shlib regression
@ 2016-04-06 23:06 Pedro Alves
  2016-04-07 13:25 ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2016-04-06 23:06 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

Commit 6e774b13c3b8 (Make ftrace tests work with remote targets) made
a few gdb.compile/compile.exp tests disappear:

 -PASS: gdb.compile/compile.exp: call shared library function
 -PASS: gdb.compile/compile.exp: expect 1
 -PASS: gdb.compile/compile.exp: modify shared library variable
 -PASS: gdb.compile/compile.exp: expect 15

This is because the test uses ldflags instead of using the shlib
option, so it misses linking with -rpath, resulting in:

 (gdb) run
 Starting program: .../compile/compile-shlib
 .../compile/compile-shlib: error while loading shared libraries: compile-shlib.so: cannot open shared object file: No such file or directory
 [Inferior 1 (process 18014) exited with code 0177]

I also noticed we were missing a gdb_load_shlibs call.

gdb/testsuite/ChangeLog:
yyyy-mm-dd  Pedro Alves  <palves@redhat.com>

	* gdb.compile/compile.exp: Use gdb_compile with "shlib=" option
	instead of build_executable.  Use gdb_load_shlibs.
---
 gdb/testsuite/gdb.compile/compile.exp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.compile/compile.exp b/gdb/testsuite/gdb.compile/compile.exp
index 07a7568..a8bfc24 100644
--- a/gdb/testsuite/gdb.compile/compile.exp
+++ b/gdb/testsuite/gdb.compile/compile.exp
@@ -362,13 +362,17 @@ if {[skip_shlib_tests]} {
 }
 
 set libbin [standard_output_file ${testfile}-shlib.so]
+set binfile [standard_output_file ${testfile}-shlib]
+
 if { [gdb_compile_shlib ${srcdir}/${subdir}/${srcfile2} $libbin {debug}] != ""
-     || [build_executable $testfile ${testfile}-shlib $srcfile \
-	     [list debug ldflags=$libbin]] == -1 } {
+     || [gdb_compile ${srcdir}/${subdir}/${srcfile} $binfile executable \
+	     [list debug shlib=$libbin]] == -1 } {
     return -1
 }
 
-clean_restart ${testfile}-shlib
+clean_restart $binfile
+gdb_load_shlibs $libbin
+
 if ![runto_main] {
     return -1
 }
-- 
2.5.5

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

* Re: [PATCH] Fix gdb.compile/compile.exp shlib regression
  2016-04-06 23:06 [PATCH] Fix gdb.compile/compile.exp shlib regression Pedro Alves
@ 2016-04-07 13:25 ` Simon Marchi
  2016-04-07 19:02   ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2016-04-07 13:25 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 16-04-06 07:06 PM, Pedro Alves wrote:
> Commit 6e774b13c3b8 (Make ftrace tests work with remote targets) made
> a few gdb.compile/compile.exp tests disappear:
> 
>  -PASS: gdb.compile/compile.exp: call shared library function
>  -PASS: gdb.compile/compile.exp: expect 1
>  -PASS: gdb.compile/compile.exp: modify shared library variable
>  -PASS: gdb.compile/compile.exp: expect 15
> 
> This is because the test uses ldflags instead of using the shlib
> option, so it misses linking with -rpath, resulting in:
> 
>  (gdb) run
>  Starting program: .../compile/compile-shlib
>  .../compile/compile-shlib: error while loading shared libraries: compile-shlib.so: cannot open shared object file: No such file or directory
>  [Inferior 1 (process 18014) exited with code 0177]
> 
> I also noticed we were missing a gdb_load_shlibs call.
> 
> gdb/testsuite/ChangeLog:
> yyyy-mm-dd  Pedro Alves  <palves@redhat.com>
> 
> 	* gdb.compile/compile.exp: Use gdb_compile with "shlib=" option
> 	instead of build_executable.  Use gdb_load_shlibs.
> ---
>  gdb/testsuite/gdb.compile/compile.exp | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.compile/compile.exp b/gdb/testsuite/gdb.compile/compile.exp
> index 07a7568..a8bfc24 100644
> --- a/gdb/testsuite/gdb.compile/compile.exp
> +++ b/gdb/testsuite/gdb.compile/compile.exp
> @@ -362,13 +362,17 @@ if {[skip_shlib_tests]} {
>  }
>  
>  set libbin [standard_output_file ${testfile}-shlib.so]
> +set binfile [standard_output_file ${testfile}-shlib]
> +
>  if { [gdb_compile_shlib ${srcdir}/${subdir}/${srcfile2} $libbin {debug}] != ""
> -     || [build_executable $testfile ${testfile}-shlib $srcfile \
> -	     [list debug ldflags=$libbin]] == -1 } {
> +     || [gdb_compile ${srcdir}/${subdir}/${srcfile} $binfile executable \
> +	     [list debug shlib=$libbin]] == -1 } {
>      return -1
>  }
>  
> -clean_restart ${testfile}-shlib
> +clean_restart $binfile
> +gdb_load_shlibs $libbin
> +
>  if ![runto_main] {
>      return -1
>  }
> 

That looks good, thanks.  Indeed, gdb_load_shlibs is required to make it work on a
remote gdbserver test config.

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

* Re: [PATCH] Fix gdb.compile/compile.exp shlib regression
  2016-04-07 13:25 ` Simon Marchi
@ 2016-04-07 19:02   ` Pedro Alves
  0 siblings, 0 replies; 3+ messages in thread
From: Pedro Alves @ 2016-04-07 19:02 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 04/07/2016 02:25 PM, Simon Marchi wrote:

> That looks good, thanks.  Indeed, gdb_load_shlibs is required to make it work on a
> remote gdbserver test config.
> 

Pushed, thanks.

-- 
Pedro Alves

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

end of thread, other threads:[~2016-04-07 19:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-06 23:06 [PATCH] Fix gdb.compile/compile.exp shlib regression Pedro Alves
2016-04-07 13:25 ` Simon Marchi
2016-04-07 19:02   ` Pedro Alves

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).