/* If the solist is global across processes, there's no need to
refetch it here. */
if (!gdbarch_has_global_solist (target_gdbarch ()))
- solib_add (NULL, 0, target, auto_solib_add);
+ {
+ symfile_add_flags add_flags = 0;
+
+ if (!auto_solib_add)
+ add_flags |= SYMFILE_NO_READ;
+
+ solib_add (NULL, add_flags, target);
+ }
}
}
/* On OSs where the list of libraries is global to all
processes, we fetch them early. */
if (gdbarch_has_global_solist (target_gdbarch ()))
- solib_add (NULL, from_tty, target, auto_solib_add);
+ {
+ symfile_add_flags add_flags = 0;
+
+ if (from_tty)
+ add_flags |= SYMFILE_VERBOSE;
+ if (!auto_solib_add)
+ add_flags |= SYMFILE_NO_READ;
+
+ solib_add (NULL, add_flags, target);
+ }
if (target_is_non_stop_p ())
{
/* Cause frv_current_sos() to be run if it hasn't been already. */
if (main_lm_addr == 0)
- solib_add (0, 0, 0, 1);
+ solib_add (0, 0, 0);
/* frv_current_sos() will set main_lm_addr for the main executable. */
if (objfile == symfile_objfile)
/* Cause svr4_current_sos() to be run if it hasn't been already. */
if (info->main_lm_addr == 0)
- solib_add (NULL, 0, ¤t_target, auto_solib_add);
+ {
+ symfile_add_flags add_flags = 0;
+
+ if (!auto_solib_add)
+ add_flags |= SYMFILE_NO_READ;
+
+ solib_add (NULL, add_flags, ¤t_target);
+ }
/* svr4_current_sos() will set main_lm_addr for the main executable. */
if (objfile == symfile_objfile)
asection *interp_sect;
char *interp_name;
CORE_ADDR sym_addr;
+ symfile_add_flags add_flags = 0;
+
+ if (from_tty)
+ add_flags |= SYMFILE_VERBOSE;
+ if (!auto_solib_add)
+ add_flags |= SYMFILE_NO_READ;
info->interp_text_sect_low = info->interp_text_sect_high = 0;
info->interp_plt_sect_low = info->interp_plt_sect_high = 0;
mean r_brk has already been relocated. Assume the dynamic linker
is the object containing r_brk. */
- solib_add (NULL, from_tty, ¤t_target, auto_solib_add);
+ solib_add (NULL, add_flags, ¤t_target);
sym_addr = 0;
if (info->debug_base && solib_svr4_r_map (info) != 0)
sym_addr = solib_svr4_r_brk (info);
info->debug_loader_name = xstrdup (interp_name);
info->debug_loader_offset_p = 1;
info->debug_loader_offset = load_addr;
- solib_add (NULL, from_tty, ¤t_target, auto_solib_add);
+ solib_add (NULL, add_flags, ¤t_target);
}
/* Record the relocated start and end address of the dynamic linker
FROM_TTY and TARGET are as described for update_solib_list, above. */
void
-solib_add (const char *pattern, int from_tty,
- struct target_ops *target, int readsyms)
+solib_add (const char *pattern, symfile_add_flags add_flags,
+ struct target_ops *target)
{
struct so_list *gdb;
+ int from_tty = (add_flags & SYMFILE_VERBOSE) != 0;
if (print_symbol_loading_p (from_tty, 0, 0))
{
{
int any_matches = 0;
int loaded_any_symbols = 0;
- const int flags =
- SYMFILE_DEFER_BP_RESET | (from_tty ? SYMFILE_VERBOSE : 0);
+ symfile_add_flags flags = add_flags | SYMFILE_DEFER_BP_RESET;
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));
+ only if SYMFILE_NO_READ is not 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
+ = ((add_flags & SYMFILE_NO_READ) == 0
+ || libpthread_solib_p (gdb));
any_matches = 1;
if (add_this_solib)
}
}
- if (loaded_any_symbols)
+ if ((add_flags & SYMFILE_DEFER_BP_RESET) == 0
+ && loaded_any_symbols)
breakpoint_re_set ();
if (from_tty && pattern && ! any_matches)
static void
sharedlibrary_command (char *args, int from_tty)
{
+ symfile_add_flags add_flags = 0;
+
dont_repeat ();
- solib_add (args, from_tty, (struct target_ops *) 0, 1);
+
+ if (from_tty)
+ add_flags |= SYMFILE_VERBOSE;
+
+ solib_add (args, add_flags, (struct target_ops *) 0);
}
/* Implements the command "nosharedlibrary", which discards symbols
be adding them automatically. Switch terminal for any messages
produced by breakpoint_re_set. */
target_terminal_ours_for_output ();
- solib_add (NULL, 0, ¤t_target, auto_solib_add);
+
+ symfile_add_flags add_flags = 0;
+ if (!auto_solib_add)
+ add_flags |= SYMFILE_NO_READ;
+ solib_add (NULL, add_flags, ¤t_target);
+
target_terminal_inferior ();
}
struct cmd_list_element *e)
{
const struct target_so_ops *ops;
+ symfile_add_flags add_flags = 0;
+
+ if (!auto_solib_add)
+ add_flags |= SYMFILE_NO_READ;
reload_shared_libraries_1 (from_tty);
removed. Call it only after the solib target has been initialized by
solib_create_inferior_hook. */
- solib_add (NULL, 0, NULL, auto_solib_add);
+ solib_add (NULL, add_flags, NULL);
breakpoint_re_set ();
#ifndef SOLIB_H
#define SOLIB_H
+#include "symfile.h"
+
/* Forward decl's for prototypes */
struct so_list;
struct target_ops;
/* Called to add symbols from a shared library to gdb's symbol table. */
-extern void solib_add (const char *, int, struct target_ops *, int);
+extern void solib_add (const char *, symfile_add_flags, struct target_ops *);
extern int solib_read_symbols (struct so_list *, int);
/* Function to be called when the inferior starts up, to discover the
/* This file requires that you first include "bfd.h". */
#include "symtab.h"
#include "probe.h"
+#include "common/enum-flags.h"
/* Opaque declarations. */
struct target_section;
/* This enum encodes bit-flags passed as ADD_FLAGS parameter to
symbol_file_add, etc. */
-enum symfile_add_flags
+enum symfile_add_flag
{
/* Be chatty about what you are doing. */
SYMFILE_VERBOSE = 1 << 1,
symbols are read when the objfile is created. */
SYMFILE_NO_READ = 1 << 4
};
+DEF_ENUM_FLAGS_TYPE (enum symfile_add_flag, symfile_add_flags);
extern struct objfile *symbol_file_add (const char *, int,
struct section_addr_info *, int);