#include <sys/procfs.h>
#include <setjmp.h> /* For JB_XXX. */
-static void
-fetch_core_registers PARAMS ((char *, unsigned int, int, CORE_ADDR));
+/* Prototypes for supply_gregset etc. */
+#include "gregset.h"
+
+static void fetch_core_registers (char *, unsigned int, int, CORE_ADDR);
/* Size of elements in jmpbuf */
*/
void
-supply_gregset (gregsetp)
- gregset_t *gregsetp;
+supply_gregset (gregset_t *gregsetp)
{
register int regi;
register greg_t *regp = &(*gregsetp)[0];
}
void
-fill_gregset (gregsetp, regno)
- gregset_t *gregsetp;
- int regno;
+fill_gregset (gregset_t *gregsetp, int regno)
{
int regi;
register greg_t *regp = &(*gregsetp)[0];
*/
void
-supply_fpregset (fpregsetp)
- fpregset_t *fpregsetp;
+supply_fpregset (fpregset_t *fpregsetp)
{
register int regi;
static char zerobuf[MAX_REGISTER_RAW_SIZE] =
}
void
-fill_fpregset (fpregsetp, regno)
- fpregset_t *fpregsetp;
- int regno;
+fill_fpregset (fpregset_t *fpregsetp, int regno)
{
int regi;
char *from, *to;
This routine returns true on success. */
int
-get_longjmp_target (pc)
- CORE_ADDR *pc;
+get_longjmp_target (CORE_ADDR *pc)
{
- char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT];
+ char *buf;
CORE_ADDR jb_addr;
+ buf = alloca (TARGET_PTR_BIT / TARGET_CHAR_BIT);
jb_addr = read_register (A0_REGNUM);
if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, buf,
return 1;
}
+/* Provide registers to GDB from a core file.
+
+ CORE_REG_SECT points to an array of bytes, which were obtained from
+ a core file which BFD thinks might contain register contents.
+ CORE_REG_SIZE is its size.
+
+ Normally, WHICH says which register set corelow suspects this is:
+ 0 --- the general-purpose register set
+ 2 --- the floating-point register set
+ However, for Irix 5, WHICH isn't used.
+
+ REG_ADDR is also unused. */
+
static void
-fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
- char *core_reg_sect;
- unsigned core_reg_size;
- int which; /* Unused */
- CORE_ADDR reg_addr; /* Unused */
+fetch_core_registers (char *core_reg_sect, unsigned core_reg_size,
+ int which, CORE_ADDR reg_addr)
{
if (core_reg_size == REGISTER_BYTES)
{
#include "objfiles.h"
#include "command.h"
#include "frame.h"
-#include "gnu-regex.h"
+#include "gdb_regex.h"
#include "inferior.h"
#include "language.h"
#include "gdbcmd.h"
/* Local function prototypes */
-static void
-sharedlibrary_command PARAMS ((char *, int));
+static void sharedlibrary_command (char *, int);
-static int
-enable_break PARAMS ((void));
+static int enable_break (void);
-static int
-disable_break PARAMS ((void));
+static int disable_break (void);
-static void
-info_sharedlibrary_command PARAMS ((char *, int));
+static void info_sharedlibrary_command (char *, int);
-static int
-symbol_add_stub PARAMS ((char *));
+static int symbol_add_stub (void *);
-static struct so_list *
- find_solib PARAMS ((struct so_list *));
+static struct so_list *find_solib (struct so_list *);
-static struct link_map *
- first_link_map_member PARAMS ((void));
+static struct link_map *first_link_map_member (void);
-static struct link_map *
- next_link_map_member PARAMS ((struct so_list *));
+static struct link_map *next_link_map_member (struct so_list *);
-static void
-xfer_link_map_member PARAMS ((struct so_list *, struct link_map *));
+static void xfer_link_map_member (struct so_list *, struct link_map *);
-static CORE_ADDR
- locate_base PARAMS ((void));
+static CORE_ADDR locate_base (void);
-static int
-solib_map_sections PARAMS ((char *));
+static int solib_map_sections (void *);
/*
*/
static int
-solib_map_sections (arg)
- char *arg;
+solib_map_sections (void *arg)
{
struct so_list *so = (struct so_list *) arg; /* catch_errors bogon */
char *filename;
/* Free the file names, close the file now. */
do_cleanups (old_chain);
+ /* must be non-zero */
return (1);
}
*/
static CORE_ADDR
-locate_base ()
+locate_base (void)
{
struct minimal_symbol *msymbol;
CORE_ADDR address = 0;
*/
static struct link_map *
-first_link_map_member ()
+first_link_map_member (void)
{
struct obj_list *listp;
struct obj_list list_old;
return NULL;
/* Get first list entry. */
- lladdr = (CORE_ADDR) listp;
+ /* The MIPS Sign extends addresses. */
+ lladdr = host_pointer_to_address (listp);
read_memory (lladdr, (char *) &list_old, sizeof (struct obj_list));
/* The first entry in the list is the object file we are debugging,
so skip it. */
- next_lladdr = (CORE_ADDR) list_old.next;
+ next_lladdr = host_pointer_to_address (list_old.next);
#ifdef HANDLE_NEW_OBJ_LIST
if (list_old.data == NEW_OBJ_INFO_MAGIC)
*/
static struct link_map *
-next_link_map_member (so_list_ptr)
- struct so_list *so_list_ptr;
+next_link_map_member (struct so_list *so_list_ptr)
{
struct link_map *lm = &so_list_ptr->lm;
CORE_ADDR next_lladdr = lm->l_next;
status = target_read_memory (lm->l_lladdr,
(char *) &list_old,
sizeof (struct obj_list));
- next_lladdr = (CORE_ADDR) list_old.next;
+ next_lladdr = host_pointer_to_address (list_old.next);
}
#ifdef HANDLE_NEW_OBJ_LIST
else if (lm->l_variant == OBJ_LIST_32)
*/
static void
-xfer_link_map_member (so_list_ptr, lm)
- struct so_list *so_list_ptr;
- struct link_map *lm;
+xfer_link_map_member (struct so_list *so_list_ptr, struct link_map *lm)
{
struct obj_list list_old;
CORE_ADDR lladdr = lm->l_lladdr;
new_lm->l_variant = OBJ_LIST_OLD;
new_lm->l_lladdr = lladdr;
- new_lm->l_next = (CORE_ADDR) list_old.next;
+ new_lm->l_next = host_pointer_to_address (list_old.next);
#ifdef HANDLE_NEW_OBJ_LIST
if (list_old.data == NEW_OBJ_INFO_MAGIC)
*/
static struct so_list *
-find_solib (so_list_ptr)
- struct so_list *so_list_ptr; /* Last lm or NULL for first one */
+find_solib (struct so_list *so_list_ptr)
{
struct so_list *so_list_next = NULL;
struct link_map *lm = NULL;
/* A small stub to get us past the arg-passing pinhole of catch_errors. */
static int
-symbol_add_stub (arg)
- char *arg;
+symbol_add_stub (void *arg)
{
register struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */
CORE_ADDR text_addr = 0;
+ struct section_addr_info section_addrs;
+ memset (§ion_addrs, 0, sizeof (section_addrs));
if (so->textsection)
text_addr = so->textsection->addr;
else if (so->abfd != NULL)
lowest_sect = bfd_get_section_by_name (so->abfd, ".text");
if (lowest_sect == NULL)
bfd_map_over_sections (so->abfd, find_lowest_section,
- (PTR) & lowest_sect);
+ (PTR) &lowest_sect);
if (lowest_sect)
text_addr = bfd_section_vma (so->abfd, lowest_sect) + LM_OFFSET (so);
}
+
+ section_addrs.other[0].name = ".text";
+ section_addrs.other[0].addr = text_addr;
so->objfile = symbol_file_add (so->so_name, so->from_tty,
- text_addr,
- 0, 0, 0, 0, 0);
+ §ion_addrs, 0, 0);
+ /* must be non-zero */
return (1);
}
*/
void
-solib_add (arg_string, from_tty, target)
- char *arg_string;
- int from_tty;
- struct target_ops *target;
+solib_add (char *arg_string, int from_tty, struct target_ops *target)
{
register struct so_list *so = NULL; /* link map state variable */
if (count)
{
- int update_coreops;
-
- /* We must update the to_sections field in the core_ops structure
- here, otherwise we dereference a potential dangling pointer
- for each call to target_read/write_memory within this routine. */
- update_coreops = core_ops.to_sections == target->to_sections;
-
- /* Reallocate the target's section table including the new size. */
- if (target->to_sections)
- {
- old = target->to_sections_end - target->to_sections;
- target->to_sections = (struct section_table *)
- xrealloc ((char *) target->to_sections,
- (sizeof (struct section_table)) * (count + old));
- }
- else
- {
- old = 0;
- target->to_sections = (struct section_table *)
- xmalloc ((sizeof (struct section_table)) * count);
- }
- target->to_sections_end = target->to_sections + (count + old);
-
- /* Update the to_sections field in the core_ops structure
- if needed. */
- if (update_coreops)
- {
- core_ops.to_sections = target->to_sections;
- core_ops.to_sections_end = target->to_sections_end;
- }
-
+ old = target_resize_to_sections (target, count);
+
/* Add these section table entries to the target's table. */
while ((so = find_solib (so)) != NULL)
{
*/
static void
-info_sharedlibrary_command (ignore, from_tty)
- char *ignore;
- int from_tty;
+info_sharedlibrary_command (char *ignore, int from_tty)
{
register struct so_list *so = NULL; /* link map state variable */
int header_done = 0;
if (exec_bfd == NULL)
{
- printf_unfiltered ("No exec file.\n");
+ printf_unfiltered ("No executable file.\n");
return;
}
while ((so = find_solib (so)) != NULL)
*/
char *
-solib_address (address)
- CORE_ADDR address;
+solib_address (CORE_ADDR address)
{
register struct so_list *so = 0; /* link map state variable */
/* Called by free_all_symtabs */
void
-clear_solib ()
+clear_solib (void)
{
struct so_list *next;
char *bfd_filename;
*/
static int
-disable_break ()
+disable_break (void)
{
int status = 1;
*/
static int
-enable_break ()
+enable_break (void)
{
if (symfile_objfile != NULL
&& target_insert_breakpoint (symfile_objfile->ei.entry_point,
*/
void
-solib_create_inferior_hook ()
+solib_create_inferior_hook (void)
{
if (!enable_break ())
{
*/
static void
-sharedlibrary_command (args, from_tty)
- char *args;
- int from_tty;
+sharedlibrary_command (char *args, int from_tty)
{
dont_repeat ();
solib_add (args, from_tty, (struct target_ops *) 0);
}
void
-_initialize_solib ()
+_initialize_solib (void)
{
add_com ("sharedlibrary", class_files, sharedlibrary_command,
"Load shared object library symbols for files matching REGEXP.");
static struct core_fns irix5_core_fns =
{
- bfd_target_unknown_flavour,
- fetch_core_registers,
- NULL
+ bfd_target_unknown_flavour, /* core_flavour */
+ default_check_format, /* check_format */
+ default_core_sniffer, /* core_sniffer */
+ fetch_core_registers, /* core_read_registers */
+ NULL /* next */
};
void
-_initialize_core_irix5 ()
+_initialize_core_irix5 (void)
{
add_core_fns (&irix5_core_fns);
}