diff options
author | Gary Benson <gary@redhat.com> | 2013-06-04 13:23:32 +0000 |
---|---|---|
committer | Gary Benson <gary@redhat.com> | 2013-06-04 13:23:32 +0000 |
commit | a29a3fb7a350b70ec755b1964d2830094314dba8 (patch) | |
tree | 3ecf57a2d1fb5000c36d5594dacd5cef81a9224b /gdb/testsuite/lib | |
parent | f9e148520a52325c43e325984cd1cfea952b8ad8 (diff) | |
download | gdb-a29a3fb7a350b70ec755b1964d2830094314dba8.zip gdb-a29a3fb7a350b70ec755b1964d2830094314dba8.tar.gz gdb-a29a3fb7a350b70ec755b1964d2830094314dba8.tar.bz2 |
2013-06-04 Jan Kratochvil <jan.kratochvil@redhat.com>
Gary Benson <gbenson@redhat.com>
* lib/gdb.exp (build_executable_from_specs): Use gdb_compile_pthread,
gdb_compile_shlib or gdb_compile_shlib_pthreads where appropriate.
* lib/prelink-support.exp (build_executable_own_libs): Allow INTERP
to be set to "no" to indicate that no ld.so copy should be made.
* gdb.base/break-interp.exp (solib_bp): New constant.
(reach_1): Use the above instead of "_dl_debug_state".
(test_attach): Likewise.
(test_ld): Likewise.
* gdb.threads/dlopen-libpthread.exp: New file.
* gdb.threads/dlopen-libpthread.c: Likewise.
* gdb.threads/dlopen-libpthread-lib.c: Likewise.
* gdb.base/solib-corrupted.exp: Disable test if GDB is using probes.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 61 | ||||
-rw-r--r-- | gdb/testsuite/lib/prelink-support.exp | 26 |
2 files changed, 56 insertions, 31 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index b8a7cf8..76ee870 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -4051,31 +4051,6 @@ proc build_executable_from_specs {testname executable options args} { set binfile [standard_output_file $executable] - set objects {} - set i 0 - foreach {s local_options} $args { - if { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $local_options] != "" } { - untested $testname - return -1 - } - lappend objects "${binfile}${i}.o" - incr i - } - - set pthreads [lsearch -exact $options "pthreads"] - if { $pthreads >= 0 } { - set options [lreplace $options $pthreads $pthreads] - if { [gdb_compile_pthreads $objects "${binfile}" executable $options] != "" } { - untested $testname - return -1 - } - } else { - if { [gdb_compile $objects "${binfile}" executable $options] != "" } { - untested $testname - return -1 - } - } - set info_options "" if { [lsearch -exact $options "c++"] >= 0 } { set info_options "c++" @@ -4083,6 +4058,42 @@ proc build_executable_from_specs {testname executable options args} { if [get_compiler_info ${info_options}] { return -1 } + + set binfile [standard_output_file $executable] + + set func gdb_compile + set func_index [lsearch -regexp $options {^(pthreads|shlib|shlib_pthreads)$}] + if {$func_index != -1} { + set func "${func}_[lindex $options $func_index]" + } + + # gdb_compile_shlib and gdb_compile_shlib_pthreads do not use the 3rd + # parameter. They also requires $sources while gdb_compile and + # gdb_compile_pthreads require $objects. Moreover they ignore any options. + if [string match gdb_compile_shlib* $func] { + set sources_path {} + foreach {s local_options} $args { + lappend sources_path "${srcdir}/${subdir}/${s}" + } + set ret [$func $sources_path "${binfile}" $options] + } else { + set objects {} + set i 0 + foreach {s local_options} $args { + if { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $local_options] != "" } { + untested $testname + return -1 + } + lappend objects "${binfile}${i}.o" + incr i + } + set ret [$func $objects "${binfile}" executable $options] + } + if { $ret != "" } { + untested $testname + return -1 + } + return 0 } diff --git a/gdb/testsuite/lib/prelink-support.exp b/gdb/testsuite/lib/prelink-support.exp index 6453deb..ef99783 100644 --- a/gdb/testsuite/lib/prelink-support.exp +++ b/gdb/testsuite/lib/prelink-support.exp @@ -95,8 +95,9 @@ proc file_copy {src dest} { # Wrap function build_executable so that the resulting executable is fully # self-sufficient (without dependencies on system libraries). Parameter # INTERP may be used to specify a loader (ld.so) to be used that is -# different from the default system one. Libraries on which the executable -# depends are copied into directory DIR. Default DIR value to +# different from the default system one. INTERP can be set to "no" if no ld.so +# copy should be made. Libraries on which the executable depends are copied +# into directory DIR. Default DIR value to # `${objdir}/${subdir}/${EXECUTABLE}.d'. # # In case of success, return a string containing the arguments to be used @@ -151,8 +152,15 @@ proc build_executable_own_libs {testname executable sources options {interp ""} if {$interp == ""} { set interp_system [section_get $binfile .interp] - set interp ${dir}/[file tail $interp_system] - file_copy $interp_system $interp + if {$interp_system == ""} { + fail "$test could not find .interp" + } else { + set interp ${dir}/[file tail $interp_system] + file_copy $interp_system $interp + } + } + if {$interp == "no"} { + set interp "" } set dests {} @@ -164,13 +172,19 @@ proc build_executable_own_libs {testname executable sources options {interp ""} # Do not lappend it so that "-rpath $dir" overrides any possible "-rpath"s # specified by the caller to be able to link it for ldd" above. - set options [linsert $options 0 "ldflags=-Wl,--dynamic-linker,$interp,-rpath,$dir"] + set options [linsert $options 0 "ldflags=-Wl,-rpath,$dir"] + if {$interp != ""} { + set options [linsert $options 0 "ldflags=-Wl,--dynamic-linker,$interp"] + } if {[build_executable $testname $executable $sources $options] == -1} { return "" } - set prelink_args "--dynamic-linker=$interp --ld-library-path=$dir $binfile $interp [concat $dests]" + set prelink_args "--ld-library-path=$dir $binfile [concat $dests]" + if {$interp != ""} { + set prelink_args "--dynamic-linker=$interp $prelink_args $interp" + } return $prelink_args } |