/* Handle SVR4 shared libraries for GDB, the GNU Debugger.
- Copyright (C) 1990-2015 Free Software Foundation, Inc.
+ Copyright (C) 1990-2017 Free Software Foundation, Inc.
This file is part of GDB.
gdb_byte *l_name_buf = (gdb_byte *) xmalloc (l_name_size);
struct cleanup *cleanups = make_cleanup (xfree, l_name_buf);
struct svr4_info *info = get_svr4_info ();
+ symfile_add_flags add_flags = 0;
+
+ if (from_tty)
+ add_flags |= SYMFILE_VERBOSE;
if (symfile_objfile)
if (!query (_("Attempt to reload symbols from process? ")))
}
/* Have a pathname: read the symbol file. */
- symbol_file_add_main (filename, from_tty);
+ symbol_file_add_main (filename, add_flags);
do_cleanups (cleanups);
return 1;
const char *name
= (const char *) xml_find_attribute (attributes, "name")->value;
ULONGEST *lmp
- = (long unsigned int *) xml_find_attribute (attributes, "lm")->value;
+ = (ULONGEST *) xml_find_attribute (attributes, "lm")->value;
ULONGEST *l_addrp
- = (long unsigned int *) xml_find_attribute (attributes, "l_addr")->value;
+ = (ULONGEST *) xml_find_attribute (attributes, "l_addr")->value;
ULONGEST *l_ldp
- = (long unsigned int *) xml_find_attribute (attributes, "l_ld")->value;
+ = (ULONGEST *) xml_find_attribute (attributes, "l_ld")->value;
struct so_list *new_elem;
new_elem = XCNEW (struct so_list);
/* 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);
+ solib_add (NULL, 0, auto_solib_add);
/* svr4_current_sos() will set main_lm_addr for the main executable. */
if (objfile == symfile_objfile)
struct cleanup *old_chain, *usm_chain;
struct value *val = NULL;
CORE_ADDR pc, debug_base, lm = 0;
- int is_initial_ns;
struct frame_info *frame = get_current_frame ();
/* Do nothing if not using the probes interface. */
/* Helper function for gdb_bfd_lookup_symbol. */
static int
-cmp_name_and_sec_flags (asymbol *sym, void *data)
+cmp_name_and_sec_flags (const asymbol *sym, const void *data)
{
return (strcmp (sym->name, (const char *) data) == 0
&& (sym->section->flags & (SEC_CODE | SEC_DATA)) != 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, from_tty, auto_solib_add);
sym_addr = 0;
if (info->debug_base && solib_svr4_r_map (info) != 0)
sym_addr = solib_svr4_r_brk (info);
int load_addr_found = 0;
int loader_found_in_list = 0;
struct so_list *so;
- bfd *tmp_bfd = NULL;
struct target_ops *tmp_bfd_target;
sym_addr = 0;
be trivial on GNU/Linux). Therefore, we have to try an alternate
mechanism to find the dynamic linker's base address. */
+ gdb_bfd_ref_ptr tmp_bfd;
TRY
{
tmp_bfd = solib_bfd_open (interp_name);
goto bkpt_at_symbol;
/* Now convert the TMP_BFD into a target. That way target, as
- well as BFD operations can be used. */
- tmp_bfd_target = target_bfd_reopen (tmp_bfd);
- /* target_bfd_reopen acquired its own reference, so we can
- release ours now. */
- gdb_bfd_unref (tmp_bfd);
+ well as BFD operations can be used. target_bfd_reopen
+ acquires its own reference. */
+ tmp_bfd_target = target_bfd_reopen (tmp_bfd.get ());
/* On a running target, we can get the dynamic linker's base
address from the shared library table. */
{
load_addr_found = 1;
loader_found_in_list = 1;
- load_addr = lm_addr_check (so, tmp_bfd);
+ load_addr = lm_addr_check (so, tmp_bfd.get ());
break;
}
so = so->next;
if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
{
CORE_ADDR space_size = (CORE_ADDR) 1 << addr_bit;
- CORE_ADDR tmp_entry_point = exec_entry_point (tmp_bfd,
+ CORE_ADDR tmp_entry_point = exec_entry_point (tmp_bfd.get (),
tmp_bfd_target);
gdb_assert (load_addr < space_size);
= get_thread_arch_regcache (inferior_ptid, target_gdbarch ());
load_addr = (regcache_read_pc (regcache)
- - exec_entry_point (tmp_bfd, tmp_bfd_target));
+ - exec_entry_point (tmp_bfd.get (), tmp_bfd_target));
}
if (!loader_found_in_list)
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, from_tty, auto_solib_add);
}
/* Record the relocated start and end address of the dynamic linker
text and plt section for svr4_in_dynsym_resolve_code. */
- interp_sect = bfd_get_section_by_name (tmp_bfd, ".text");
+ interp_sect = bfd_get_section_by_name (tmp_bfd.get (), ".text");
if (interp_sect)
{
info->interp_text_sect_low =
- bfd_section_vma (tmp_bfd, interp_sect) + load_addr;
+ bfd_section_vma (tmp_bfd.get (), interp_sect) + load_addr;
info->interp_text_sect_high =
info->interp_text_sect_low
- + bfd_section_size (tmp_bfd, interp_sect);
+ + bfd_section_size (tmp_bfd.get (), interp_sect);
}
- interp_sect = bfd_get_section_by_name (tmp_bfd, ".plt");
+ interp_sect = bfd_get_section_by_name (tmp_bfd.get (), ".plt");
if (interp_sect)
{
info->interp_plt_sect_low =
- bfd_section_vma (tmp_bfd, interp_sect) + load_addr;
+ bfd_section_vma (tmp_bfd.get (), interp_sect) + load_addr;
info->interp_plt_sect_high =
info->interp_plt_sect_low
- + bfd_section_size (tmp_bfd, interp_sect);
+ + bfd_section_size (tmp_bfd.get (), interp_sect);
}
/* Now try to set a breakpoint in the dynamic linker. */
for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++)
{
- sym_addr = gdb_bfd_lookup_symbol (tmp_bfd, cmp_name_and_sec_flags,
- (void *) *bkpt_namep);
+ sym_addr = gdb_bfd_lookup_symbol (tmp_bfd.get (),
+ cmp_name_and_sec_flags,
+ *bkpt_namep);
if (sym_addr != 0)
break;
}
return 0;
}
-/* Implement the "special_symbol_handling" target_so_ops method. */
-
-static void
-svr4_special_symbol_handling (void)
-{
- /* Nothing to do. */
-}
-
/* Read the ELF program headers from ABFD. Return the contents and
set *PHDRS_SIZE to the size of the program headers. */
svr4_so_ops.clear_so = svr4_clear_so;
svr4_so_ops.clear_solib = svr4_clear_solib;
svr4_so_ops.solib_create_inferior_hook = svr4_solib_create_inferior_hook;
- svr4_so_ops.special_symbol_handling = svr4_special_symbol_handling;
svr4_so_ops.current_sos = svr4_current_sos;
svr4_so_ops.open_symbol_file_object = open_symbol_file_object;
svr4_so_ops.in_dynsym_resolve_code = svr4_in_dynsym_resolve_code;