(gdbarch_make_solib_ops (current_inferior ()->arch (),
current_program_space));
- if (current_program_space->exec_bfd ())
- {
- const unsigned solib_add_generation
- = current_program_space->solib_add_generation;
+ {
+ const unsigned solib_add_generation
+ = current_program_space->solib_add_generation;
- scoped_restore restore_in_initial_library_scan
- = make_scoped_restore (¤t_inferior ()->in_initial_library_scan,
- true);
+ scoped_restore restore_in_initial_library_scan
+ = make_scoped_restore (¤t_inferior ()->in_initial_library_scan,
+ true);
- /* Create the hooks to handle shared library load and unload
- events. */
- solib_create_inferior_hook (from_tty);
+ /* Create the hooks to handle shared library load and unload
+ events. */
+ solib_create_inferior_hook (from_tty);
- if (current_program_space->solib_add_generation == solib_add_generation)
- {
- /* The platform-specific hook should load initial shared libraries,
- but didn't. FROM_TTY will be incorrectly 0 but such solib
- targets should be fixed anyway. Call it only after the solib
- target has been initialized by solib_create_inferior_hook. */
-
- if (info_verbose)
- warning (_("platform-specific solib_create_inferior_hook did "
- "not load initial shared libraries."));
-
- /* If the solist is global across processes, there's no need to
- refetch it here. */
- if (!gdbarch_has_global_solist (current_inferior ()->arch ()))
- solib_add (nullptr, 0, auto_solib_add);
- }
- }
+ if (current_program_space->solib_add_generation == solib_add_generation)
+ {
+ /* The platform-specific hook should load initial shared libraries,
+ but didn't. FROM_TTY will be incorrectly 0 but such solib
+ targets should be fixed anyway. Call it only after the solib
+ target has been initialized by solib_create_inferior_hook. */
+
+ if (info_verbose)
+ warning (_("platform-specific solib_create_inferior_hook did "
+ "not load initial shared libraries."));
+
+ /* If the solist is global across processes, there's no need to
+ refetch it here. */
+ if (!gdbarch_has_global_solist (current_inferior ()->arch ()))
+ solib_add (nullptr, 0, auto_solib_add);
+ }
+ }
/* If the user sets watchpoints before execution having started,
then she gets software watchpoints, because GDB can't know which
if { $exec_loaded } {
gdb_test "whatis global_exec_var" "^type = volatile struct exec_type"
-
- if { $lib_loaded } {
- gdb_test "whatis global_lib_var" "^type = volatile struct lib_type"
- } else {
- gdb_test "whatis global_lib_var" \
- "^No symbol \"global_lib_var\" in current context\\."
+ } else {
+ # If the debug info for libc, etc. are available, there might
+ # be a symbol table.
+ gdb_test_multiple "whatis global_exec_var" "" {
+ -re -wrap "No symbol \"global_exec_var\" in current context\\." {
+ pass $gdb_test_name
+ }
+
+ -re -wrap "No symbol table is loaded\\. Use the \"file\" command\\." {
+ pass $gdb_test_name
+ }
}
+ }
+
+ if { $lib_loaded } {
+ gdb_test "whatis global_lib_var" "^type = volatile struct lib_type"
} else {
- gdb_test "whatis global_exec_var" \
- "^No symbol table is loaded\\. Use the \"file\" command\\."
- gdb_test "whatis global_lib_var" \
- "^No symbol table is loaded\\. Use the \"file\" command\\."
+ # If the debug info for libc, etc. are available, there might
+ # be a symbol table.
+ gdb_test_multiple "whatis global_lib_var" "" {
+ -re -wrap "No symbol \"global_lib_var\" in current context\\." {
+ pass $gdb_test_name
+ }
+
+ -re -wrap "No symbol table is loaded\\. Use the \"file\" command\\." {
+ pass $gdb_test_name
+ }
+ }
}
}
# Setup some debug-file-directories.
set debugdir_no_lib \
[setup_debugdir "debugdir.no-lib" [list "$hidden_binfile"]]
+set debugdir_no_main \
+ [setup_debugdir "debugdir.no-main" [list "$hidden_libfile"]]
set debugdir_empty \
[setup_debugdir "debugdir.empty" {}]
set debugdir_all \
with_test_prefix "all objfiles available" {
# Another sanity check that GDB can find the files via the
# debug-file-directory.
+ clean_restart
set_debug_file_dir $debugdir_all
load_core_file
check_loaded_debug true true
with_test_prefix "lib objfile missing" {
# Another sanity check that GDB can find the files via the
# debug-file-directory.
+ clean_restart
set_debug_file_dir $debugdir_no_lib
load_core_file
check_loaded_debug true false
}
+with_test_prefix "main objfile missing" {
+ # Another sanity check that GDB can find the files via the
+ # debug-file-directory.
+ clean_restart
+ set_debug_file_dir $debugdir_no_main
+ load_core_file
+ check_loaded_debug false true
+}
+
with_test_prefix "all objfiles missing, handler returns None" {
clean_restart_load_python
gdb_test_no_output \
check_loaded_debug false false
- # The handler should be called three times, once for the
- # mapped-file, once for the core-file's exec, and once for the
+ # The handler should be called four times, twice for the
+ # mapped-files, once for the core-file's exec, and once for the
# shared library.
- gdb_test "python print(handler_obj.call_count)" "^3" \
- "check handler was called three times"
+ gdb_test "python print(handler_obj.call_count)" "^4" \
+ "check handler was called four times"
}
with_test_prefix "lib objfile missing, handler returns None" {