binutils-gdb/gdb/solib.c

1194 lines
34 KiB
C
Raw Normal View History

2000-10-24 22:05:36 +02:00
/* Handle shared libraries for GDB, the GNU Debugger.
2007-01-09 18:59:20 +01:00
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
1999-07-07 22:19:36 +02:00
This file is part of GDB.
1999-07-07 22:19:36 +02:00
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
1999-07-07 22:19:36 +02:00
(at your option) any later version.
1999-07-07 22:19:36 +02:00
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include <sys/types.h>
#include <fcntl.h>
2000-10-24 22:05:36 +02:00
#include "gdb_string.h"
#include "symtab.h"
#include "bfd.h"
#include "symfile.h"
#include "objfiles.h"
#include "exceptions.h"
#include "gdbcore.h"
#include "command.h"
#include "target.h"
#include "frame.h"
#include "gdb_regex.h"
#include "inferior.h"
#include "environ.h"
#include "language.h"
#include "gdbcmd.h"
#include "completer.h"
#include "filenames.h" /* for DOSish file names */
#include "exec.h"
2000-10-24 22:05:36 +02:00
#include "solist.h"
#include "observer.h"
#include "readline/readline.h"
#include "remote.h"
2008-02-21 Pedro Alves <pedro@codesorcery.com> Silence a few -Wmissing-prototypes warnings. PR build/9877: * amd64-nat.c: Include "amd64-nat.h". * fork-child.c (_initialize_fork_child): Ditto. * gcore.c (_initialize_gcore): Ditto. * inf-ptrace.c: Include "inf-ptrace.h". (inf_ptrace_store_registers): Make it static. * linux-nat.c (linux_nat_terminal_ours): Make it static. (_initialize_linux_nat): Declare before definition. * linux-tdep.c: Include "linux-tdep.h". * linux-thread-db.c (_initialize_thread_db): Declare before definition. * proc-service.c (_initialize_proc_service): Ditto. * remote.c (remote_send_printf): Make it static. * solib.c: Include "solib.h". * symfile-mem.c (_initialize_symfile_mem): Declare before definition. * ada-lang.c (ada_la_decode, ada_match_name) (ada_suppress_symbol_printing, ada_is_array_type) (ada_value_ptr_subscript, ada_array_length) (ada_to_static_fixed_value): Make them static. (_initialize_ada_language): Declare before definition. * ada-tasks.c (ada_get_task_number, ada_get_environment_task) (ada_task_list_changed, ada_new_objfile_observer): Make them static. (_initialize_tasks): Declare before definition. * addrmap.c (_initialize_addrmap): Declare before definition. * auxv.c (default_auxv_parse): Make it static. * bfd-target.c (target_bfd_xfer_partial, target_bfd_xclose): Make them static. * breakpoint.c (remove_sal): Add line break. (expand_line_sal_maybe): Make it static. * cp-name-parser.y: Include "cp-support.h". * cp-valprint.c (cp_find_class_member): Make it static. * eval.c (value_f90_subarray): Ditto. * exceptions.c (print_any_exception): Ditto. * findcmd.c (_initialize_mem_search): Declare before definition. * frame.c (frame_observer_target_changed): Make it static. * gnu-v3-abi.c (gnuv3_find_method_in): Make it static. * inf-child.c: Include "inf-child.h". * inferior.h (valid_inferior_id): Rename to ... (valid_gdb_inferior_id): ... this. * infrun.c (infrun_thread_stop_requested, siginfo_make_value): Make them static. * jv-lang.c (java_language_arch_info): Make it static. * m2-typeprint.c (m2_get_discrete_bounds): Ditto. * osdata.c (info_osdata_command): Make it static. * regcache.c (regcache_observer_target_changed): Make it static. * reverse.c (_initialize_reverse): Declare before definition. * stabsread.c (cleanup_undefined_types_noname) (cleanup_undefined_types_1): Make them static. * symfile.c (place_section): Make it static. * symtab.c (find_pc_sect_psymtab_closer): Make it static. * target-descriptions.c (_initialize_target_descriptions): Declare before definition. * target.c (default_get_ada_task_ptid, find_default_can_async_p) (find_default_is_async_p, find_default_supports_non_stop): Make them static. (target_supports_non_stop): Add prototype. (dummy_pid_to_str): Make it static. * utils.c (_initialize_utils): Declare before definition. * ada-exp.y (_initialize_ada_exp): Declare before definition. * solib-svr4.c (HAS_LM_DYNAMIC_FROM_LINK_MAP): Add a prototype. * target.h (struct target_ops): Add a prototype to the to_can_execute_reverse callback. * macroscope.c (_initialize_macroscope): Declare before definition. * cp-namespace.c (_initialize_cp_namespace): Declare before definition. * python/python.c (_initialize_python): Declare before definition. * tui/tui-command.c: Include "tui/tui-command.h". * tui/tui-data.c (init_content_element, init_win_info): Make them static. * tui/tui-disasm.c: Include "tui/tui-disasm.h". * tui/tui-interp.c (_initialize_tui_interp): Declare before definition. * tui/tui-layout.c: Include "tui/tui-layout.h". (_initialize_tui_layout): Declare before definition. * tui/tui-regs.c: Include "tui/tui-regs.h". (tui_display_reg_element_at_line): Make it static. (_initialize_tui_regs): Declare before definition. * tui/tui-stack.c (_initialize_tui_stack): Declare before definition. * tui/tui-win.c: Include "tui/tui-win.h". (_initialize_tui_win): Declare before definition. (tui_sigwinch_handler): Make it static. Wrap in ifdef SIGWINCH. * tui/tui-win.h (tui_sigwinch_handler): Delete declaration. (tui_get_cmd_list): Add a prototype. * tui/tui-windata.c: Include tui-windata.h. * tui/tui-wingeneral.c (box_win): Make it static. * cli/cli-logging.c (show_logging_command): Make it static. (_initialize_cli_logging): Declare before definition. * mi/mi-common.c (_initialize_gdb_mi_common): Declare before definition.
2009-02-21 17:14:50 +01:00
#include "solib.h"
#include "interps.h"
/* Architecture-specific operations. */
/* Per-architecture data key. */
static struct gdbarch_data *solib_data;
static void *
solib_init (struct obstack *obstack)
{
struct target_so_ops **ops;
ops = OBSTACK_ZALLOC (obstack, struct target_so_ops *);
*ops = current_target_so_ops;
return ops;
}
static struct target_so_ops *
solib_ops (struct gdbarch *gdbarch)
{
struct target_so_ops **ops = gdbarch_data (gdbarch, solib_data);
return *ops;
}
/* Set the solib operations for GDBARCH to NEW_OPS. */
void
set_solib_ops (struct gdbarch *gdbarch, struct target_so_ops *new_ops)
{
struct target_so_ops **ops = gdbarch_data (gdbarch, solib_data);
*ops = new_ops;
}
2000-10-24 22:05:36 +02:00
/* external data declarations */
/* FIXME: gdbarch needs to control this variable, or else every
configuration needs to call set_solib_ops. */
2000-10-24 22:05:36 +02:00
struct target_so_ops *current_target_so_ops;
/* local data declarations */
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
static struct so_list *so_list_head; /* List of known shared objects */
/* Local function prototypes */
/* If non-empty, this is a search path for loading non-absolute shared library
symbol files. This takes precedence over the environment variables PATH
and LD_LIBRARY_PATH. */
static char *solib_search_path = NULL;
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
static void
show_solib_search_path (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file, _("\
The search path for loading non-absolute shared library symbol files is %s.\n"),
value);
}
/*
GLOBAL FUNCTION
solib_find -- Find a shared library file.
SYNOPSIS
char *solib_find (char *in_pathname, int *fd);
DESCRIPTION
Global variable GDB_SYSROOT is used as a prefix directory
to search for shared libraries if they have an absolute path.
Global variable SOLIB_SEARCH_PATH is used as a prefix directory
(or set of directories, as in LD_LIBRARY_PATH) to search for all
shared libraries if not found in GDB_SYSROOT.
Search algorithm:
* If there is a gdb_sysroot and path is absolute:
* Search for gdb_sysroot/path.
* else
* Look for it literally (unmodified).
* Look in SOLIB_SEARCH_PATH.
* If available, use target defined search function.
* If gdb_sysroot is NOT set, perform the following two searches:
* Look in inferior's $PATH.
* Look in inferior's $LD_LIBRARY_PATH.
*
* The last check avoids doing this search when targetting remote
* machines since gdb_sysroot will almost always be set.
RETURNS
Full pathname of the shared library file, or NULL if not found.
(The pathname is malloc'ed; it needs to be freed by the caller.)
*FD is set to either -1 or an open file handle for the library. */
char *
solib_find (char *in_pathname, int *fd)
{
* gdbarch.sh (target_gdbarch): New global variable. (deprecated_current_gdbarch_select_hack): Set it. * gdbarch.c, gdbarch.h: Regenerate. * arch-utils.c (gdbarch_update_p): Use target_gdbarch instead of current_gdbarch. * target-descriptions.c (target_find_description): Likewise. * arm-tdep.c (arm_update_current_architecture): Likewise. (show_fp_model, arm_show_abi, arm_show_fallback_mode, arm_show_force_mode): Likewise. * mips-tdep.c (show_mask_address, show_mipsfpu_command, show_mips_abi): Likewise. * mep-tdep.c (me_module_register_set, current_me_module): Likewise. * target.c (target_translate_tls_address): Use target_gdbarch instead of current_gdbarch. * remote.c (struct packet_reg): Likewise. (get_remote_arch_state, packet_reg_from_regnum, packet_reg_from_pnum, remote_check_symbols, remote_wait, remote_address_masked, remote_insert_breakpoint, remote_insert_hw_breakpoint, remote_read_description): Likewise. * remote-m32r-sdi.c (m32r_resume, m32r_wait): Likewise. * remote-mips.c (mips_open, mips_common_breakpoint): Likewise. * cris-tdep.c (cris_can_use_hardware_watchpoint): Likewise. * solib.c (solib_open, solib_map_sections, solib_read_symbols, solib_add, info_sharedlibrary_command, solib_address, solib_create_inferior_hook, in_solib_dynsym_resolve_code, solib_global_lookup): Likewise. * solib-frv.c (enable_break2, frv_relocate_main_executable): Likewise. * solib-irix.c (irix_current_sos, irix_open_symbol_file_object): Likewise. * solib-sunos.c (sunos_solib_create_inferior_hook): Likewise. * solib-svr4.c (exec_entry_point, enable_break, svr4_free_so, set_solib_svr4_fetch_link_map_offsets, svr4_fetch_link_map_offsets): Likewise. * nto-tdep.c (nto_find_and_open_solib, nto_init_solib_absolute_prefix, nto_truncate_ptr): Likewise. * mips-linux-tdep.c (mips_linux_in_dynsym_stub): Likewise.
2008-08-26 19:21:29 +02:00
struct target_so_ops *ops = solib_ops (target_gdbarch);
int found_file = -1;
char *temp_pathname = NULL;
int gdb_sysroot_is_empty;
gdb_sysroot_is_empty = (gdb_sysroot == NULL || *gdb_sysroot == 0);
if (! IS_ABSOLUTE_PATH (in_pathname) || gdb_sysroot_is_empty)
temp_pathname = in_pathname;
else
{
int prefix_len = strlen (gdb_sysroot);
/* Remove trailing slashes from absolute prefix. */
while (prefix_len > 0
&& IS_DIR_SEPARATOR (gdb_sysroot[prefix_len - 1]))
prefix_len--;
/* Cat the prefixed pathname together. */
temp_pathname = alloca (prefix_len + strlen (in_pathname) + 1);
strncpy (temp_pathname, gdb_sysroot, prefix_len);
temp_pathname[prefix_len] = '\0';
strcat (temp_pathname, in_pathname);
}
/* Handle remote files. */
if (remote_filename_p (temp_pathname))
{
*fd = -1;
return xstrdup (temp_pathname);
}
/* Now see if we can open it. */
found_file = open (temp_pathname, O_RDONLY | O_BINARY, 0);
/* We try to find the library in various ways. After each attempt
(except for the one above), either found_file >= 0 and
temp_pathname is a malloc'd string, or found_file < 0 and
temp_pathname does not point to storage that needs to be
freed. */
if (found_file < 0)
temp_pathname = NULL;
else
temp_pathname = xstrdup (temp_pathname);
/* If the search in gdb_sysroot failed, and the path name is
absolute at this point, make it relative. (openp will try and open the
file according to its absolute path otherwise, which is not what we want.)
Affects subsequent searches for this solib. */
if (found_file < 0 && IS_ABSOLUTE_PATH (in_pathname))
{
/* First, get rid of any drive letters etc. */
while (!IS_DIR_SEPARATOR (*in_pathname))
in_pathname++;
/* Next, get rid of all leading dir separators. */
while (IS_DIR_SEPARATOR (*in_pathname))
in_pathname++;
}
/* If not found, search the solib_search_path (if any). */
if (found_file < 0 && solib_search_path != NULL)
found_file = openp (solib_search_path, OPF_TRY_CWD_FIRST,
in_pathname, O_RDONLY | O_BINARY, &temp_pathname);
/* If not found, next search the solib_search_path (if any) for the basename
only (ignoring the path). This is to allow reading solibs from a path
that differs from the opened path. */
if (found_file < 0 && solib_search_path != NULL)
found_file = openp (solib_search_path, OPF_TRY_CWD_FIRST,
lbasename (in_pathname), O_RDONLY | O_BINARY,
&temp_pathname);
2003-02-24 20:11:04 +01:00
/* If not found, try to use target supplied solib search method */
if (found_file < 0 && ops->find_and_open_solib)
found_file = ops->find_and_open_solib (in_pathname, O_RDONLY | O_BINARY,
&temp_pathname);
2003-02-24 20:11:04 +01:00
/* If not found, next search the inferior's $PATH environment variable. */
if (found_file < 0 && gdb_sysroot_is_empty)
found_file = openp (get_in_environ (inferior_environ, "PATH"),
OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY,
&temp_pathname);
/* If not found, next search the inferior's $LD_LIBRARY_PATH
environment variable. */
if (found_file < 0 && gdb_sysroot_is_empty)
found_file = openp (get_in_environ (inferior_environ, "LD_LIBRARY_PATH"),
OPF_TRY_CWD_FIRST, in_pathname, O_RDONLY | O_BINARY,
&temp_pathname);
*fd = found_file;
return temp_pathname;
}
/* Open and return a BFD for the shared library PATHNAME. If FD is not -1,
it is used as file handle to open the file. Throws an error if the file
could not be opened. Handles both local and remote file access.
PATHNAME must be malloc'ed by the caller. If successful, the new BFD's
name will point to it. If unsuccessful, PATHNAME will be freed and the
FD will be closed (unless FD was -1). */
bfd *
solib_bfd_fopen (char *pathname, int fd)
{
bfd *abfd;
if (remote_filename_p (pathname))
{
gdb_assert (fd == -1);
abfd = remote_bfd_open (pathname, gnutarget);
}
else
{
abfd = bfd_fopen (pathname, gnutarget, FOPEN_RB, fd);
if (abfd)
bfd_set_cacheable (abfd, 1);
else if (fd != -1)
close (fd);
}
if (!abfd)
{
make_cleanup (xfree, pathname);
error (_("Could not open `%s' as an executable file: %s"),
pathname, bfd_errmsg (bfd_get_error ()));
}
return abfd;
}
/* Find shared library PATHNAME and open a BFD for it. */
bfd *
solib_bfd_open (char *pathname)
{
char *found_pathname;
int found_file;
bfd *abfd;
const struct bfd_arch_info *b;
/* Search for shared library file. */
found_pathname = solib_find (pathname, &found_file);
if (found_pathname == NULL)
perror_with_name (pathname);
/* Open bfd for shared library. */
abfd = solib_bfd_fopen (found_pathname, found_file);
/* Check bfd format. */
if (!bfd_check_format (abfd, bfd_object))
{
bfd_close (abfd);
make_cleanup (xfree, found_pathname);
error (_("`%s': not in executable format: %s"),
found_pathname, bfd_errmsg (bfd_get_error ()));
}
/* Check bfd arch. */
b = gdbarch_bfd_arch_info (target_gdbarch);
if (!b->compatible (b, bfd_get_arch_info (abfd)))
warning (_("`%s': Shared library architecture %s is not compatible "
"with target architecture %s."), found_pathname,
bfd_get_arch_info (abfd)->printable_name, b->printable_name);
return abfd;
}
/*
1999-07-07 22:19:36 +02:00
LOCAL FUNCTION
1999-07-07 22:19:36 +02:00
solib_map_sections -- open bfd and build sections for shared lib
1999-07-07 22:19:36 +02:00
SYNOPSIS
1999-07-07 22:19:36 +02:00
static int solib_map_sections (struct so_list *so)
1999-07-07 22:19:36 +02:00
DESCRIPTION
1999-07-07 22:19:36 +02:00
Given a pointer to one of the shared objects in our list
of mapped objects, use the recorded name to open a bfd
descriptor for the object, build a section table, and then
relocate all the section addresses by the base address at
which the shared object was mapped.
1999-07-07 22:19:36 +02:00
FIXMES
1999-07-07 22:19:36 +02:00
In most (all?) cases the shared object file name recorded in the
dynamic linkage tables will be a fully qualified pathname. For
cases where it isn't, do we really mimic the systems search
mechanism correctly in the below code (particularly the tilde
expansion stuff?).
*/
static int
solib_map_sections (void *arg)
{
struct so_list *so = (struct so_list *) arg; /* catch_errors bogon */
struct target_so_ops *ops = solib_ops (target_gdbarch);
char *filename;
struct target_section *p;
struct cleanup *old_chain;
bfd *abfd;
1999-07-07 22:19:36 +02:00
filename = tilde_expand (so->so_name);
2000-12-15 02:01:51 +01:00
old_chain = make_cleanup (xfree, filename);
abfd = ops->bfd_open (filename);
do_cleanups (old_chain);
2000-10-24 22:05:36 +02:00
/* Leave bfd open, core_xfer_memory and "info files" need it. */
so->abfd = gdb_bfd_ref (abfd);
/* copy full path name into so_name, so that later symbol_file_add
can find it */
if (strlen (bfd_get_filename (abfd)) >= SO_NAME_MAX_PATH_SIZE)
error (_("Shared library file name is too long."));
strcpy (so->so_name, bfd_get_filename (abfd));
2000-10-24 22:05:36 +02:00
if (build_section_table (abfd, &so->sections, &so->sections_end))
{
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("Can't find the file sections in `%s': %s"),
2000-10-24 22:05:36 +02:00
bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
}
1999-08-31 03:14:27 +02:00
2000-10-24 22:05:36 +02:00
for (p = so->sections; p < so->sections_end; p++)
1999-08-31 03:14:27 +02:00
{
2000-10-24 22:05:36 +02:00
/* Relocate the section binding addresses as recorded in the shared
object's file by the base address to which the object was actually
mapped. */
ops->relocate_section_addresses (so, p);
/* If the target didn't provide information about the address
range of the shared object, assume we want the location of
the .text section. */
if (so->addr_low == 0 && so->addr_high == 0
&& strcmp (p->the_bfd_section->name, ".text") == 0)
2000-10-24 22:05:36 +02:00
{
so->addr_low = p->addr;
so->addr_high = p->endaddr;
2000-10-24 22:05:36 +02:00
}
1999-08-31 03:14:27 +02:00
}
2000-10-24 22:05:36 +02:00
return (1);
1999-08-31 03:14:27 +02:00
}
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
/* LOCAL FUNCTION
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
free_so --- free a `struct so_list' object
1999-07-07 22:19:36 +02:00
SYNOPSIS
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
void free_so (struct so_list *so)
1999-07-07 22:19:36 +02:00
DESCRIPTION
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
Free the storage associated with the `struct so_list' object SO.
If we have opened a BFD for SO, close it.
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
The caller is responsible for removing SO from whatever list it is
a member of. If we have placed SO's sections in some target's
section table, the caller is responsible for removing them.
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
This function doesn't mess with objfiles at all. If there is an
objfile associated with SO that needs to be removed, the caller is
responsible for taking care of that. */
2000-10-24 22:05:36 +02:00
void
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
free_so (struct so_list *so)
{
* gdbarch.sh (target_gdbarch): New global variable. (deprecated_current_gdbarch_select_hack): Set it. * gdbarch.c, gdbarch.h: Regenerate. * arch-utils.c (gdbarch_update_p): Use target_gdbarch instead of current_gdbarch. * target-descriptions.c (target_find_description): Likewise. * arm-tdep.c (arm_update_current_architecture): Likewise. (show_fp_model, arm_show_abi, arm_show_fallback_mode, arm_show_force_mode): Likewise. * mips-tdep.c (show_mask_address, show_mipsfpu_command, show_mips_abi): Likewise. * mep-tdep.c (me_module_register_set, current_me_module): Likewise. * target.c (target_translate_tls_address): Use target_gdbarch instead of current_gdbarch. * remote.c (struct packet_reg): Likewise. (get_remote_arch_state, packet_reg_from_regnum, packet_reg_from_pnum, remote_check_symbols, remote_wait, remote_address_masked, remote_insert_breakpoint, remote_insert_hw_breakpoint, remote_read_description): Likewise. * remote-m32r-sdi.c (m32r_resume, m32r_wait): Likewise. * remote-mips.c (mips_open, mips_common_breakpoint): Likewise. * cris-tdep.c (cris_can_use_hardware_watchpoint): Likewise. * solib.c (solib_open, solib_map_sections, solib_read_symbols, solib_add, info_sharedlibrary_command, solib_address, solib_create_inferior_hook, in_solib_dynsym_resolve_code, solib_global_lookup): Likewise. * solib-frv.c (enable_break2, frv_relocate_main_executable): Likewise. * solib-irix.c (irix_current_sos, irix_open_symbol_file_object): Likewise. * solib-sunos.c (sunos_solib_create_inferior_hook): Likewise. * solib-svr4.c (exec_entry_point, enable_break, svr4_free_so, set_solib_svr4_fetch_link_map_offsets, svr4_fetch_link_map_offsets): Likewise. * nto-tdep.c (nto_find_and_open_solib, nto_init_solib_absolute_prefix, nto_truncate_ptr): Likewise. * mips-linux-tdep.c (mips_linux_in_dynsym_stub): Likewise.
2008-08-26 19:21:29 +02:00
struct target_so_ops *ops = solib_ops (target_gdbarch);
1999-07-07 22:19:36 +02:00
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
if (so->sections)
2000-12-15 02:01:51 +01:00
xfree (so->sections);
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
gdb_bfd_unref (so->abfd);
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
ops->free_so (so);
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
2000-12-15 02:01:51 +01:00
xfree (so);
}
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
/* Return address of first so_list entry in master shared object list. */
struct so_list *
master_so_list (void)
{
return so_list_head;
}
static void
symbol_add_stub (struct so_list *so, int flags)
{
struct section_addr_info *sap;
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
/* Have we already loaded this shared object? */
ALL_OBJFILES (so->objfile)
{
if (strcmp (so->objfile->name, so->so_name) == 0)
return;
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
}
sap = build_section_addr_info_from_section_table (so->sections,
so->sections_end);
so->objfile = symbol_file_add_from_bfd (so->abfd, flags, sap, OBJF_SHARED);
free_section_addr_info (sap);
return;
}
/* Read in symbols for shared object SO. If SYMFILE_VERBOSE is set in FLAGS,
be chatty about it. Return non-zero if any symbols were actually
loaded. */
int
solib_read_symbols (struct so_list *so, int flags)
{
const int from_tty = flags & SYMFILE_VERBOSE;
if (so->symbols_loaded)
{
if (from_tty || info_verbose)
printf_unfiltered (_("Symbols already loaded for %s\n"), so->so_name);
}
else if (so->abfd == NULL)
{
if (from_tty || info_verbose)
printf_unfiltered (_("Symbol file not found for %s\n"), so->so_name);
}
else
{
volatile struct gdb_exception exception;
TRY_CATCH (exception, RETURN_MASK_ALL)
{
symbol_add_stub (so, flags);
}
if (exception.reason != 0)
{
exception_fprintf (gdb_stderr, exception,
"Error while reading shared library symbols:\n");
return 0;
}
if (from_tty || info_verbose)
printf_unfiltered (_("Loaded symbols for %s\n"), so->so_name);
so->symbols_loaded = 1;
return 1;
}
return 0;
}
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
/* LOCAL FUNCTION
update_solib_list --- synchronize GDB's shared object list with inferior's
1999-07-07 22:19:36 +02:00
SYNOPSIS
void update_solib_list (int from_tty, struct target_ops *TARGET)
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
Extract the list of currently loaded shared objects from the
inferior, and compare it with the list of shared objects currently
in GDB's so_list_head list. Edit so_list_head to bring it in sync
with the inferior's new list.
If we notice that the inferior has unloaded some shared objects,
free any symbolic info GDB had read about those shared objects.
Don't load symbolic info for any new shared objects; just add them
to the list, and leave their symbols_loaded flag clear.
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
If FROM_TTY is non-null, feel free to print messages about what
we're doing.
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
If TARGET is non-null, add the sections of all new shared objects
to TARGET's section table. Note that this doesn't remove any
sections for shared objects that have been unloaded, and it
doesn't check to see if the new shared objects are already present in
the section table. But we only use this for core files and
processes we've just attached to, so that's okay. */
2003-06-11 Andrew Cagney <cagney@redhat.com> * xstormy16-tdep.c (xstormy16_push_return_address): Make static. (xstormy16_save_dummy_frame_tos): Make static. (_initialize_xstormy16_tdep): Add declaration. * vax-tdep.c (_initialize_vax_tdep): Add declaration. * v850-tdep.c: Make local functions static. (_initialize_v850_tdep): Add declaration. * sparc-tdep.c: Make local functions static. (_initialize_sparc_tdep): Add declaration. * sh-tdep.c: Make local functions static. (_initialize_sh_tdep): Add declaration. * sh3-rom.c (_initialize_sh3_rom): Add declaration. * s390-tdep.c: Make local functions static. (_initialize_s390_tdep): Add declaration. * dbxread.c (find_stab_function_addr): Make static. * ppc-bdm.c (_initialize_bdm_ppc): Add declaration. * ocd.c (_initialize_remote_ocd): Add declaration. * dink32-rom.c (_initialize_dink32_rom): Add declaration. * ppcbug-rom.c (_initialize_ppcbug_rom): Add declaration. * ns32k-tdep.c (_initialize_ns32k_tdep): Add declaration. * ns32knbsd-tdep.c (_initialize_ns32knbsd_tdep): Add declaration. * mips-tdep.c (_initialize_mips_tdep): Add declaration. * remote-array.c (_initialize_array): Add declaration. (_initialize_remote_monitors): Add declaration. * remote-mips.c: Make local functions static. (_initialize_remote_mips): Add declaration. * mcore-tdep.c: Make all local functions static. (_initialize_mcore_tdep): Add declaration. * dbug-rom.c (_initialize_dbug_rom): Add declaration. * abug-rom.c (_initialize_abug_rom): Add declaration. * rom68k-rom.c (_initialize_rom68k): Add declaration. * cpu32bug-rom.c (_initialize_cpu32bug_rom): Add declaration. * m68k-tdep.c (_initialize_m68k_tdep): Add declaration. * remote-est.c (_initialize_est): Add declaration. * m68hc11-tdep.c (_initialize_m68hc11_tdep): Add declaration. (m68hc11_call_dummy_address): Make static. * ia64-tdep.c: Make local functions static. (_initialize_ia64_tdep): Add declaration. * solib-legacy.c (_initialize_svr4_lm): Add declaration. * monitor.c (monitor_wait_filter): Make static. (_initialize_remote_monitors): Add declaration. * remote-hms.c (_initialize_remote_hms): Add declaration. * remote-e7000.c (fetch_regs_from_dump): Make static. (expect_n): Make static. (_initialize_remote_e7000): Add declaration. * ser-e7kpc.c: Always include "defs.h". (_initialize_ser_e7000pc): Add declaration. * h8300-tdep.c (_initialize_h8300_tdep): Add declaration. * cris-tdep.c: Make all but one function static. (_initialize_cris_tdep): Add declaration. * solib-svr4.c (_initialize_svr4_solib): Add declaration. * solib.c (update_solib_list): Make static. (_initialize_solib): Add declaration. * avr-tdep.c (avr_breakpoint_from_pc): Make static. (_initialize_avr_tdep): Add declaration. * remote-rdi.c (voiddummy): Make static. (_initialize_remote_rdi): Add declaration. * arm-tdep.c (_initialize_arm_tdep): Add declaration. * remote-rdp.c (send_rdp): Make static. (_initialize_remote_rdp): Add declaration. * alpha-tdep.c (_initialize_alpha_tdep): Add declaration.
2003-06-11 15:16:30 +02:00
static void
update_solib_list (int from_tty, struct target_ops *target)
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
{
* gdbarch.sh (target_gdbarch): New global variable. (deprecated_current_gdbarch_select_hack): Set it. * gdbarch.c, gdbarch.h: Regenerate. * arch-utils.c (gdbarch_update_p): Use target_gdbarch instead of current_gdbarch. * target-descriptions.c (target_find_description): Likewise. * arm-tdep.c (arm_update_current_architecture): Likewise. (show_fp_model, arm_show_abi, arm_show_fallback_mode, arm_show_force_mode): Likewise. * mips-tdep.c (show_mask_address, show_mipsfpu_command, show_mips_abi): Likewise. * mep-tdep.c (me_module_register_set, current_me_module): Likewise. * target.c (target_translate_tls_address): Use target_gdbarch instead of current_gdbarch. * remote.c (struct packet_reg): Likewise. (get_remote_arch_state, packet_reg_from_regnum, packet_reg_from_pnum, remote_check_symbols, remote_wait, remote_address_masked, remote_insert_breakpoint, remote_insert_hw_breakpoint, remote_read_description): Likewise. * remote-m32r-sdi.c (m32r_resume, m32r_wait): Likewise. * remote-mips.c (mips_open, mips_common_breakpoint): Likewise. * cris-tdep.c (cris_can_use_hardware_watchpoint): Likewise. * solib.c (solib_open, solib_map_sections, solib_read_symbols, solib_add, info_sharedlibrary_command, solib_address, solib_create_inferior_hook, in_solib_dynsym_resolve_code, solib_global_lookup): Likewise. * solib-frv.c (enable_break2, frv_relocate_main_executable): Likewise. * solib-irix.c (irix_current_sos, irix_open_symbol_file_object): Likewise. * solib-sunos.c (sunos_solib_create_inferior_hook): Likewise. * solib-svr4.c (exec_entry_point, enable_break, svr4_free_so, set_solib_svr4_fetch_link_map_offsets, svr4_fetch_link_map_offsets): Likewise. * nto-tdep.c (nto_find_and_open_solib, nto_init_solib_absolute_prefix, nto_truncate_ptr): Likewise. * mips-linux-tdep.c (mips_linux_in_dynsym_stub): Likewise.
2008-08-26 19:21:29 +02:00
struct target_so_ops *ops = solib_ops (target_gdbarch);
struct so_list *inferior = ops->current_sos();
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
struct so_list *gdb, **gdb_link;
Remove the attach_flag global, and make it per-inferior. * inferior.h (attach_flag): Delete. (inferior_process): Declare. * solib.c (update_solib_list): Adjust. * gnu-nat.c (gnu_create_inferior, gnu_attach): Adjust. * inf-ptrace.c (inf_ptrace_detach): Adjust. (inf_ptrace_files_info): Get it from the current inferior. * inf-ttrace.c (inf_ttrace_attach): Adjust. (inf_ttrace_files_info): Get it from the current inferior. * inflow.c (terminal_inferior, terminal_ours_1, set_sigint_trap) (clear_sigint_trap): Get it from the current process. * remote.c (extended_remote_attach_1) (extended_remote_create_inferior_1): Adjust. * top.c (quit_confirm, quit_target): Get it from the current inferior. * procfs.c (do_detach): Adjust. (procfs_wait): Get it from the event inferior. (procfs_files_info): Get it from the current inferior. * nto-procfs.c (procfs_files_info): Likewise. (procfs_attach): Adjust. Set the attach_flag here. (do_attach): Don't set it here. (procfs_detach): Don't clear it. (procfs_mourn_inferior): Don't clear it. * solib-osf.c (osf_solib_create_inferior_hook): Adjust. * target.c (attach_flag): Delete. (generic_mourn_inferior): Don't clear it. * win32-nat.c (get_win32_debug_event): Get it from the event process. (do_initial_win32_stuff): Add attaching argument. Set attach_flag in the inferior accordingly. (win32_attach): Don't set the attach_flag here. Pass 1 to do_intial_win32_stuff. (win32_files_info): Get it from the current inferior. (win32_create_inferior): Dont clear attach_flag here. Pass 0 to do_intial_win32_stuff.
2008-09-22 17:21:30 +02:00
/* We can reach here due to changing solib-search-path or the
sysroot, before having any inferior. */
if (target_has_execution && !ptid_equal (inferior_ptid, null_ptid))
Remove the attach_flag global, and make it per-inferior. * inferior.h (attach_flag): Delete. (inferior_process): Declare. * solib.c (update_solib_list): Adjust. * gnu-nat.c (gnu_create_inferior, gnu_attach): Adjust. * inf-ptrace.c (inf_ptrace_detach): Adjust. (inf_ptrace_files_info): Get it from the current inferior. * inf-ttrace.c (inf_ttrace_attach): Adjust. (inf_ttrace_files_info): Get it from the current inferior. * inflow.c (terminal_inferior, terminal_ours_1, set_sigint_trap) (clear_sigint_trap): Get it from the current process. * remote.c (extended_remote_attach_1) (extended_remote_create_inferior_1): Adjust. * top.c (quit_confirm, quit_target): Get it from the current inferior. * procfs.c (do_detach): Adjust. (procfs_wait): Get it from the event inferior. (procfs_files_info): Get it from the current inferior. * nto-procfs.c (procfs_files_info): Likewise. (procfs_attach): Adjust. Set the attach_flag here. (do_attach): Don't set it here. (procfs_detach): Don't clear it. (procfs_mourn_inferior): Don't clear it. * solib-osf.c (osf_solib_create_inferior_hook): Adjust. * target.c (attach_flag): Delete. (generic_mourn_inferior): Don't clear it. * win32-nat.c (get_win32_debug_event): Get it from the event process. (do_initial_win32_stuff): Add attaching argument. Set attach_flag in the inferior accordingly. (win32_attach): Don't set the attach_flag here. Pass 1 to do_intial_win32_stuff. (win32_files_info): Get it from the current inferior. (win32_create_inferior): Dont clear attach_flag here. Pass 0 to do_intial_win32_stuff.
2008-09-22 17:21:30 +02:00
{
struct inferior *inf = current_inferior ();
/* If we are attaching to a running process for which we
have not opened a symbol file, we may be able to get its
symbols now! */
if (inf->attach_flag && symfile_objfile == NULL)
catch_errors (ops->open_symbol_file_object, &from_tty,
"Error reading attached process's symbol file.\n",
RETURN_MASK_ALL);
}
1999-08-31 03:14:27 +02:00
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
/* GDB and the inferior's dynamic linker each maintain their own
list of currently loaded shared objects; we want to bring the
former in sync with the latter. Scan both lists, seeing which
shared objects appear where. There are three cases:
- A shared object appears on both lists. This means that GDB
knows about it already, and it's still loaded in the inferior.
Nothing needs to happen.
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
- A shared object appears only on GDB's list. This means that
the inferior has unloaded it. We should remove the shared
object from GDB's tables.
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
- A shared object appears only on the inferior's list. This
means that it's just been loaded. We should add it to GDB's
tables.
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
So we walk GDB's list, checking each entry to see if it appears
in the inferior's list too. If it does, no action is needed, and
we remove it from the inferior's list. If it doesn't, the
inferior has unloaded it, and we remove it from GDB's list. By
the time we're done walking GDB's list, the inferior's list
contains only the new shared objects, which we then add. */
gdb = so_list_head;
gdb_link = &so_list_head;
while (gdb)
{
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
struct so_list *i = inferior;
struct so_list **i_link = &inferior;
/* Check to see whether the shared object *gdb also appears in
the inferior's current list. */
while (i)
{
if (ops->same)
{
if (ops->same (gdb, i))
break;
}
else
{
if (! strcmp (gdb->so_original_name, i->so_original_name))
break;
}
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
i_link = &i->next;
i = *i_link;
}
1999-07-07 22:19:36 +02:00
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
/* If the shared object appears on the inferior's list too, then
it's still loaded, so we don't need to do anything. Delete
it from the inferior's list, and leave it on GDB's list. */
if (i)
{
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
*i_link = i->next;
free_so (i);
gdb_link = &gdb->next;
gdb = *gdb_link;
}
/* If it's not on the inferior's list, remove it from GDB's tables. */
else
{
/* Notify any observer that the shared object has been
unloaded before we remove it from GDB's tables. */
observer_notify_solib_unloaded (gdb);
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
*gdb_link = gdb->next;
/* Unless the user loaded it explicitly, free SO's objfile. */
if (gdb->objfile && ! (gdb->objfile->flags & OBJF_USERLOADED))
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
free_objfile (gdb->objfile);
/* Some targets' section tables might be referring to
sections from so->abfd; remove them. */
remove_target_sections (gdb->abfd);
free_so (gdb);
gdb = *gdb_link;
}
}
1999-07-07 22:19:36 +02:00
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
/* Now the inferior's list contains only shared objects that don't
appear in GDB's list --- those that are newly loaded. Add them
to GDB's shared object list. */
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
if (inferior)
{
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
struct so_list *i;
/* Add the new shared objects to GDB's list. */
*gdb_link = inferior;
/* Fill in the rest of each of the `struct so_list' nodes. */
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
for (i = inferior; i; i = i->next)
{
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
i->from_tty = from_tty;
/* Fill in the rest of the `struct so_list' node. */
catch_errors (solib_map_sections, i,
"Error while mapping shared library sections:\n",
RETURN_MASK_ALL);
* target.c: Include "exec.h". (update_current_target): Don't inherit to_sections or to_sections_end. (target_get_section_table): New. (target_section_by_addr): Fetch the section table from the passed in target. (memory_xfer_partial): Handle unmapped overlay sections before anything else. Get the overlay mapped address here. Adjust to use section_table_xfer_memory_partial. (get_target_memory): Request a TARGET_OBJECT_RAW_MEMORY object instead of TARGET_OBJECT_MEMORY. (target_resize_to_sections): Delete. (remove_target_sections): Adjust to remove target sections from `current_target_sections', and use resize_section_table. * target.h (struct target_ops) <to_sections, to_sections_end>: Remove fields. <to_get_section_table>: New method. (xfer_memory, print_section_info): Delete declarations. (struct target_section_table): New type. (target_get_section_table): Declare. (target_resize_to_sections): Delete declaration. (remove_target_sections): Delete declaration. * bfd-target.c (target_bfd_xfer_partial): Get the section table from to_data. (target_bfd_get_section_table): New. (target_bfd_xclose): Adjust. (target_bfd_reopen): Store the section table in the to_data field. * corelow.c (core_data): New. (core_close): Adjust to release core_data and its sections. (core_open): Allocate core_data, and build its target sections table. (deprecated_core_resize_section_table): New. (core_files_info): Pass core_data to print_section_info. (core_xfer_partial): Adjust to use section_table_xfer_memory_partial for TARGET_OBJECT_MEMORY xfers. (init_core_ops): Do not install a deprecated_xfer_memory callback anymore. * solib.c (update_solib_list): Add the shared library sections to the current target sections table. * exec.c (current_target_sections_1): New global. (current_target_sections): New global. (exec_close_1): New function, refactored from exec_close. Remove the exec_bfd's sections from the current target sections table. Adjust to not use to_sections. (exec_close): Remove all target sections. Call exec_close_1. (exec_file_clear): Use exec_close_1 instead of unpushing the target. (exec_file_attach): Likewise. Adjust to not use to_sections. Add exec_bfd's sections to the current target sections table. Don't push the exec_ops target here. (resize_section_table): New. (add_target_sections): New. (remove_target_sections): Moved here. (section_table_xfer_memory): Adjust to implement the xfer_partial interface, and rename to... (section_table_xfer_memory_partial): ... this, replacing the current function of that same name. (exec_get_section_table): New. (exec_xfer_partial): New. (xfer_memory): Delete. (print_section_info): Replace the target_ops parameter by a target_section_table parameter. (exec_files_info, set_section_command, exec_set_section_address): Adjust to use the current sections table. (init_exec_ops): Do not register a deprecated_xfer_memory callback. Register to_xfer_partial and to_get_section_table callbacks. * infrun.c (handle_inferior_event): Update comments around solib_add. * rs6000-nat.c (xcoff_relocate_core): Adjust to use deprecated_core_resize_section_table. * exec.h (resize_section_table): Declare. (section_table_xfer_memory_partial): Add const char * argument. (remove_target_sections): Declare here. (add_target_sections): Declare. (print_section_info): Declare here. * gdbcore.h (deprecated_core_resize_section_table): Declare.
2009-06-03 20:50:36 +02:00
/* Add the shared object's sections to the current set of
file section tables. Do this immediately after mapping
the object so that later nodes in the list can query this
object, as is needed in solib-osf.c. */
add_target_sections (i->sections, i->sections_end);
/* Notify any observer that the shared object has been
loaded now that we've added it to GDB's tables. */
observer_notify_solib_loaded (i);
}
}
}
/* Return non-zero if NAME is the libpthread shared library.
Uses a fairly simplistic heuristic approach where we check
the file name against "/libpthread". This can lead to false
positives, but this should be good enough in practice. */
int
libpthread_name_p (const char *name)
{
return (strstr (name, "/libpthread") != NULL);
}
/* Return non-zero if SO is the libpthread shared library. */
static int
libpthread_solib_p (struct so_list *so)
{
return libpthread_name_p (so->so_name);
}
/* GLOBAL FUNCTION
solib_add -- read in symbol info for newly added shared libraries
SYNOPSIS
Approved by kev@cygnus.com ChangeLog entry: 2001-11-01 Fred Fish <fnf@redhat.com> * coff-solib.c (coff_solib_add): Add new readsyms arg. * irix5-nat.c (solib_add): Ditto. * osfsolib.c (solib_add): Ditto. * pa64solib.c (pa64_solib_add): Ditto. * pa64solib.c (add_to_solist): Ditto. * pa64solib.c (read_dld_descriptor): Ditto. * solib.c (solib_add): Ditto. * somsolib.c (som_solib_add): Ditto. * win32-nat.c (child_solib_add): Ditto. * xcoffsolib.c (solib_add): Ditto. * coff-solib.h (coff_solib_add): Add new readsyms arg to prototype. * pa64solib.c (add_to_solist): Ditto. * pa64solib.c (read_dld_descriptor): Ditto. * pa64solib.h (pa64_solib_add): Ditto. * solib.h (solib_add): Ditto. * somsolib.h (som_solib_add): Ditto. * config/i386/tm-cygwin.h (child_solib_add): Ditto. * coff-solib.c (coff_solib_add): If readsyms is zero don't read symbols but do any other needed work for shared libs. * irix5-nat.c: Ditto. * osfsolib.c (solib_add): Ditto. * solib.c (solib_add): Ditto. * win32-nat.c (child_solib_add): Ditto. * xcoffsolib.c (solib_add): Ditto. * irix5-nat.c (sharedlibrary_command): Pass 1 as readsyms to solib_add to force reading of shared library symbols. * osfsolib.c (sharedlibrary_command;): Ditto. * pa64solib.c (pa64_solib_sharedlibrary_command): Ditto. * solib.c (sharedlibrary_command): Ditto. * somsolib.c (som_solib_sharedlibrary_command): Ditto. * xcoffsolib.c (sharedlibrary_command): Ditto. * coff-solib.c (coff_solib_create_inferior_hook): Call solib_add unconditionally with auto_solib_add. * irix5-nat.c (solib_create_inferior_hook): Ditto. * osfsolib.c (solib_create_inferior_hook): Ditto. * solib.c (solib_create_inferior_hook): Ditto. * solib-osf.c (osf_solib_create_inferior_hook): Ditto. * solib-svr4.c (enable_break): Ditto. * solib-sunos.c (sunos_solib_create_inferior_hook): Ditto. * corelow.c (solib_add_stub): Add auto_solib_add to args passed via SOLIB_ADD. * sol-thread.c (sol_thread_attach): Ditto. * config/rs6000/nm-rs6000.h (SOLIB_ADD): Ditto. * infcmd.c (attach_command): Remove auto_solib_add decl. Call SOLIB_ADD directly with auto_solib_add. * infrun.c (handle_inferior_event): Ditto. * coff-solib.h (SOLIB_ADD): Add readsyms arg. * pa64solib.h (SOLIB_ADD): Ditto. * solib.h (SOLIB_ADD): Ditto. * somsolib.h (SOLIB_ADD): Ditto. * config/i386/tm-cygwin.h (SOLIB_ADD): Ditto. * fork-child.c (clone_and_follow_inferior): Remove unused auto_solib_add decl. * pa64solib.c (pa64_solib_add): Call add_to_solist with readsyms. (read_dld_descriptor): Ditto. (pa64_solib_add): Call read_dld_descriptor with readsyms. (pa64_solib_in_dynamic_linker): Ditto. * corelow.c (symfile.h): Need this for auto_solib_add declaration. * sol-thread.c (symfile.h): Ditto. Approved by eliz@is.elta.co.il doc/ChangeLog entry: 2001-11-01 Fred Fish <fnf@redhat.com> * gdbint.texinfo (SOLIB_ADD): Document additional new "readsyms" arg.
2001-11-01 17:17:08 +01:00
void solib_add (char *pattern, int from_tty, struct target_ops
*TARGET, int readsyms)
DESCRIPTION
Read in symbolic information for any shared objects whose names
match PATTERN. (If we've already read a shared object's symbol
info, leave it alone.) If PATTERN is zero, read them all.
Approved by kev@cygnus.com ChangeLog entry: 2001-11-01 Fred Fish <fnf@redhat.com> * coff-solib.c (coff_solib_add): Add new readsyms arg. * irix5-nat.c (solib_add): Ditto. * osfsolib.c (solib_add): Ditto. * pa64solib.c (pa64_solib_add): Ditto. * pa64solib.c (add_to_solist): Ditto. * pa64solib.c (read_dld_descriptor): Ditto. * solib.c (solib_add): Ditto. * somsolib.c (som_solib_add): Ditto. * win32-nat.c (child_solib_add): Ditto. * xcoffsolib.c (solib_add): Ditto. * coff-solib.h (coff_solib_add): Add new readsyms arg to prototype. * pa64solib.c (add_to_solist): Ditto. * pa64solib.c (read_dld_descriptor): Ditto. * pa64solib.h (pa64_solib_add): Ditto. * solib.h (solib_add): Ditto. * somsolib.h (som_solib_add): Ditto. * config/i386/tm-cygwin.h (child_solib_add): Ditto. * coff-solib.c (coff_solib_add): If readsyms is zero don't read symbols but do any other needed work for shared libs. * irix5-nat.c: Ditto. * osfsolib.c (solib_add): Ditto. * solib.c (solib_add): Ditto. * win32-nat.c (child_solib_add): Ditto. * xcoffsolib.c (solib_add): Ditto. * irix5-nat.c (sharedlibrary_command): Pass 1 as readsyms to solib_add to force reading of shared library symbols. * osfsolib.c (sharedlibrary_command;): Ditto. * pa64solib.c (pa64_solib_sharedlibrary_command): Ditto. * solib.c (sharedlibrary_command): Ditto. * somsolib.c (som_solib_sharedlibrary_command): Ditto. * xcoffsolib.c (sharedlibrary_command): Ditto. * coff-solib.c (coff_solib_create_inferior_hook): Call solib_add unconditionally with auto_solib_add. * irix5-nat.c (solib_create_inferior_hook): Ditto. * osfsolib.c (solib_create_inferior_hook): Ditto. * solib.c (solib_create_inferior_hook): Ditto. * solib-osf.c (osf_solib_create_inferior_hook): Ditto. * solib-svr4.c (enable_break): Ditto. * solib-sunos.c (sunos_solib_create_inferior_hook): Ditto. * corelow.c (solib_add_stub): Add auto_solib_add to args passed via SOLIB_ADD. * sol-thread.c (sol_thread_attach): Ditto. * config/rs6000/nm-rs6000.h (SOLIB_ADD): Ditto. * infcmd.c (attach_command): Remove auto_solib_add decl. Call SOLIB_ADD directly with auto_solib_add. * infrun.c (handle_inferior_event): Ditto. * coff-solib.h (SOLIB_ADD): Add readsyms arg. * pa64solib.h (SOLIB_ADD): Ditto. * solib.h (SOLIB_ADD): Ditto. * somsolib.h (SOLIB_ADD): Ditto. * config/i386/tm-cygwin.h (SOLIB_ADD): Ditto. * fork-child.c (clone_and_follow_inferior): Remove unused auto_solib_add decl. * pa64solib.c (pa64_solib_add): Call add_to_solist with readsyms. (read_dld_descriptor): Ditto. (pa64_solib_add): Call read_dld_descriptor with readsyms. (pa64_solib_in_dynamic_linker): Ditto. * corelow.c (symfile.h): Need this for auto_solib_add declaration. * sol-thread.c (symfile.h): Ditto. Approved by eliz@is.elta.co.il doc/ChangeLog entry: 2001-11-01 Fred Fish <fnf@redhat.com> * gdbint.texinfo (SOLIB_ADD): Document additional new "readsyms" arg.
2001-11-01 17:17:08 +01:00
If READSYMS is 0, defer reading symbolic information until later
but still do any needed low level processing.
FROM_TTY and TARGET are as described for update_solib_list, above. */
void
Approved by kev@cygnus.com ChangeLog entry: 2001-11-01 Fred Fish <fnf@redhat.com> * coff-solib.c (coff_solib_add): Add new readsyms arg. * irix5-nat.c (solib_add): Ditto. * osfsolib.c (solib_add): Ditto. * pa64solib.c (pa64_solib_add): Ditto. * pa64solib.c (add_to_solist): Ditto. * pa64solib.c (read_dld_descriptor): Ditto. * solib.c (solib_add): Ditto. * somsolib.c (som_solib_add): Ditto. * win32-nat.c (child_solib_add): Ditto. * xcoffsolib.c (solib_add): Ditto. * coff-solib.h (coff_solib_add): Add new readsyms arg to prototype. * pa64solib.c (add_to_solist): Ditto. * pa64solib.c (read_dld_descriptor): Ditto. * pa64solib.h (pa64_solib_add): Ditto. * solib.h (solib_add): Ditto. * somsolib.h (som_solib_add): Ditto. * config/i386/tm-cygwin.h (child_solib_add): Ditto. * coff-solib.c (coff_solib_add): If readsyms is zero don't read symbols but do any other needed work for shared libs. * irix5-nat.c: Ditto. * osfsolib.c (solib_add): Ditto. * solib.c (solib_add): Ditto. * win32-nat.c (child_solib_add): Ditto. * xcoffsolib.c (solib_add): Ditto. * irix5-nat.c (sharedlibrary_command): Pass 1 as readsyms to solib_add to force reading of shared library symbols. * osfsolib.c (sharedlibrary_command;): Ditto. * pa64solib.c (pa64_solib_sharedlibrary_command): Ditto. * solib.c (sharedlibrary_command): Ditto. * somsolib.c (som_solib_sharedlibrary_command): Ditto. * xcoffsolib.c (sharedlibrary_command): Ditto. * coff-solib.c (coff_solib_create_inferior_hook): Call solib_add unconditionally with auto_solib_add. * irix5-nat.c (solib_create_inferior_hook): Ditto. * osfsolib.c (solib_create_inferior_hook): Ditto. * solib.c (solib_create_inferior_hook): Ditto. * solib-osf.c (osf_solib_create_inferior_hook): Ditto. * solib-svr4.c (enable_break): Ditto. * solib-sunos.c (sunos_solib_create_inferior_hook): Ditto. * corelow.c (solib_add_stub): Add auto_solib_add to args passed via SOLIB_ADD. * sol-thread.c (sol_thread_attach): Ditto. * config/rs6000/nm-rs6000.h (SOLIB_ADD): Ditto. * infcmd.c (attach_command): Remove auto_solib_add decl. Call SOLIB_ADD directly with auto_solib_add. * infrun.c (handle_inferior_event): Ditto. * coff-solib.h (SOLIB_ADD): Add readsyms arg. * pa64solib.h (SOLIB_ADD): Ditto. * solib.h (SOLIB_ADD): Ditto. * somsolib.h (SOLIB_ADD): Ditto. * config/i386/tm-cygwin.h (SOLIB_ADD): Ditto. * fork-child.c (clone_and_follow_inferior): Remove unused auto_solib_add decl. * pa64solib.c (pa64_solib_add): Call add_to_solist with readsyms. (read_dld_descriptor): Ditto. (pa64_solib_add): Call read_dld_descriptor with readsyms. (pa64_solib_in_dynamic_linker): Ditto. * corelow.c (symfile.h): Need this for auto_solib_add declaration. * sol-thread.c (symfile.h): Ditto. Approved by eliz@is.elta.co.il doc/ChangeLog entry: 2001-11-01 Fred Fish <fnf@redhat.com> * gdbint.texinfo (SOLIB_ADD): Document additional new "readsyms" arg.
2001-11-01 17:17:08 +01:00
solib_add (char *pattern, int from_tty, struct target_ops *target, int readsyms)
{
struct so_list *gdb;
if (pattern)
{
char *re_err = re_comp (pattern);
if (re_err)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("Invalid regexp: %s"), re_err);
}
update_solib_list (from_tty, target);
/* Walk the list of currently loaded shared libraries, and read
symbols for any that match the pattern --- or any whose symbols
aren't already loaded, if no pattern was given. */
{
int any_matches = 0;
int loaded_any_symbols = 0;
const int flags =
SYMFILE_DEFER_BP_RESET | (from_tty ? SYMFILE_VERBOSE : 0);
for (gdb = so_list_head; gdb; gdb = gdb->next)
if (! pattern || re_exec (gdb->so_name))
{
/* Normally, we would read the symbols from that library
only if READSYMS is set. However, we're making a small
exception for the pthread library, because we sometimes
need the library symbols to be loaded in order to provide
thread support (x86-linux for instance). */
const int add_this_solib =
(readsyms || libpthread_solib_p (gdb));
any_matches = 1;
if (add_this_solib && solib_read_symbols (gdb, flags))
loaded_any_symbols = 1;
}
if (loaded_any_symbols)
breakpoint_re_set ();
if (from_tty && pattern && ! any_matches)
printf_unfiltered
("No loaded shared libraries match the pattern `%s'.\n", pattern);
if (loaded_any_symbols)
{
* gdbarch.sh (target_gdbarch): New global variable. (deprecated_current_gdbarch_select_hack): Set it. * gdbarch.c, gdbarch.h: Regenerate. * arch-utils.c (gdbarch_update_p): Use target_gdbarch instead of current_gdbarch. * target-descriptions.c (target_find_description): Likewise. * arm-tdep.c (arm_update_current_architecture): Likewise. (show_fp_model, arm_show_abi, arm_show_fallback_mode, arm_show_force_mode): Likewise. * mips-tdep.c (show_mask_address, show_mipsfpu_command, show_mips_abi): Likewise. * mep-tdep.c (me_module_register_set, current_me_module): Likewise. * target.c (target_translate_tls_address): Use target_gdbarch instead of current_gdbarch. * remote.c (struct packet_reg): Likewise. (get_remote_arch_state, packet_reg_from_regnum, packet_reg_from_pnum, remote_check_symbols, remote_wait, remote_address_masked, remote_insert_breakpoint, remote_insert_hw_breakpoint, remote_read_description): Likewise. * remote-m32r-sdi.c (m32r_resume, m32r_wait): Likewise. * remote-mips.c (mips_open, mips_common_breakpoint): Likewise. * cris-tdep.c (cris_can_use_hardware_watchpoint): Likewise. * solib.c (solib_open, solib_map_sections, solib_read_symbols, solib_add, info_sharedlibrary_command, solib_address, solib_create_inferior_hook, in_solib_dynsym_resolve_code, solib_global_lookup): Likewise. * solib-frv.c (enable_break2, frv_relocate_main_executable): Likewise. * solib-irix.c (irix_current_sos, irix_open_symbol_file_object): Likewise. * solib-sunos.c (sunos_solib_create_inferior_hook): Likewise. * solib-svr4.c (exec_entry_point, enable_break, svr4_free_so, set_solib_svr4_fetch_link_map_offsets, svr4_fetch_link_map_offsets): Likewise. * nto-tdep.c (nto_find_and_open_solib, nto_init_solib_absolute_prefix, nto_truncate_ptr): Likewise. * mips-linux-tdep.c (mips_linux_in_dynsym_stub): Likewise.
2008-08-26 19:21:29 +02:00
struct target_so_ops *ops = solib_ops (target_gdbarch);
/* Getting new symbols may change our opinion about what is
frameless. */
reinit_frame_cache ();
ops->special_symbol_handling ();
}
}
}
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
/*
1999-07-07 22:19:36 +02:00
LOCAL FUNCTION
1999-07-07 22:19:36 +02:00
info_sharedlibrary_command -- code for "info sharedlibrary"
1999-07-07 22:19:36 +02:00
SYNOPSIS
1999-07-07 22:19:36 +02:00
static void info_sharedlibrary_command ()
1999-07-07 22:19:36 +02:00
DESCRIPTION
1999-07-07 22:19:36 +02:00
Walk through the shared library list and print information
about each attached library matching PATTERN. If PATTERN is elided,
print them all.
1999-07-07 22:19:36 +02:00
*/
static void
info_sharedlibrary_command (char *pattern, int from_tty)
{
struct so_list *so = NULL; /* link map state variable */
int header_done = 0;
int so_missing_debug_info = 0;
int addr_width;
int nr_libs;
struct cleanup *table_cleanup;
struct gdbarch *gdbarch = target_gdbarch;
if (pattern)
{
char *re_err = re_comp (pattern);
if (re_err)
error (_("Invalid regexp: %s"), re_err);
}
/* "0x", a little whitespace, and two hex digits per byte of pointers. */
addr_width = 4 + (gdbarch_ptr_bit (gdbarch) / 4);
update_solib_list (from_tty, 0);
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
/* make_cleanup_ui_out_table_begin_end needs to know the number of
rows, so we need to make two passes over the libs. */
for (nr_libs = 0, so = so_list_head; so; so = so->next)
{
1999-07-07 22:19:36 +02:00
if (so->so_name[0])
{
if (pattern && ! re_exec (so->so_name))
continue;
++nr_libs;
}
}
table_cleanup =
make_cleanup_ui_out_table_begin_end (uiout, 4, nr_libs,
"SharedLibraryTable");
/* The "- 1" is because ui_out adds one space between columns. */
ui_out_table_header (uiout, addr_width - 1, ui_left, "from", "From");
ui_out_table_header (uiout, addr_width - 1, ui_left, "to", "To");
ui_out_table_header (uiout, 12 - 1, ui_left, "syms-read", "Syms Read");
ui_out_table_header (uiout, 0, ui_noalign,
"name", "Shared Object Library");
ui_out_table_body (uiout);
for (so = so_list_head; so; so = so->next)
{
struct cleanup *lib_cleanup;
if (! so->so_name[0])
continue;
if (pattern && ! re_exec (so->so_name))
continue;
lib_cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "lib");
if (so->addr_high != 0)
{
ui_out_field_core_addr (uiout, "from", gdbarch, so->addr_low);
ui_out_field_core_addr (uiout, "to", gdbarch, so->addr_high);
}
else
{
ui_out_field_skip (uiout, "from");
ui_out_field_skip (uiout, "to");
}
if (! ui_out_is_mi_like_p (interp_ui_out (top_level_interpreter ()))
&& so->symbols_loaded
&& !objfile_has_partial_symbols (so->objfile)
&& !objfile_has_full_symbols (so->objfile))
{
so_missing_debug_info = 1;
ui_out_field_string (uiout, "syms-read", "Yes (*)");
}
else
ui_out_field_string (uiout, "syms-read",
so->symbols_loaded ? "Yes" : "No");
ui_out_field_string (uiout, "name", so->so_name);
ui_out_text (uiout, "\n");
do_cleanups (lib_cleanup);
}
do_cleanups (table_cleanup);
if (nr_libs == 0)
{
if (pattern)
ui_out_message (uiout, 0,
_("No shared libraries matched.\n"));
else
ui_out_message (uiout, 0,
_("No shared libraries loaded at this time.\n"));
}
else
{
if (so_missing_debug_info)
ui_out_message (uiout, 0,
_("(*): Shared library is missing debugging information.\n"));
}
}
/* Return 1 if ADDRESS lies within SOLIB. */
int
solib_contains_address_p (const struct so_list *const solib,
CORE_ADDR address)
{
struct target_section *p;
for (p = solib->sections; p < solib->sections_end; p++)
if (p->addr <= address && address < p->endaddr)
return 1;
return 0;
}
/*
1999-07-07 22:19:36 +02:00
GLOBAL FUNCTION
solib_name_from_address -- if an address is in a shared lib, return
its name.
1999-07-07 22:19:36 +02:00
SYNOPSIS
char * solib_name_from_address (CORE_ADDR address)
1999-07-07 22:19:36 +02:00
DESCRIPTION
1999-07-07 22:19:36 +02:00
Provides a hook for other gdb routines to discover whether or
not a particular address is within the mapped address space of
2000-10-31 00:31:17 +01:00
a shared library.
1999-07-07 22:19:36 +02:00
For example, this routine is called at one point to disable
breakpoints which are in shared libraries that are not currently
mapped in.
*/
char *
solib_name_from_address (CORE_ADDR address)
{
struct so_list *so = 0; /* link map state variable */
1999-07-07 22:19:36 +02:00
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
for (so = so_list_head; so; so = so->next)
if (solib_contains_address_p (so, address))
return (so->so_name);
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
return (0);
}
/* Called by free_all_symtabs */
1999-07-07 22:19:36 +02:00
void
2000-07-30 03:48:28 +02:00
clear_solib (void)
{
* gdbarch.sh (target_gdbarch): New global variable. (deprecated_current_gdbarch_select_hack): Set it. * gdbarch.c, gdbarch.h: Regenerate. * arch-utils.c (gdbarch_update_p): Use target_gdbarch instead of current_gdbarch. * target-descriptions.c (target_find_description): Likewise. * arm-tdep.c (arm_update_current_architecture): Likewise. (show_fp_model, arm_show_abi, arm_show_fallback_mode, arm_show_force_mode): Likewise. * mips-tdep.c (show_mask_address, show_mipsfpu_command, show_mips_abi): Likewise. * mep-tdep.c (me_module_register_set, current_me_module): Likewise. * target.c (target_translate_tls_address): Use target_gdbarch instead of current_gdbarch. * remote.c (struct packet_reg): Likewise. (get_remote_arch_state, packet_reg_from_regnum, packet_reg_from_pnum, remote_check_symbols, remote_wait, remote_address_masked, remote_insert_breakpoint, remote_insert_hw_breakpoint, remote_read_description): Likewise. * remote-m32r-sdi.c (m32r_resume, m32r_wait): Likewise. * remote-mips.c (mips_open, mips_common_breakpoint): Likewise. * cris-tdep.c (cris_can_use_hardware_watchpoint): Likewise. * solib.c (solib_open, solib_map_sections, solib_read_symbols, solib_add, info_sharedlibrary_command, solib_address, solib_create_inferior_hook, in_solib_dynsym_resolve_code, solib_global_lookup): Likewise. * solib-frv.c (enable_break2, frv_relocate_main_executable): Likewise. * solib-irix.c (irix_current_sos, irix_open_symbol_file_object): Likewise. * solib-sunos.c (sunos_solib_create_inferior_hook): Likewise. * solib-svr4.c (exec_entry_point, enable_break, svr4_free_so, set_solib_svr4_fetch_link_map_offsets, svr4_fetch_link_map_offsets): Likewise. * nto-tdep.c (nto_find_and_open_solib, nto_init_solib_absolute_prefix, nto_truncate_ptr): Likewise. * mips-linux-tdep.c (mips_linux_in_dynsym_stub): Likewise.
2008-08-26 19:21:29 +02:00
struct target_so_ops *ops = solib_ops (target_gdbarch);
1999-06-28 18:06:02 +02:00
/* This function is expected to handle ELF shared libraries. It is
also used on Solaris, which can run either ELF or a.out binaries
(for compatibility with SunOS 4), both of which can use shared
libraries. So we don't know whether we have an ELF executable or
an a.out executable until the user chooses an executable file.
ELF shared libraries don't get mapped into the address space
until after the program starts, so we'd better not try to insert
breakpoints in them immediately. We have to wait until the
dynamic linker has loaded them; we'll hit a bp_shlib_event
breakpoint (look for calls to create_solib_event_breakpoint) when
it's ready.
SunOS shared libraries seem to be different --- they're present
as soon as the process begins execution, so there's no need to
put off inserting breakpoints. There's also nowhere to put a
bp_shlib_event breakpoint, so if we put it off, we'll never get
around to it.
So: disable breakpoints only if we're using ELF shared libs. */
if (exec_bfd != NULL
&& bfd_get_flavour (exec_bfd) != bfd_target_aout_flavour)
disable_breakpoints_in_shlibs ();
1999-06-28 18:06:02 +02:00
while (so_list_head)
{
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
struct so_list *so = so_list_head;
so_list_head = so->next;
observer_notify_solib_unloaded (so);
if (so->abfd)
remove_target_sections (so->abfd);
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
free_so (so);
}
Deal with the inferior unloading shared objects. * solib.c (current_sos): New function, replacing find_solib. (find_solib): Deleted. (free_so): New function. (clear_solib): Call free_so, instead of writing it out. (solib_add): Rewritten: compare the inferior's current list of shared objects with GDB's list, and do the required loads and unloads. (info_sharedlibrary_command, solib_address): Don't use find_solib to walk the list of shared libraries: call solib_add, and then walk the list at so_list_head normally. * objfiles.c (free_objfile): Don't call CLEAR_SOLIB, and don't detach the core target. These tasks are taken care of elsewhere. * target.c (remove_target_sections): New function. * target.h (remove_target_sections): New declaration. * solib.c (symbol_add_stub): Check whether we've already created an objfile for this shared object first, before doing all that work to compute section addresses, etc. * objfiles.c (unlink_objfile): Report an internal error if objfile doesn't occur in the object_files list. * solib.c (special_symbol_handling): Delete argument; it's not used. * solib.c (SOLIB_EXTRACT_ADDRESS): New macro to extract addresses from solib structures. Use it throughout solib.c, get rid of all CORE_ADDR casts. (struct so_list): Change type of lmaddr to CORE_ADDR. (first_link_map_member): Change return value type to CORE_ADDR, update callers. (solib_add_common_symbols): Change parameter type to CORE_ADDR, update callers. (open_symbol_file_object, find_solib): Change type of lm variable to CORE_ADDR.
2000-03-15 17:55:07 +01:00
ops->clear_solib ();
}
2000-10-24 22:05:36 +02:00
/* GLOBAL FUNCTION
1999-07-07 22:19:36 +02:00
solib_create_inferior_hook -- shared library startup support
SYNOPSIS
void solib_create_inferior_hook ()
1999-07-07 22:19:36 +02:00
DESCRIPTION
When gdb starts up the inferior, it nurses it along (through the
shell) until it is ready to execute it's first instruction. At this
point, this function gets called via expansion of the macro
2000-10-24 22:05:36 +02:00
SOLIB_CREATE_INFERIOR_HOOK. */
1999-07-07 22:19:36 +02:00
void
2000-07-30 03:48:28 +02:00
solib_create_inferior_hook (void)
{
* gdbarch.sh (target_gdbarch): New global variable. (deprecated_current_gdbarch_select_hack): Set it. * gdbarch.c, gdbarch.h: Regenerate. * arch-utils.c (gdbarch_update_p): Use target_gdbarch instead of current_gdbarch. * target-descriptions.c (target_find_description): Likewise. * arm-tdep.c (arm_update_current_architecture): Likewise. (show_fp_model, arm_show_abi, arm_show_fallback_mode, arm_show_force_mode): Likewise. * mips-tdep.c (show_mask_address, show_mipsfpu_command, show_mips_abi): Likewise. * mep-tdep.c (me_module_register_set, current_me_module): Likewise. * target.c (target_translate_tls_address): Use target_gdbarch instead of current_gdbarch. * remote.c (struct packet_reg): Likewise. (get_remote_arch_state, packet_reg_from_regnum, packet_reg_from_pnum, remote_check_symbols, remote_wait, remote_address_masked, remote_insert_breakpoint, remote_insert_hw_breakpoint, remote_read_description): Likewise. * remote-m32r-sdi.c (m32r_resume, m32r_wait): Likewise. * remote-mips.c (mips_open, mips_common_breakpoint): Likewise. * cris-tdep.c (cris_can_use_hardware_watchpoint): Likewise. * solib.c (solib_open, solib_map_sections, solib_read_symbols, solib_add, info_sharedlibrary_command, solib_address, solib_create_inferior_hook, in_solib_dynsym_resolve_code, solib_global_lookup): Likewise. * solib-frv.c (enable_break2, frv_relocate_main_executable): Likewise. * solib-irix.c (irix_current_sos, irix_open_symbol_file_object): Likewise. * solib-sunos.c (sunos_solib_create_inferior_hook): Likewise. * solib-svr4.c (exec_entry_point, enable_break, svr4_free_so, set_solib_svr4_fetch_link_map_offsets, svr4_fetch_link_map_offsets): Likewise. * nto-tdep.c (nto_find_and_open_solib, nto_init_solib_absolute_prefix, nto_truncate_ptr): Likewise. * mips-linux-tdep.c (mips_linux_in_dynsym_stub): Likewise.
2008-08-26 19:21:29 +02:00
struct target_so_ops *ops = solib_ops (target_gdbarch);
ops->solib_create_inferior_hook();
}
/* GLOBAL FUNCTION
in_solib_dynsym_resolve_code -- check to see if an address is in
dynamic loader's dynamic symbol
resolution code
SYNOPSIS
int in_solib_dynsym_resolve_code (CORE_ADDR pc)
DESCRIPTION
Determine if PC is in the dynamic linker's symbol resolution
code. Return 1 if so, 0 otherwise.
*/
int
in_solib_dynsym_resolve_code (CORE_ADDR pc)
{
* gdbarch.sh (target_gdbarch): New global variable. (deprecated_current_gdbarch_select_hack): Set it. * gdbarch.c, gdbarch.h: Regenerate. * arch-utils.c (gdbarch_update_p): Use target_gdbarch instead of current_gdbarch. * target-descriptions.c (target_find_description): Likewise. * arm-tdep.c (arm_update_current_architecture): Likewise. (show_fp_model, arm_show_abi, arm_show_fallback_mode, arm_show_force_mode): Likewise. * mips-tdep.c (show_mask_address, show_mipsfpu_command, show_mips_abi): Likewise. * mep-tdep.c (me_module_register_set, current_me_module): Likewise. * target.c (target_translate_tls_address): Use target_gdbarch instead of current_gdbarch. * remote.c (struct packet_reg): Likewise. (get_remote_arch_state, packet_reg_from_regnum, packet_reg_from_pnum, remote_check_symbols, remote_wait, remote_address_masked, remote_insert_breakpoint, remote_insert_hw_breakpoint, remote_read_description): Likewise. * remote-m32r-sdi.c (m32r_resume, m32r_wait): Likewise. * remote-mips.c (mips_open, mips_common_breakpoint): Likewise. * cris-tdep.c (cris_can_use_hardware_watchpoint): Likewise. * solib.c (solib_open, solib_map_sections, solib_read_symbols, solib_add, info_sharedlibrary_command, solib_address, solib_create_inferior_hook, in_solib_dynsym_resolve_code, solib_global_lookup): Likewise. * solib-frv.c (enable_break2, frv_relocate_main_executable): Likewise. * solib-irix.c (irix_current_sos, irix_open_symbol_file_object): Likewise. * solib-sunos.c (sunos_solib_create_inferior_hook): Likewise. * solib-svr4.c (exec_entry_point, enable_break, svr4_free_so, set_solib_svr4_fetch_link_map_offsets, svr4_fetch_link_map_offsets): Likewise. * nto-tdep.c (nto_find_and_open_solib, nto_init_solib_absolute_prefix, nto_truncate_ptr): Likewise. * mips-linux-tdep.c (mips_linux_in_dynsym_stub): Likewise.
2008-08-26 19:21:29 +02:00
struct target_so_ops *ops = solib_ops (target_gdbarch);
return ops->in_dynsym_resolve_code (pc);
}
/*
1999-07-07 22:19:36 +02:00
LOCAL FUNCTION
1999-07-07 22:19:36 +02:00
sharedlibrary_command -- handle command to explicitly add library
1999-07-07 22:19:36 +02:00
SYNOPSIS
1999-07-07 22:19:36 +02:00
static void sharedlibrary_command (char *args, int from_tty)
1999-07-07 22:19:36 +02:00
DESCRIPTION
1999-07-07 22:19:36 +02:00
*/
static void
2000-07-30 03:48:28 +02:00
sharedlibrary_command (char *args, int from_tty)
{
dont_repeat ();
Approved by kev@cygnus.com ChangeLog entry: 2001-11-01 Fred Fish <fnf@redhat.com> * coff-solib.c (coff_solib_add): Add new readsyms arg. * irix5-nat.c (solib_add): Ditto. * osfsolib.c (solib_add): Ditto. * pa64solib.c (pa64_solib_add): Ditto. * pa64solib.c (add_to_solist): Ditto. * pa64solib.c (read_dld_descriptor): Ditto. * solib.c (solib_add): Ditto. * somsolib.c (som_solib_add): Ditto. * win32-nat.c (child_solib_add): Ditto. * xcoffsolib.c (solib_add): Ditto. * coff-solib.h (coff_solib_add): Add new readsyms arg to prototype. * pa64solib.c (add_to_solist): Ditto. * pa64solib.c (read_dld_descriptor): Ditto. * pa64solib.h (pa64_solib_add): Ditto. * solib.h (solib_add): Ditto. * somsolib.h (som_solib_add): Ditto. * config/i386/tm-cygwin.h (child_solib_add): Ditto. * coff-solib.c (coff_solib_add): If readsyms is zero don't read symbols but do any other needed work for shared libs. * irix5-nat.c: Ditto. * osfsolib.c (solib_add): Ditto. * solib.c (solib_add): Ditto. * win32-nat.c (child_solib_add): Ditto. * xcoffsolib.c (solib_add): Ditto. * irix5-nat.c (sharedlibrary_command): Pass 1 as readsyms to solib_add to force reading of shared library symbols. * osfsolib.c (sharedlibrary_command;): Ditto. * pa64solib.c (pa64_solib_sharedlibrary_command): Ditto. * solib.c (sharedlibrary_command): Ditto. * somsolib.c (som_solib_sharedlibrary_command): Ditto. * xcoffsolib.c (sharedlibrary_command): Ditto. * coff-solib.c (coff_solib_create_inferior_hook): Call solib_add unconditionally with auto_solib_add. * irix5-nat.c (solib_create_inferior_hook): Ditto. * osfsolib.c (solib_create_inferior_hook): Ditto. * solib.c (solib_create_inferior_hook): Ditto. * solib-osf.c (osf_solib_create_inferior_hook): Ditto. * solib-svr4.c (enable_break): Ditto. * solib-sunos.c (sunos_solib_create_inferior_hook): Ditto. * corelow.c (solib_add_stub): Add auto_solib_add to args passed via SOLIB_ADD. * sol-thread.c (sol_thread_attach): Ditto. * config/rs6000/nm-rs6000.h (SOLIB_ADD): Ditto. * infcmd.c (attach_command): Remove auto_solib_add decl. Call SOLIB_ADD directly with auto_solib_add. * infrun.c (handle_inferior_event): Ditto. * coff-solib.h (SOLIB_ADD): Add readsyms arg. * pa64solib.h (SOLIB_ADD): Ditto. * solib.h (SOLIB_ADD): Ditto. * somsolib.h (SOLIB_ADD): Ditto. * config/i386/tm-cygwin.h (SOLIB_ADD): Ditto. * fork-child.c (clone_and_follow_inferior): Remove unused auto_solib_add decl. * pa64solib.c (pa64_solib_add): Call add_to_solist with readsyms. (read_dld_descriptor): Ditto. (pa64_solib_add): Call read_dld_descriptor with readsyms. (pa64_solib_in_dynamic_linker): Ditto. * corelow.c (symfile.h): Need this for auto_solib_add declaration. * sol-thread.c (symfile.h): Ditto. Approved by eliz@is.elta.co.il doc/ChangeLog entry: 2001-11-01 Fred Fish <fnf@redhat.com> * gdbint.texinfo (SOLIB_ADD): Document additional new "readsyms" arg.
2001-11-01 17:17:08 +01:00
solib_add (args, from_tty, (struct target_ops *) 0, 1);
}
/* LOCAL FUNCTION
no_shared_libraries -- handle command to explicitly discard symbols
from shared libraries.
DESCRIPTION
Implements the command "nosharedlibrary", which discards symbols
that have been auto-loaded from shared libraries. Symbols from
shared libraries that were added by explicit request of the user
are not discarded. Also called from remote.c. */
void
no_shared_libraries (char *ignored, int from_tty)
{
/* The order of the two routines below is important: clear_solib notifies
the solib_unloaded observers, and some of these observers might need
access to their associated objfiles. Therefore, we can not purge the
solibs' objfiles before clear_solib has been called. */
clear_solib ();
objfile_purge_solibs ();
}
static void
reload_shared_libraries (char *ignored, int from_tty,
struct cmd_list_element *e)
{
no_shared_libraries (NULL, from_tty);
solib_add (NULL, from_tty, NULL, auto_solib_add);
/* Creating inferior hooks here has two purposes. First, if we reload
shared libraries then the address of solib breakpoint we've computed
previously might be no longer valid. For example, if we forgot to set
solib-absolute-prefix and are setting it right now, then the previous
breakpoint address is plain wrong. Second, installing solib hooks
also implicitly figures were ld.so is and loads symbols for it.
Absent this call, if we've just connected to a target and set
solib-absolute-prefix or solib-search-path, we'll lose all information
about ld.so. */
if (target_has_execution)
{
#ifdef SOLIB_CREATE_INFERIOR_HOOK
SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid));
#else
solib_create_inferior_hook ();
#endif
}
/* We have unloaded and then reloaded debug info for all shared libraries.
However, frames may still reference them, for example a frame's
unwinder might still point of DWARF FDE structures that are now freed.
Reinit frame cache to avoid crashing. */
reinit_frame_cache ();
}
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
static void
show_auto_solib_add (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file, _("Autoloading of shared library symbols is %s.\n"),
value);
}
/* Handler for library-specific lookup of global symbol NAME in OBJFILE. Call
the library-specific handler if it is installed for the current target. */
struct symbol *
solib_global_lookup (const struct objfile *objfile,
const char *name,
const char *linkage_name,
* language.h (struct language_defn): Remove SYMTAB parameter from la_lookup_symbol_nonlocal callback function pointer. * ada-lang.h (ada_lookup_encoded_symbol): Remove SYMTAB parameter. (ada_lookup_encoded_symbol): Likewise. * ada-lang.c (ada_lookup_encoded_symbol): Remove SYMTAB parameter. Always call fixup_symbol_section. (ada_lookup_symbol): Remove SYMTAB parameter. (ada_lookup_symbol_nonlocal): Likewise. * ada-exp.y (write_object_renaming): Update. (find_primitive_type): Likewise. * cp-support.h (cp_lookup_symbol_nonlocal): Remove SYMTAB parameter. (cp_lookup_symbol_namespace): Likewise. * cp-namespace.c (lookup_namespace_scope): Remove SYMTAB parameter. (lookup_symbol_file): Likewise. (lookup_possible_namespace_symbol): Likewise. (cp_lookup_symbol_nonlocal): Likewise. (cp_lookup_symbol_namespace): Likewise. (cp_lookup_nested_type): Update. * scm-valprint.c (scm_inferior_print): Update. * valops.c (value_maybe_namespace_elt): Update. * solist.h (struct target_so_ops): Remove SYMTAB parameter from lookup_lib_global_symbol callback function pointer. (solib_global_lookup): Remove SYMTAB parameter. * solib.c (solib_global_lookup): Remove SYMTAB parameter. * solib-svr4.c (elf_lookup_lib_symbol): Likewise. * symtab.h (basic_lookup_symbol_nonlocal): Remove SYMTAB parameter. (lookup_symbol_static): Likewise. (lookup_symbol_global): Likewise. (lookup_symbol_aux_block): Likewise. (lookup_global_symbol_from_objfile): Likewise. * symtab.c (lookup_symbol_aux): Remove SYMTAB parameter. (lookup_symbol_aux_local): Likewise. (lookup_symbol_aux_block): Likewise. (lookup_symbol_aux_symtabs): Likewise. (lookup_symbol_aux_psymtabs): Likewise. (lookup_global_symbol_from_objfile): Likewise. (basic_lookup_symbol_nonlocal): Likewise. (lookup_symbol_static): Likewise. (lookup_symbol_global): Likewise. (lookup_symbol_in_language): Do not pass SYMTAB to lookup_symbol_aux.
2008-05-19 17:49:14 +02:00
const domain_enum domain)
{
* gdbarch.sh (target_gdbarch): New global variable. (deprecated_current_gdbarch_select_hack): Set it. * gdbarch.c, gdbarch.h: Regenerate. * arch-utils.c (gdbarch_update_p): Use target_gdbarch instead of current_gdbarch. * target-descriptions.c (target_find_description): Likewise. * arm-tdep.c (arm_update_current_architecture): Likewise. (show_fp_model, arm_show_abi, arm_show_fallback_mode, arm_show_force_mode): Likewise. * mips-tdep.c (show_mask_address, show_mipsfpu_command, show_mips_abi): Likewise. * mep-tdep.c (me_module_register_set, current_me_module): Likewise. * target.c (target_translate_tls_address): Use target_gdbarch instead of current_gdbarch. * remote.c (struct packet_reg): Likewise. (get_remote_arch_state, packet_reg_from_regnum, packet_reg_from_pnum, remote_check_symbols, remote_wait, remote_address_masked, remote_insert_breakpoint, remote_insert_hw_breakpoint, remote_read_description): Likewise. * remote-m32r-sdi.c (m32r_resume, m32r_wait): Likewise. * remote-mips.c (mips_open, mips_common_breakpoint): Likewise. * cris-tdep.c (cris_can_use_hardware_watchpoint): Likewise. * solib.c (solib_open, solib_map_sections, solib_read_symbols, solib_add, info_sharedlibrary_command, solib_address, solib_create_inferior_hook, in_solib_dynsym_resolve_code, solib_global_lookup): Likewise. * solib-frv.c (enable_break2, frv_relocate_main_executable): Likewise. * solib-irix.c (irix_current_sos, irix_open_symbol_file_object): Likewise. * solib-sunos.c (sunos_solib_create_inferior_hook): Likewise. * solib-svr4.c (exec_entry_point, enable_break, svr4_free_so, set_solib_svr4_fetch_link_map_offsets, svr4_fetch_link_map_offsets): Likewise. * nto-tdep.c (nto_find_and_open_solib, nto_init_solib_absolute_prefix, nto_truncate_ptr): Likewise. * mips-linux-tdep.c (mips_linux_in_dynsym_stub): Likewise.
2008-08-26 19:21:29 +02:00
struct target_so_ops *ops = solib_ops (target_gdbarch);
if (ops->lookup_lib_global_symbol != NULL)
* language.h (struct language_defn): Remove SYMTAB parameter from la_lookup_symbol_nonlocal callback function pointer. * ada-lang.h (ada_lookup_encoded_symbol): Remove SYMTAB parameter. (ada_lookup_encoded_symbol): Likewise. * ada-lang.c (ada_lookup_encoded_symbol): Remove SYMTAB parameter. Always call fixup_symbol_section. (ada_lookup_symbol): Remove SYMTAB parameter. (ada_lookup_symbol_nonlocal): Likewise. * ada-exp.y (write_object_renaming): Update. (find_primitive_type): Likewise. * cp-support.h (cp_lookup_symbol_nonlocal): Remove SYMTAB parameter. (cp_lookup_symbol_namespace): Likewise. * cp-namespace.c (lookup_namespace_scope): Remove SYMTAB parameter. (lookup_symbol_file): Likewise. (lookup_possible_namespace_symbol): Likewise. (cp_lookup_symbol_nonlocal): Likewise. (cp_lookup_symbol_namespace): Likewise. (cp_lookup_nested_type): Update. * scm-valprint.c (scm_inferior_print): Update. * valops.c (value_maybe_namespace_elt): Update. * solist.h (struct target_so_ops): Remove SYMTAB parameter from lookup_lib_global_symbol callback function pointer. (solib_global_lookup): Remove SYMTAB parameter. * solib.c (solib_global_lookup): Remove SYMTAB parameter. * solib-svr4.c (elf_lookup_lib_symbol): Likewise. * symtab.h (basic_lookup_symbol_nonlocal): Remove SYMTAB parameter. (lookup_symbol_static): Likewise. (lookup_symbol_global): Likewise. (lookup_symbol_aux_block): Likewise. (lookup_global_symbol_from_objfile): Likewise. * symtab.c (lookup_symbol_aux): Remove SYMTAB parameter. (lookup_symbol_aux_local): Likewise. (lookup_symbol_aux_block): Likewise. (lookup_symbol_aux_symtabs): Likewise. (lookup_symbol_aux_psymtabs): Likewise. (lookup_global_symbol_from_objfile): Likewise. (basic_lookup_symbol_nonlocal): Likewise. (lookup_symbol_static): Likewise. (lookup_symbol_global): Likewise. (lookup_symbol_in_language): Do not pass SYMTAB to lookup_symbol_aux.
2008-05-19 17:49:14 +02:00
return ops->lookup_lib_global_symbol (objfile, name, linkage_name, domain);
return NULL;
}
2003-06-11 Andrew Cagney <cagney@redhat.com> * xstormy16-tdep.c (xstormy16_push_return_address): Make static. (xstormy16_save_dummy_frame_tos): Make static. (_initialize_xstormy16_tdep): Add declaration. * vax-tdep.c (_initialize_vax_tdep): Add declaration. * v850-tdep.c: Make local functions static. (_initialize_v850_tdep): Add declaration. * sparc-tdep.c: Make local functions static. (_initialize_sparc_tdep): Add declaration. * sh-tdep.c: Make local functions static. (_initialize_sh_tdep): Add declaration. * sh3-rom.c (_initialize_sh3_rom): Add declaration. * s390-tdep.c: Make local functions static. (_initialize_s390_tdep): Add declaration. * dbxread.c (find_stab_function_addr): Make static. * ppc-bdm.c (_initialize_bdm_ppc): Add declaration. * ocd.c (_initialize_remote_ocd): Add declaration. * dink32-rom.c (_initialize_dink32_rom): Add declaration. * ppcbug-rom.c (_initialize_ppcbug_rom): Add declaration. * ns32k-tdep.c (_initialize_ns32k_tdep): Add declaration. * ns32knbsd-tdep.c (_initialize_ns32knbsd_tdep): Add declaration. * mips-tdep.c (_initialize_mips_tdep): Add declaration. * remote-array.c (_initialize_array): Add declaration. (_initialize_remote_monitors): Add declaration. * remote-mips.c: Make local functions static. (_initialize_remote_mips): Add declaration. * mcore-tdep.c: Make all local functions static. (_initialize_mcore_tdep): Add declaration. * dbug-rom.c (_initialize_dbug_rom): Add declaration. * abug-rom.c (_initialize_abug_rom): Add declaration. * rom68k-rom.c (_initialize_rom68k): Add declaration. * cpu32bug-rom.c (_initialize_cpu32bug_rom): Add declaration. * m68k-tdep.c (_initialize_m68k_tdep): Add declaration. * remote-est.c (_initialize_est): Add declaration. * m68hc11-tdep.c (_initialize_m68hc11_tdep): Add declaration. (m68hc11_call_dummy_address): Make static. * ia64-tdep.c: Make local functions static. (_initialize_ia64_tdep): Add declaration. * solib-legacy.c (_initialize_svr4_lm): Add declaration. * monitor.c (monitor_wait_filter): Make static. (_initialize_remote_monitors): Add declaration. * remote-hms.c (_initialize_remote_hms): Add declaration. * remote-e7000.c (fetch_regs_from_dump): Make static. (expect_n): Make static. (_initialize_remote_e7000): Add declaration. * ser-e7kpc.c: Always include "defs.h". (_initialize_ser_e7000pc): Add declaration. * h8300-tdep.c (_initialize_h8300_tdep): Add declaration. * cris-tdep.c: Make all but one function static. (_initialize_cris_tdep): Add declaration. * solib-svr4.c (_initialize_svr4_solib): Add declaration. * solib.c (update_solib_list): Make static. (_initialize_solib): Add declaration. * avr-tdep.c (avr_breakpoint_from_pc): Make static. (_initialize_avr_tdep): Add declaration. * remote-rdi.c (voiddummy): Make static. (_initialize_remote_rdi): Add declaration. * arm-tdep.c (_initialize_arm_tdep): Add declaration. * remote-rdp.c (send_rdp): Make static. (_initialize_remote_rdp): Add declaration. * alpha-tdep.c (_initialize_alpha_tdep): Add declaration.
2003-06-11 15:16:30 +02:00
extern initialize_file_ftype _initialize_solib; /* -Wmissing-prototypes */
void
2000-07-30 03:48:28 +02:00
_initialize_solib (void)
{
struct cmd_list_element *c;
solib_data = gdbarch_data_register_pre_init (solib_init);
add_com ("sharedlibrary", class_files, sharedlibrary_command,
_("Load shared object library symbols for files matching REGEXP."));
1999-07-07 22:19:36 +02:00
add_info ("sharedlibrary", info_sharedlibrary_command,
_("Status of loaded shared object libraries."));
add_com ("nosharedlibrary", class_files, no_shared_libraries,
_("Unload all shared object library symbols."));
add_setshow_boolean_cmd ("auto-solib-add", class_support,
&auto_solib_add, _("\
Set autoloading of shared library symbols."), _("\
Show autoloading of shared library symbols."), _("\
Changes approved by kev@cygnus.com, ezannoni@cygnus.com, eliz@is.elta.co.il. Changelog: 2001-10-27 Fred Fish <fnf@redhat.com> * symfile.c (auto_solib_add): Update comment to note that this variable is now just used as a boolean to control shlib autoloading, and clarify when it is used. * symfile.h (auto_solib_add): Ditto. * symfile.c (auto_solib_limit): New variable that holds the autoloading threshold instead of overloading auto_solib_add. * symfile.h (auto_solib_limit): Ditto. * irix5-nat.c (_initialize_solib): Change auto-solib-add variable from var_zinteger to var_boolean and update help. * osfsolib.c (_initialize_solib): Ditto. * pa64solib.c (_initialize_pa64_solib): Ditto. * solib.c (_initialize_solib): Ditto. * somsolib.c (_initialize_som_solib): Ditto. * xcoffsolib.c (_initialize_solib): Ditto. * pa64solib.c (pa64_solib_total_st_size): Update comment to note that the new auto_solib_limit variable is used instead of overloading auto_solib_add variable. (_initialize_pa64_solib): Ditto. * somsolib.c (som_solib_total_st_size): Ditto. (_initialize_som_solib): Ditto. * pa64solib.c (_initialize_pa64_solib): Add new set/show commands for auto-solib-limit variable. * somsolib.c (_initialize_som_solib): Ditto * pa64solib.c (add_to_solist): Check that auto_solib_add is set and use auto_solib_limit as the threshold size instead of auto_solib_add. * somsolib.c (som_solib_add): Ditto, and also change warning text about size threshold exceeded. doc/ChangeLog: 2001-10-28 Fred Fish <fnf@redhat.com> * gdb.texinfo (auto-solib-add): Change docs to match implementation change. (auto-solib-limit): Add docs for new variable.
2001-10-30 05:05:36 +01:00
If \"on\", symbols from all shared object libraries will be loaded\n\
automatically when the inferior begins execution, when the dynamic linker\n\
informs gdb that a new library has been loaded, or when attaching to the\n\
inferior. Otherwise, symbols must be loaded manually, using `sharedlibrary'."),
NULL,
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
show_auto_solib_add,
&setlist, &showlist);
add_setshow_filename_cmd ("sysroot", class_support,
&gdb_sysroot, _("\
Set an alternate system root."), _("\
Show the current system root."), _("\
The system root is used to load absolute shared library symbol files.\n\
For other (relative) files, you can add directories using\n\
`set solib-search-path'."),
reload_shared_libraries,
NULL,
&setlist, &showlist);
add_alias_cmd ("solib-absolute-prefix", "sysroot", class_support, 0,
&setlist);
add_alias_cmd ("solib-absolute-prefix", "sysroot", class_support, 0,
&showlist);
add_setshow_optional_filename_cmd ("solib-search-path", class_support,
&solib_search_path, _("\
Set the search path for loading non-absolute shared library symbol files."), _("\
Show the search path for loading non-absolute shared library symbol files."), _("\
This takes precedence over the environment variables PATH and LD_LIBRARY_PATH."),
reload_shared_libraries,
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
show_solib_search_path,
&setlist, &showlist);
}