set main_opts [list debug $lang]
set link_opts [list debug shlib=${libobj1}]
+ set target_libobj2 [gdb_download_shlib $libobj2]
+
if {$dlopen} {
- lappend main_opts "additional_flags=-DSHLIB_NAME=\"$libobj2\""
+ lappend main_opts "additional_flags=-DSHLIB_NAME=\"$target_libobj2\""
lappend link_opts "shlib_load"
} else {
lappend link_opts "shlib=${libobj2}"
clean_restart $executable
gdb_load_shlib $libobj1
- gdb_load_shlib $libobj2
+ gdb_locate_shlib $libobj2
if ![runto_main] {
return -1
}
}
-# gdb_load_shlib LIB...
-#
-# Copy the listed library to the target.
+# Copy shlib FILE to the target.
-proc gdb_load_shlib { file } {
+proc gdb_download_shlib { file } {
+ return [gdb_remote_download target [shlib_target_file $file]]
+}
+
+# Set solib-search-path to allow gdb to locate shlib FILE.
+
+proc gdb_locate_shlib { file } {
global gdb_spawn_id
if ![info exists gdb_spawn_id] {
perror "gdb_load_shlib: GDB is not running"
}
- set dest [gdb_remote_download target [shlib_target_file $file]]
-
- if {[is_remote target]} {
- # If the target is remote, we need to tell gdb where to find the
- # libraries.
- #
- # We could set this even when not testing remotely, but a user
- # generally won't set it unless necessary. In order to make the tests
- # more like the real-life scenarios, we don't set it for local testing.
- gdb_test "set solib-search-path [file dirname $file]" "" \
- "set solib-search-path for [file tail $file]"
+ # If the target is remote, we need to tell gdb where to find the
+ # libraries.
+ if { ![is_remote target] } {
+ return
}
+ # We could set this even when not testing remotely, but a user
+ # generally won't set it unless necessary. In order to make the tests
+ # more like the real-life scenarios, we don't set it for local testing.
+ gdb_test "set solib-search-path [file dirname $file]" "" \
+ "set solib-search-path for [file tail $file]"
+}
+
+# Copy shlib FILE to the target and set solib-search-path to allow gdb to
+# locate it.
+
+proc gdb_load_shlib { file } {
+ set dest [gdb_download_shlib $file]
+ gdb_locate_shlib $file
return $dest
}