* 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.
This commit is contained in:
parent
1a69e1e46a
commit
93f02886fd
10 changed files with 142 additions and 30 deletions
|
@ -1,3 +1,20 @@
|
|||
2007-05-16 Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2007-05-15 Vladimir Prus <vladimir@codesourcery.com>
|
||||
|
||||
* config/unknown.exp: Remove.
|
||||
|
|
|
@ -25,6 +25,10 @@ if $tracelevel then {
|
|||
strace $tracelevel
|
||||
}
|
||||
|
||||
if {[skip_shlib_tests]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
set testfile gdb1555-main
|
||||
set libfile gdb1555
|
||||
set srcfile ${testfile}.c
|
||||
|
@ -36,12 +40,6 @@ set execsrc "${srcdir}/${subdir}/${srcfile}"
|
|||
|
||||
remote_exec build "rm -f ${binfile}"
|
||||
|
||||
# Are we on a target board? No support for downloading shared libraries
|
||||
# to a target yet.
|
||||
if ![isnative] then {
|
||||
return 0
|
||||
}
|
||||
|
||||
# get the value of gcc_compiled
|
||||
if [get_compiler_info ${binfile}] {
|
||||
return -1
|
||||
|
@ -57,6 +55,7 @@ gdb_exit
|
|||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_load ${binfile}
|
||||
gdb_load_shlibs $libobj
|
||||
|
||||
if ![runto_main] then {
|
||||
fail "Can't run to main"
|
||||
|
|
|
@ -26,8 +26,7 @@ if $tracelevel then {
|
|||
set prms_id 0
|
||||
set bug_id 0
|
||||
|
||||
# are we on a target board?
|
||||
if ![isnative] then {
|
||||
if {[skip_shlib_tests]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -57,6 +56,7 @@ gdb_exit
|
|||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_load ${binfile}
|
||||
gdb_load_shlibs $lib_sl
|
||||
|
||||
if [target_info exists gdb_stub] {
|
||||
gdb_step_for_stub;
|
||||
|
|
|
@ -40,8 +40,7 @@ if $tracelevel then {
|
|||
set prms_id 0
|
||||
set bug_id 0
|
||||
|
||||
# are we on a target board?
|
||||
if ![isnative] then {
|
||||
if {[skip_shlib_tests]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -75,6 +74,8 @@ gdb_exit
|
|||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_load ${binfile}
|
||||
gdb_load_shlibs $lib1 $lib2
|
||||
|
||||
send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
|
||||
send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"
|
||||
send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
# them gets relocated at load-time. Check that gdb gets the right
|
||||
# values for the debugging and minimal symbols.
|
||||
|
||||
if {[istarget *-elf*] || [istarget *-coff] || [istarget *-aout]} then {
|
||||
verbose "test skipped - shared object files not supported by this target."
|
||||
if {[skip_shlib_tests]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -85,6 +84,7 @@ gdb_exit
|
|||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_load ${workdir}/shreloc
|
||||
gdb_load_shlibs $lib1_sl $lib2_sl
|
||||
|
||||
# Load up the shared objects
|
||||
if ![runto_main] then {
|
||||
|
|
|
@ -22,9 +22,8 @@ if $tracelevel then {
|
|||
set prms_id 0
|
||||
set bug_id 0
|
||||
|
||||
# are we on a target board
|
||||
if ![isnative] then {
|
||||
return
|
||||
if {[skip_shlib_tests]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
set testfile "so-impl-ld"
|
||||
|
@ -61,6 +60,7 @@ gdb_exit
|
|||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_load ${binfile}
|
||||
gdb_load_shlibs $lib_sl
|
||||
|
||||
# This program implicitly loads SOM shared libraries.
|
||||
#
|
||||
|
|
|
@ -18,8 +18,15 @@
|
|||
# than one shared library, when one of the implementations is a "weak"
|
||||
# symbol. GDB should set a breakpoint at the first copy it finds.
|
||||
|
||||
# Don't try to run shared library test cases on a remote target for now.
|
||||
if ![isnative] then {
|
||||
if {[skip_shlib_tests]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
# These targets have shared libraries, but weak symbols are not meaningful.
|
||||
if {([istarget arm*-*-symbianelf*]
|
||||
|| [istarget *-*-mingw*]
|
||||
|| [istarget *-*-cygwin*]
|
||||
|| [istarget *-*-pe*])} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -81,6 +88,7 @@ proc do_test { lib1opts lib2opts lib1first } {
|
|||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_load ${binfile}
|
||||
gdb_load_shlibs $lib1 $lib2
|
||||
|
||||
runto_main
|
||||
|
||||
|
|
|
@ -26,8 +26,15 @@ if $tracelevel then {
|
|||
set prms_id 0
|
||||
set bug_id 0
|
||||
|
||||
# are we on a target board?
|
||||
if ![isnative] then {
|
||||
if {[skip_shlib_tests]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
# TODO: Use LoadLibrary on these targets instead of dlopen.
|
||||
if {([istarget arm*-*-symbianelf*]
|
||||
|| [istarget *-*-mingw*]
|
||||
|| [istarget *-*-cygwin*]
|
||||
|| [istarget *-*-pe*])} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -40,17 +47,16 @@ set shlibdir ${objdir}/${subdir}
|
|||
set libsrc $srcdir/$subdir/$libfile.c
|
||||
set lib_sl $objdir/$subdir/$libfile.sl
|
||||
|
||||
set dl_lib_flag ""
|
||||
set lib_opts debug
|
||||
set exec_opts [list debug additional_flags=-DSHLIB_DIR\=\"${shlibdir}\"]
|
||||
|
||||
switch -glob [istarget] {
|
||||
"hppa*-hp-hpux*" { }
|
||||
"*-*-linux*" { set dl_lib_flag "libs=-ldl" }
|
||||
"*-*-solaris*" { set dl_lib_flag "libs=-ldl" }
|
||||
"*-*-linux*" { lappend exec_opts "libs=-ldl" }
|
||||
"*-*-solaris*" { lappend exec_opts "libs=-ldl" }
|
||||
default { }
|
||||
}
|
||||
|
||||
set lib_opts debug
|
||||
set exec_opts [list debug $dl_lib_flag additional_flags=-DSHLIB_DIR\=\"${shlibdir}\"]
|
||||
|
||||
if [get_compiler_info ${binfile}] {
|
||||
return -1
|
||||
}
|
||||
|
@ -67,6 +73,7 @@ gdb_exit
|
|||
gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
gdb_load ${binfile}
|
||||
gdb_load_shlibs $lib_sl
|
||||
|
||||
if [target_info exists gdb_stub] {
|
||||
gdb_step_for_stub;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue