/* Native support for the SGI Iris running IRIX version 5, for GDB.
- Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
+ Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998
Free Software Foundation, Inc.
Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
int regi;
register greg_t *regp = &(*gregsetp)[0];
+ /* Under Irix6, if GDB is built with N32 ABI and is debugging an O32
+ executable, we have to sign extend the registers to 64 bits before
+ filling in the gregset structure. */
+
for (regi = 0; regi <= CTX_RA; regi++)
if ((regno == -1) || (regno == regi))
*(regp + regi) =
- extract_address (®isters[REGISTER_BYTE (regi)],
- REGISTER_RAW_SIZE (regi));
+ extract_signed_integer (®isters[REGISTER_BYTE (regi)],
+ REGISTER_RAW_SIZE (regi));
if ((regno == -1) || (regno == PC_REGNUM))
*(regp + CTX_EPC) =
- extract_address (®isters[REGISTER_BYTE (PC_REGNUM)],
- REGISTER_RAW_SIZE (PC_REGNUM));
+ extract_signed_integer (®isters[REGISTER_BYTE (PC_REGNUM)],
+ REGISTER_RAW_SIZE (PC_REGNUM));
if ((regno == -1) || (regno == CAUSE_REGNUM))
*(regp + CTX_CAUSE) =
- extract_address (®isters[REGISTER_BYTE (CAUSE_REGNUM)],
- REGISTER_RAW_SIZE (CAUSE_REGNUM));
+ extract_signed_integer (®isters[REGISTER_BYTE (CAUSE_REGNUM)],
+ REGISTER_RAW_SIZE (CAUSE_REGNUM));
if ((regno == -1) || (regno == HI_REGNUM))
*(regp + CTX_MDHI) =
- extract_address (®isters[REGISTER_BYTE (HI_REGNUM)],
- REGISTER_RAW_SIZE (HI_REGNUM));
+ extract_signed_integer (®isters[REGISTER_BYTE (HI_REGNUM)],
+ REGISTER_RAW_SIZE (HI_REGNUM));
if ((regno == -1) || (regno == LO_REGNUM))
*(regp + CTX_MDLO) =
- extract_address (®isters[REGISTER_BYTE (LO_REGNUM)],
- REGISTER_RAW_SIZE (LO_REGNUM));
+ extract_signed_integer (®isters[REGISTER_BYTE (LO_REGNUM)],
+ REGISTER_RAW_SIZE (LO_REGNUM));
}
/*
{
memcpy ((char *)registers, core_reg_sect, core_reg_size);
}
- else if (core_reg_size == (2 * REGISTER_BYTES) && MIPS_REGSIZE == 4)
+ else if (MIPS_REGSIZE == 4 &&
+ core_reg_size == (2 * MIPS_REGSIZE) * NUM_REGS)
{
/* This is a core file from a N32 executable, 64 bits are saved
for all registers. */
*dstp++ = *srcp++;
*dstp++ = *srcp++;
*dstp++ = *srcp++;
- srcp += 4;
+ if (REGISTER_RAW_SIZE(regno) == 4)
+ {
+ /* copying 4 bytes from eight bytes?
+ I don't see how this can be right... */
+ srcp += 4;
+ }
+ else
+ {
+ /* copy all 8 bytes (sizeof(double)) */
+ *dstp++ = *srcp++;
+ *dstp++ = *srcp++;
+ *dstp++ = *srcp++;
+ *dstp++ = *srcp++;
+ }
}
else
{
static CORE_ADDR
locate_base PARAMS ((void));
-static void
-solib_map_sections PARAMS ((struct so_list *));
+static int
+solib_map_sections PARAMS ((char *));
/*
SYNOPSIS
- static void solib_map_sections (struct so_list *so)
+ static int solib_map_sections (struct so_list *so)
DESCRIPTION
expansion stuff?).
*/
-static void
-solib_map_sections (so)
- struct so_list *so;
+static int
+solib_map_sections (arg)
+ char *arg;
{
+ struct so_list *so = (struct so_list *) arg; /* catch_errors bogon */
char *filename;
char *scratch_pathname;
int scratch_chan;
/* Free the file names, close the file now. */
do_cleanups (old_chain);
+
+ return (1);
}
/*
#endif
}
- solib_map_sections (so_list_ptr);
+ catch_errors (solib_map_sections, (char *) so_list_ptr,
+ "Error while mapping shared library sections:\n",
+ RETURN_MASK_ALL);
}
if (so -> textsection)
text_addr = so -> textsection -> addr;
- else
+ else if (so -> abfd != NULL)
{
asection *lowest_sect;