aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2007-05-16 14:21:47 +0000
committerDaniel Jacobowitz <drow@false.org>2007-05-16 14:21:47 +0000
commit93f02886fd15eef1d38f073c54031c812e564128 (patch)
tree1de4fdb193679af5546c9be4f2f12f86149970c1 /gdb/testsuite/lib
parent1a69e1e46aabbd453ddb0a6b4f605db4e2686018 (diff)
downloadgdb-93f02886fd15eef1d38f073c54031c812e564128.zip
gdb-93f02886fd15eef1d38f073c54031c812e564128.tar.gz
gdb-93f02886fd15eef1d38f073c54031c812e564128.tar.bz2
* lib/gdb.exp (gdb_compile): Add support for Windows DLLs.
(gdb_compile_shlib): Likewise. (skip_shlib_tests, gdb_download, gdb_load_shlibs): New. (default_gdb_init): Clear cleanfiles. (gdb_finish): Delete recorded cleanfiles. * lib/gdbserver-support.exp (gdbserver_spawn): Use gdb_download. * gdb.base/gdb1555.exp: Use skip_shlib_tests and gdb_load_shlibs. Do not use isnative. * gdb.base/pending.exp, gdb.base/shlib-call.exp, gdb.base/shreloc.exp, gdb.base/so-impl-ld.exp: Likewise. * gdb.base/solib-weak.exp: Likewise. Skip for DLL targets. * gdb.base/unload.exp: Likewise. Do not pass empty option to gdb_compile.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r--gdb/testsuite/lib/gdb.exp88
-rw-r--r--gdb/testsuite/lib/gdbserver-support.exp2
2 files changed, 85 insertions, 5 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 5493a5c..d17185d 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1212,6 +1212,29 @@ proc skip_fortran_tests {} {
return 0
}
+# Return a 1 if we should skip shared library tests.
+
+proc skip_shlib_tests {} {
+ # Run the shared library tests on native systems.
+ if {[isnative]} {
+ return 0
+ }
+
+ # An abbreviated list of remote targets where we should be able to
+ # run shared library tests.
+ if {([istarget *-*-linux*]
+ || [istarget *-*-*bsd*]
+ || [istarget *-*-solaris2*]
+ || [istarget arm*-*-symbianelf*]
+ || [istarget *-*-mingw*]
+ || [istarget *-*-cygwin*]
+ || [istarget *-*-pe*])} {
+ return 0
+ }
+
+ return 1
+}
+
# Run a test on the target to see if it supports vmx hardware. Return 0 if so,
# 1 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite.
@@ -1500,9 +1523,13 @@ proc gdb_compile {source dest type options} {
foreach opt $options {
if [regexp {^shlib=(.*)} $opt dummy_var shlib_name] {
if [test_compiler_info "xlc-*"] {
- # IBM xlc compiler doesn't accept shared library named other
- # than .so: use "-Wl," to bypass this
- lappend source "-Wl,$shlib_name"
+ # IBM xlc compiler doesn't accept shared library named other
+ # than .so: use "-Wl," to bypass this
+ lappend source "-Wl,$shlib_name"
+ } elseif { ([istarget "*-*-mingw*"]
+ || [istarget *-*-cygwin*]
+ || [istarget *-*-pe*])} {
+ lappend source "${shlib_name}.a"
} else {
lappend source $shlib_name
}
@@ -1560,8 +1587,13 @@ proc gdb_compile {source dest type options} {
}
set result [target_compile $source $dest $type $options];
+
+ # Prune uninteresting compiler (and linker) output.
+ regsub "Creating library file: \[^\r\n\]*\[\r\n\]+" $result "" result
+
regsub "\[\r\n\]*$" "$result" "" result;
regsub "^\[\r\n\]*" "$result" "" result;
+
if { $result != "" && [lsearch $options quiet] == -1} {
clone_output "gdb compile failed, $result"
}
@@ -1657,6 +1689,12 @@ proc gdb_compile_shlib {sources dest options} {
lappend link_options "additional_flags=-qmkshrobj"
} else {
lappend link_options "additional_flags=-shared"
+
+ if { ([istarget "*-*-mingw*"]
+ || [istarget *-*-cygwin*]
+ || [istarget *-*-pe*])} {
+ lappend link_options "additional_flags=-Wl,--out-implib,${dest}.a"
+ }
}
if {[gdb_compile "${objects}" "${dest}" executable $link_options] != ""} {
return -1
@@ -1963,6 +2001,37 @@ proc gdb_load_cmd { args } {
return -1
}
+# gdb_download
+#
+# Copy a file to the remote target and return its target filename.
+# Schedule the file to be deleted at the end of this test.
+
+proc gdb_download { filename } {
+ global cleanfiles
+
+ set destname [remote_download target $filename]
+ lappend cleanfiles $destname
+ return $destname
+}
+
+# gdb_load_shlibs LIB...
+#
+# Copy the listed libraries to the target.
+
+proc gdb_load_shlibs { args } {
+ if {![is_remote target]} {
+ return
+ }
+
+ foreach file $args {
+ gdb_download $file
+ }
+
+ # Even if the target supplies full paths for shared libraries,
+ # they may not be paths for this system.
+ gdb_test "set solib-search-path [file dirname [lindex $args 0]]" "" ""
+}
+
#
# gdb_load -- load a file into the debugger.
# Many files in config/*.exp override this procedure.
@@ -1991,7 +2060,10 @@ proc gdb_continue { function } {
proc default_gdb_init { args } {
global gdb_wrapper_initialized
+ global cleanfiles
+ set cleanfiles {}
+
gdb_clear_suppressed;
# Make sure that the wrapper is rebuilt
@@ -2023,7 +2095,15 @@ proc gdb_init { args } {
}
proc gdb_finish { } {
- gdb_exit;
+ global cleanfiles
+
+ # Exit first, so that the files are no longer in use.
+ gdb_exit
+
+ if { [llength $cleanfiles] > 0 } {
+ eval remote_file target delete $cleanfiles
+ set cleanfiles {}
+ }
}
global debug_format
diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp
index b7d7708..0a8b111 100644
--- a/gdb/testsuite/lib/gdbserver-support.exp
+++ b/gdb/testsuite/lib/gdbserver-support.exp
@@ -164,7 +164,7 @@ proc gdbserver_spawn { child_args } {
set gdbserver_host_exec $host_exec
set gdbserver_host_mtime [file mtime $host_exec]
if [is_remote target] {
- set gdbserver_server_exec [remote_download target $host_exec /tmp/[file tail $host_exec].[pid]]
+ set gdbserver_server_exec [gdb_download $host_exec]
} else {
set gdbserver_server_exec $host_exec
}