return -1
}
+gdb_download_shlib $binfile2
+
# test -catch-load
with_test_prefix "catch-load" {
mi_clean_restart $binfile
+ mi_locate_shlib $binfile2
mi_runto_main
mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" \
# test -catch-unload
with_test_prefix "catch-unload" {
mi_clean_restart $binfile
+ mi_locate_shlib $binfile2
mi_runto_main
mi_gdb_test "111-gdb-set auto-solib-add on" "111\\^done" "auto-solib-add on"
return -1
}
+set shlib_path_target [gdb_download_shlib $shlib_path]
-set opts [list shlib_load debug additional_flags=-DSHLIB_PATH="${shlib_path}"]
+set opts [list shlib_load debug additional_flags=-DSHLIB_PATH="${shlib_path_target}"]
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $opts] != "" } {
untested "failed to compile"
return -1
# Start the process once and create varobjs referencing the loaded objfiles.
with_test_prefix "setup" {
- mi_load_shlibs $::shlib_path
+ mi_locate_shlib $::shlib_path
if { $separate_debuginfo } {
mi_load_shlibs ${::shlib_path}.debug
}
}
}
+# Set solib-search-path to allow gdb to locate shlib FILE.
+proc mi_locate_shlib { file } {
+ global mi_spawn_id
+
+ if ![info exists mi_spawn_id] {
+ perror "mi_locate_shlib: GDB is not running"
+ }
+
+ # 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.
+ mi_gdb_test "set solib-search-path [file dirname $file]" "\^done" ""
+}
+
+# Copy shlib FILE to the target and set solib-search-path to allow gdb to
+# locate it.
+proc mi_load_shlib { file } {
+ set dest [gdb_download_shlib $file]
+ mi_locate_shlib $file
+ return $dest
+}
+
# Download shared libraries to the target.
proc mi_load_shlibs { args } {
foreach file $args {
- 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.
- mi_gdb_test "set solib-search-path [file dirname [lindex $args 0]]" "\^done" ""
+ mi_load_shlib $file
}
}