/* Handle SVR4 shared libraries for GDB, the GNU Debugger.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
+ Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
2000, 2001, 2003, 2004, 2005
Free Software Foundation, Inc.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
#include "defs.h"
#include "gdb_assert.h"
#include "solist.h"
+#include "solib.h"
#include "solib-svr4.h"
#include "bfd-target.h"
/* Pointer to copy of link map from inferior. The type is char *
rather than void *, so that we may use byte offsets to find the
various fields without the need for a cast. */
- char *lm;
+ gdb_byte *lm;
};
/* On SVR4 systems, a list of symbols in the dynamic linker where
struct bfd_section *dyninfo_sect;
int dyninfo_sect_size;
CORE_ADDR dyninfo_addr;
- char *buf;
- char *bufend;
+ gdb_byte *buf;
+ gdb_byte *bufend;
int arch_size;
/* Find the start address of the .dynamic section. */
}
else if (dyn_tag == DT_MIPS_RLD_MAP)
{
- char *pbuf;
+ gdb_byte *pbuf;
int pbuf_size = TARGET_PTR_BIT / HOST_CHAR_BIT;
pbuf = alloca (pbuf_size);
}
else if (dyn_tag == DT_MIPS_RLD_MAP)
{
- char *pbuf;
+ gdb_byte *pbuf;
int pbuf_size = TARGET_PTR_BIT / HOST_CHAR_BIT;
pbuf = alloca (pbuf_size);
{
CORE_ADDR lm = 0;
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
- char *r_map_buf = xmalloc (lmo->r_map_size);
+ gdb_byte *r_map_buf = xmalloc (lmo->r_map_size);
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 errcode;
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);
+ gdb_byte *l_name_buf = xmalloc (lmo->l_name_size);
struct cleanup *cleanups = make_cleanup (xfree, l_name_buf);
if (symfile_objfile)
while (lm)
{
struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
- struct so_list *new
- = (struct so_list *) xmalloc (sizeof (struct so_list));
+ struct so_list *new = XZALLOC (struct so_list);
struct cleanup *old_chain = make_cleanup (xfree, new);
- memset (new, 0, sizeof (*new));
-
new->lm_info = xmalloc (sizeof (struct lm_info));
make_cleanup (xfree, new->lm_info);
- new->lm_info->lm = xmalloc (lmo->link_map_size);
+ new->lm_info->lm = xzalloc (lmo->link_map_size);
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);
struct lm_info objfile_lm_info;
struct cleanup *old_chain;
CORE_ADDR name_address;
- char *l_name_buf = xmalloc (lmo->l_name_size);
+ gdb_byte *l_name_buf = xmalloc (lmo->l_name_size);
old_chain = make_cleanup (xfree, l_name_buf);
/* Set up the buffer to contain the portion of the link_map
structure that gdb cares about. Note that this is not the
whole link_map structure. */
- objfile_lm_info.lm = xmalloc (lmo->link_map_size);
+ objfile_lm_info.lm = xzalloc (lmo->link_map_size);
make_cleanup (xfree, objfile_lm_info.lm);
- memset (objfile_lm_info.lm, 0, lmo->link_map_size);
/* Read the link map into our internal structure. */
read_memory (lm, objfile_lm_info.lm, lmo->link_map_size);
tmp_fd = solib_open (buf, &tmp_pathname);
if (tmp_fd >= 0)
- tmp_bfd = bfd_fdopenr (tmp_pathname, gnutarget, tmp_fd);
+ tmp_bfd = bfd_fopen (tmp_pathname, gnutarget, FOPEN_RB, tmp_fd);
if (tmp_bfd == NULL)
goto bkpt_at_symbol;