* [PATCH][gdb/testsuite] Avoid gnatbind/gnatlink in gdb.ada/catch_ex_std.exp
@ 2020-12-07 12:19 Tom de Vries
2020-12-07 19:42 ` Tom de Vries
0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2020-12-07 12:19 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
Hi,
There's a single test-case in the testsuite that explicitly calls gnatbind and
gnatlink: gdb.ada/catch_ex_std.exp.
Instead, use gnatmake and pass specific gnatbind and gnatlink options using
gnatmake passthrough options -bargs and -largs.
Tested on x86_64-linux.
Any comments?
Thanks,
- Tom
[gdb/testsuite] Avoid gnatbind/gnatlink in gdb.ada/catch_ex_std.exp
gdb/testsuite/ChangeLog:
2020-12-07 Tom de Vries <tdevries@suse.de>
* gdb.ada/catch_ex_std.exp: Use gnatmake -bargs and -largs instead of
calling gnatbind and gnatlink.
---
gdb/testsuite/gdb.ada/catch_ex_std.exp | 70 +++++++++++-----------------------
1 file changed, 22 insertions(+), 48 deletions(-)
diff --git a/gdb/testsuite/gdb.ada/catch_ex_std.exp b/gdb/testsuite/gdb.ada/catch_ex_std.exp
index c3339c3492..31f062425b 100644
--- a/gdb/testsuite/gdb.ada/catch_ex_std.exp
+++ b/gdb/testsuite/gdb.ada/catch_ex_std.exp
@@ -23,8 +23,6 @@ if { [skip_ada_tests] } { return -1 }
standard_ada_testfile foo
-set ofile ${binfile}.o
-
set srcfile2 [file join [file dirname $srcfile] some_package.adb]
set ofile2 [standard_output_file some_package.o]
set sofile [standard_output_file libsome_package.so]
@@ -51,56 +49,32 @@ if {[gdb_compile_shlib $ofile2 $sofile \
return -1
}
-# Now we can compile the main program to an object file; but again, we
-# can't compile directly using gnatmake.
-if {[target_compile_ada_from_dir $outdir $srcfile $ofile object debug] != ""} {
- return -1
+# Set linkarg such that the executable can find the shared library.
+if {[istarget "*-*-mingw*"]
+ || [istarget *-*-cygwin*]
+ || [istarget *-*-pe*]
+ || [istarget arm*-*-symbianelf*]} {
+ # Do not need anything.
+ set linkarg ""
+} elseif {[istarget *-*-freebsd*] || [istarget *-*-openbsd*]} {
+ set linkarg "-Wl,-rpath,$outdir"
+} else {
+ set linkarg "-Wl,-rpath,\\\$ORIGIN"
}
-set gnatbind [find_ada_tool gnatbind]
-set gnatlink [find_ada_tool gnatlink]
+# Make sure we link against the shared GNAT run time.
+set gnatbind_options "-shared"
-with_cwd $outdir {
- # Test if gnatbind is supported
- set status [remote_exec host "$gnatbind --version"]
- if {[lindex $status 0] == -1} {
- unsupported "gnatbind foo"
- return -1
- }
- # Bind.
- set status [remote_exec host "$gnatbind -shared foo"]
- if {[lindex $status 0] == 0} {
- pass "gnatbind foo"
- } else {
- fail "gnatbind foo"
- return -1
- }
+# Link against the shared library.
+set gnatlink_options "$linkarg -Wl,-lsome_package"
- # Test if gnatlink is supported
- set status [remote_exec host "$gnatlink --version"]
- if {[lindex $status 0] == -1} {
- unsupported "gnatlink foo"
- return -1
- }
- # Finally, link.
- if {[istarget "*-*-mingw*"]
- || [istarget *-*-cygwin*]
- || [istarget *-*-pe*]
- || [istarget arm*-*-symbianelf*]} {
- # Do not need anything.
- set linkarg ""
- } elseif {[istarget *-*-freebsd*] || [istarget *-*-openbsd*]} {
- set linkarg "-Wl,-rpath,$outdir"
- } else {
- set linkarg "-Wl,-rpath,\\\$ORIGIN"
- }
- set status [remote_exec host "$gnatlink foo $linkarg -Wl,-lsome_package"]
- if {[lindex $status 0] == 0} {
- pass "gnatlink foo"
- } else {
- fail "gnatlink foo"
- return -1
- }
+# Create executable.
+set options [list \
+ -bargs $gnatbind_options -margs \
+ -largs $gnatlink_options -margs \
+ debug]
+if {[gdb_compile_ada $srcfile $binfile executable $options] != ""} {
+ return -1
}
clean_restart ${testfile}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][gdb/testsuite] Avoid gnatbind/gnatlink in gdb.ada/catch_ex_std.exp
2020-12-07 12:19 [PATCH][gdb/testsuite] Avoid gnatbind/gnatlink in gdb.ada/catch_ex_std.exp Tom de Vries
@ 2020-12-07 19:42 ` Tom de Vries
2020-12-13 13:17 ` Joel Brobecker
0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2020-12-07 19:42 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
[-- Attachment #1: Type: text/plain, Size: 963 bytes --]
On 12/7/20 1:19 PM, Tom de Vries wrote:
> Hi,
>
> There's a single test-case in the testsuite that explicitly calls gnatbind and
> gnatlink: gdb.ada/catch_ex_std.exp.
>
> Instead, use gnatmake and pass specific gnatbind and gnatlink options using
> gnatmake passthrough options -bargs and -largs.
>
> Tested on x86_64-linux.
>
> Any comments?
>
Oops, forgot the additional_flags= prefix.
Fixed in this version, such that we indeed have a dependency on
libgnat-7.so due to -bargs -shared -margs:
...
$ ldd foo
linux-vdso.so.1 (0x00007ffec0179000)
libsome_package.so => ./libsome_package.so (0x00007fe548526000)
libgnat-7.so => /usr/lib64/libgnat-7.so (0x00007fe547f9b000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fe547d82000)
libc.so.6 => /lib64/libc.so.6 (0x00007fe5479c7000)
libm.so.6 => /lib64/libm.so.6 (0x00007fe54768f000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe548728000)
...
Thanks,
- Tom
[-- Attachment #2: 0005-gdb-testsuite-Avoid-gnatbind-gnatlink-in-gdb.ada-catch_ex_std.exp.patch --]
[-- Type: text/x-patch, Size: 3538 bytes --]
[gdb/testsuite] Avoid gnatbind/gnatlink in gdb.ada/catch_ex_std.exp
There's a single test-case in the testsuite that explicitly calls gnatbind and
gnatlink: gdb.ada/catch_ex_std.exp.
Instead, use gnatmake and pass specific gnatbind and gnatlink options using
gnatmake passthrough options -bargs and -largs.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2020-12-07 Tom de Vries <tdevries@suse.de>
* gdb.ada/catch_ex_std.exp: Use gnatmake -bargs and -largs instead of
calling gnatbind and gnatlink.
---
gdb/testsuite/gdb.ada/catch_ex_std.exp | 71 +++++++++++-----------------------
1 file changed, 23 insertions(+), 48 deletions(-)
diff --git a/gdb/testsuite/gdb.ada/catch_ex_std.exp b/gdb/testsuite/gdb.ada/catch_ex_std.exp
index c3339c3492..d91f88312b 100644
--- a/gdb/testsuite/gdb.ada/catch_ex_std.exp
+++ b/gdb/testsuite/gdb.ada/catch_ex_std.exp
@@ -23,8 +23,6 @@ if { [skip_ada_tests] } { return -1 }
standard_ada_testfile foo
-set ofile ${binfile}.o
-
set srcfile2 [file join [file dirname $srcfile] some_package.adb]
set ofile2 [standard_output_file some_package.o]
set sofile [standard_output_file libsome_package.so]
@@ -51,56 +49,33 @@ if {[gdb_compile_shlib $ofile2 $sofile \
return -1
}
-# Now we can compile the main program to an object file; but again, we
-# can't compile directly using gnatmake.
-if {[target_compile_ada_from_dir $outdir $srcfile $ofile object debug] != ""} {
- return -1
+# Set linkarg such that the executable can find the shared library.
+if {[istarget "*-*-mingw*"]
+ || [istarget *-*-cygwin*]
+ || [istarget *-*-pe*]
+ || [istarget arm*-*-symbianelf*]} {
+ # Do not need anything.
+ set linkarg ""
+} elseif {[istarget *-*-freebsd*] || [istarget *-*-openbsd*]} {
+ set linkarg "-Wl,-rpath,$outdir"
+} else {
+ set linkarg "-Wl,-rpath,\\\$ORIGIN"
}
-set gnatbind [find_ada_tool gnatbind]
-set gnatlink [find_ada_tool gnatlink]
+# Make sure we link against the shared GNAT run time.
+set gnatbind_options [list -bargs -shared -margs]
-with_cwd $outdir {
- # Test if gnatbind is supported
- set status [remote_exec host "$gnatbind --version"]
- if {[lindex $status 0] == -1} {
- unsupported "gnatbind foo"
- return -1
- }
- # Bind.
- set status [remote_exec host "$gnatbind -shared foo"]
- if {[lindex $status 0] == 0} {
- pass "gnatbind foo"
- } else {
- fail "gnatbind foo"
- return -1
- }
+# Link against the shared library.
+set gnatlink_options [list -largs $linkarg -Wl,-lsome_package -margs]
- # Test if gnatlink is supported
- set status [remote_exec host "$gnatlink --version"]
- if {[lindex $status 0] == -1} {
- unsupported "gnatlink foo"
- return -1
- }
- # Finally, link.
- if {[istarget "*-*-mingw*"]
- || [istarget *-*-cygwin*]
- || [istarget *-*-pe*]
- || [istarget arm*-*-symbianelf*]} {
- # Do not need anything.
- set linkarg ""
- } elseif {[istarget *-*-freebsd*] || [istarget *-*-openbsd*]} {
- set linkarg "-Wl,-rpath,$outdir"
- } else {
- set linkarg "-Wl,-rpath,\\\$ORIGIN"
- }
- set status [remote_exec host "$gnatlink foo $linkarg -Wl,-lsome_package"]
- if {[lindex $status 0] == 0} {
- pass "gnatlink foo"
- } else {
- fail "gnatlink foo"
- return -1
- }
+set options [list debug]
+foreach option [concat $gnatbind_options $gnatlink_options] {
+ lappend options [concat "additional_flags=" $option]
+}
+
+# Create executable.
+if {[gdb_compile_ada $srcfile $binfile executable $options] != ""} {
+ return -1
}
clean_restart ${testfile}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][gdb/testsuite] Avoid gnatbind/gnatlink in gdb.ada/catch_ex_std.exp
2020-12-07 19:42 ` Tom de Vries
@ 2020-12-13 13:17 ` Joel Brobecker
0 siblings, 0 replies; 3+ messages in thread
From: Joel Brobecker @ 2020-12-13 13:17 UTC (permalink / raw)
To: Tom de Vries; +Cc: gdb-patches, Tom Tromey
Hi Tom,
> gdb/testsuite/ChangeLog:
>
> 2020-12-07 Tom de Vries <tdevries@suse.de>
>
> * gdb.ada/catch_ex_std.exp: Use gnatmake -bargs and -largs instead of
> calling gnatbind and gnatlink.
Thanks for the patch. Looks good to me!
--
Joel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-12-13 13:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-07 12:19 [PATCH][gdb/testsuite] Avoid gnatbind/gnatlink in gdb.ada/catch_ex_std.exp Tom de Vries
2020-12-07 19:42 ` Tom de Vries
2020-12-13 13:17 ` Joel Brobecker
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).