/* Native support for the SGI Iris running IRIX version 5, for GDB.
- Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
+ Copyright 1988, 89, 90, 91, 92, 93, 94, 95, 96, 98, 1999
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.
{
register int regi;
register greg_t *regp = &(*gregsetp)[0];
+ int gregoff = sizeof (greg_t) - MIPS_REGSIZE;
static char zerobuf[MAX_REGISTER_RAW_SIZE] = {0};
for(regi = 0; regi <= CTX_RA; regi++)
- supply_register (regi, (char *)(regp + regi));
+ supply_register (regi, (char *)(regp + regi) + gregoff);
- supply_register (PC_REGNUM, (char *)(regp + CTX_EPC));
- supply_register (HI_REGNUM, (char *)(regp + CTX_MDHI));
- supply_register (LO_REGNUM, (char *)(regp + CTX_MDLO));
- supply_register (CAUSE_REGNUM, (char *)(regp + CTX_CAUSE));
+ supply_register (PC_REGNUM, (char *)(regp + CTX_EPC) + gregoff);
+ supply_register (HI_REGNUM, (char *)(regp + CTX_MDHI) + gregoff);
+ supply_register (LO_REGNUM, (char *)(regp + CTX_MDLO) + gregoff);
+ supply_register (CAUSE_REGNUM, (char *)(regp + CTX_CAUSE) + gregoff);
/* Fill inaccessible registers with zero. */
supply_register (BADVADDR_REGNUM, zerobuf);
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) = *(greg_t *) ®isters[REGISTER_BYTE (regi)];
+ *(regp + regi) =
+ extract_signed_integer (®isters[REGISTER_BYTE (regi)],
+ REGISTER_RAW_SIZE (regi));
if ((regno == -1) || (regno == PC_REGNUM))
- *(regp + CTX_EPC) = *(greg_t *) ®isters[REGISTER_BYTE (PC_REGNUM)];
+ *(regp + CTX_EPC) =
+ extract_signed_integer (®isters[REGISTER_BYTE (PC_REGNUM)],
+ REGISTER_RAW_SIZE (PC_REGNUM));
if ((regno == -1) || (regno == CAUSE_REGNUM))
- *(regp + CTX_CAUSE) = *(greg_t *) ®isters[REGISTER_BYTE (CAUSE_REGNUM)];
+ *(regp + CTX_CAUSE) =
+ extract_signed_integer (®isters[REGISTER_BYTE (CAUSE_REGNUM)],
+ REGISTER_RAW_SIZE (CAUSE_REGNUM));
if ((regno == -1) || (regno == HI_REGNUM))
- *(regp + CTX_MDHI) = *(greg_t *) ®isters[REGISTER_BYTE (HI_REGNUM)];
+ *(regp + CTX_MDHI) =
+ extract_signed_integer (®isters[REGISTER_BYTE (HI_REGNUM)],
+ REGISTER_RAW_SIZE (HI_REGNUM));
if ((regno == -1) || (regno == LO_REGNUM))
- *(regp + CTX_MDLO) = *(greg_t *) ®isters[REGISTER_BYTE (LO_REGNUM)];
+ *(regp + CTX_MDLO) =
+ extract_signed_integer (®isters[REGISTER_BYTE (LO_REGNUM)],
+ REGISTER_RAW_SIZE (LO_REGNUM));
}
/*
register int regi;
static char zerobuf[MAX_REGISTER_RAW_SIZE] = {0};
+ /* FIXME, this is wrong for the N32 ABI which has 64 bit FP regs. */
+
for (regi = 0; regi < 32; regi++)
supply_register (FP0_REGNUM + regi,
(char *)&fpregsetp->fp_r.fp_regs[regi]);
int regi;
char *from, *to;
+ /* FIXME, this is wrong for the N32 ABI which has 64 bit FP regs. */
+
for (regi = FP0_REGNUM; regi < FP0_REGNUM + 32; regi++)
{
if ((regno == -1) || (regno == regi))
{
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);
}
/*
memory_error (errcode, (CORE_ADDR) list_32.oi_pathname);
LM_ADDR (so_list_ptr) = (CORE_ADDR) list_32.oi_ehdr;
- LM_OFFSET (so_list_ptr)
- = (CORE_ADDR) list_32.oi_ehdr - (CORE_ADDR) list_32.oi_orig_ehdr;
+ LM_OFFSET (so_list_ptr) =
+ (CORE_ADDR) list_32.oi_ehdr - (CORE_ADDR) list_32.oi_orig_ehdr;
}
else
#endif
{
+#if defined (_MIPS_SIM_NABI32) && _MIPS_SIM == _MIPS_SIM_NABI32
+ /* If we are compiling GDB under N32 ABI, the alignments in
+ the obj struct are different from the O32 ABI and we will get
+ wrong values when accessing the struct.
+ As a workaround we use fixed values which are good for
+ Irix 6.2. */
+ char buf[432];
+
+ read_memory ((CORE_ADDR) list_old.data, buf, sizeof (buf));
+
+ target_read_string (extract_address (&buf[236], 4),
+ &so_list_ptr -> so_name,
+ INT_MAX, &errcode);
+ if (errcode != 0)
+ memory_error (errcode, extract_address (&buf[236], 4));
+
+ LM_ADDR (so_list_ptr) = extract_address (&buf[196], 4);
+ LM_OFFSET (so_list_ptr) =
+ extract_address (&buf[196], 4) - extract_address (&buf[248], 4);
+#else
struct obj obj_old;
read_memory ((CORE_ADDR) list_old.data, (char *) &obj_old,
memory_error (errcode, (CORE_ADDR) obj_old.o_path);
LM_ADDR (so_list_ptr) = (CORE_ADDR) obj_old.o_praw;
- LM_OFFSET (so_list_ptr)
- = (CORE_ADDR) obj_old.o_praw - obj_old.o_base_address;
+ LM_OFFSET (so_list_ptr) =
+ (CORE_ADDR) obj_old.o_praw - obj_old.o_base_address;
+#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;
so -> objfile = symbol_file_add (so -> so_name, so -> from_tty,
text_addr,
- 0, 0, 0);
+ 0, 0, 0, 0, 0);
return (1);
}
struct so_list *next;
char *bfd_filename;
+ disable_breakpoints_in_shlibs (1);
+
while (so_list_head)
{
if (so_list_head -> sections)