/* Handle SunOS and SVR4 shared libraries for GDB, the GNU Debugger.
- Copyright 1990, 91, 92, 93, 94, 95, 96, 98, 1999, 2000
+ Copyright 1990, 91, 92, 93, 94, 95, 96, 98, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GDB.
"_r_debug_state",
"_dl_debug_state",
"rtld_db_dlactivity",
+ "_rtld_debug_state",
NULL
};
#endif
#else
- internal_error ("default_svr4_fetch_link_map_offsets called without HAVE_LINK_H defined.");
+ internal_error (__FILE__, __LINE__,
+ "default_svr4_fetch_link_map_offsets called without HAVE_LINK_H defined.");
return 0;
#endif /* HAVE_LINK_H */
#endif /* !SVR4_SHARED_LIBS */
-
static CORE_ADDR debug_base; /* Base of dynamic linker structures */
static CORE_ADDR breakpoint_addr; /* Address where end bkpt is set */
static int match_main (char *);
-/* If non-zero, this is a prefix that will be added to the front of the name
- shared libraries with an absolute filename for loading. */
-static char *solib_absolute_prefix = NULL;
-
-/* 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;
-
-
#ifndef SVR4_SHARED_LIBS
/* Allocate the runtime common object file. */
memset (objfile, 0, sizeof (struct objfile));
objfile->md = NULL;
obstack_specify_allocation (&objfile->psymbol_cache.cache, 0, 0,
- xmalloc, free);
+ xmalloc, xfree);
obstack_specify_allocation (&objfile->psymbol_obstack, 0, 0, xmalloc,
- free);
+ xfree);
obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc,
- free);
+ xfree);
obstack_specify_allocation (&objfile->type_obstack, 0, 0, xmalloc,
- free);
+ xfree);
objfile->name = mstrsave (objfile->md, "rt_common");
/* Add this file onto the tail of the linked list of other such files. */
{
obstack_free (&rt_common_objfile->symbol_obstack, 0);
obstack_specify_allocation (&rt_common_objfile->symbol_obstack, 0, 0,
- xmalloc, free);
+ xmalloc, xfree);
rt_common_objfile->minimal_symbol_count = 0;
rt_common_objfile->msymbols = NULL;
}
prim_record_minimal_symbol (name, inferior_rtc_nlist.n_value,
mst_bss, rt_common_objfile);
- free (name);
+ xfree (name);
}
rtc_symp = SOLIB_EXTRACT_ADDRESS (inferior_rtc_symb.rtc_next);
}
if (storage_needed > 0)
{
symbol_table = (asymbol **) xmalloc (storage_needed);
- back_to = make_cleanup (free, (PTR) symbol_table);
+ back_to = make_cleanup (xfree, (PTR) symbol_table);
number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
for (i = 0; i < number_of_symbols; i++)
if (storage_needed > 0)
{
symbol_table = (asymbol **) xmalloc (storage_needed);
- back_to = make_cleanup (free, (PTR) symbol_table);
+ back_to = make_cleanup (xfree, (PTR) symbol_table);
number_of_symbols = bfd_canonicalize_dynamic_symtab (abfd, symbol_table);
for (i = 0; i < number_of_symbols; i++)
#else /* SVR4_SHARED_LIBS */
struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
char *r_map_buf = xmalloc (lmo->r_map_size);
- struct cleanup *cleanups = make_cleanup (free, r_map_buf);
+ struct cleanup *cleanups = make_cleanup (xfree, r_map_buf);
read_memory (debug_base + lmo->r_map_offset, r_map_buf, lmo->r_map_size);
int from_tty = *(int *)from_ttyp;
struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
char *l_name_buf = xmalloc (lmo->l_name_size);
- struct cleanup *cleanups = make_cleanup (free, l_name_buf);
+ struct cleanup *cleanups = make_cleanup (xfree, l_name_buf);
if (symfile_objfile)
if (!query ("Attempt to reload symbols from process? "))
return 0;
}
- make_cleanup (free, filename);
+ make_cleanup (xfree, filename);
/* Have a pathname: read the symbol file. */
- symbol_file_command (filename, from_tty);
+ symbol_file_add_main (filename, from_tty);
return 1;
}
struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
struct so_list *new
= (struct so_list *) xmalloc (sizeof (struct so_list));
- struct cleanup *old_chain = make_cleanup (free, new);
+ struct cleanup *old_chain = make_cleanup (xfree, new);
memset (new, 0, sizeof (*new));
new->lm_info = xmalloc (sizeof (struct lm_info));
- make_cleanup (free, new->lm_info);
+ make_cleanup (xfree, new->lm_info);
new->lm_info->lm = xmalloc (lmo->link_map_size);
- make_cleanup (free, new->lm_info->lm);
+ make_cleanup (xfree, new->lm_info->lm);
memset (new->lm_info->lm, 0, lmo->link_map_size);
read_memory (lm, new->lm_info->lm, lmo->link_map_size);
{
strncpy (new->so_name, buffer, SO_NAME_MAX_PATH_SIZE - 1);
new->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
- free (buffer);
+ xfree (buffer);
strcpy (new->so_original_name, new->so_name);
}
unsigned int interp_sect_size;
char *buf;
CORE_ADDR load_addr;
- bfd *tmp_bfd;
+ bfd *tmp_bfd = NULL;
+ int tmp_fd = -1;
+ char *tmp_pathname = NULL;
CORE_ADDR sym_addr = 0;
/* Read the contents of the .interp section into a local buffer;
to find any magic formula to find it for Solaris (appears to
be trivial on GNU/Linux). Therefore, we have to try an alternate
mechanism to find the dynamic linker's base address. */
- tmp_bfd = bfd_openr (buf, gnutarget);
+
+ tmp_fd = solib_open (buf, &tmp_pathname);
+ if (tmp_fd >= 0)
+ tmp_bfd = bfd_fdopenr (tmp_pathname, gnutarget, tmp_fd);
+
if (tmp_bfd == NULL)
goto bkpt_at_symbol;
new_offsets = xcalloc (sizeof (struct section_offsets),
symfile_objfile->num_sections);
- old_chain = make_cleanup (free, new_offsets);
+ old_chain = make_cleanup (xfree, new_offsets);
for (i = 0; i < symfile_objfile->num_sections; i++)
{
static void
svr4_free_so (struct so_list *so)
{
- free (so->lm_info->lm);
- free (so->lm_info);
+ xfree (so->lm_info->lm);
+ xfree (so->lm_info);
}
static void