extern int errno;
-extern struct vmap *map_vmap PARAMS ((bfd * bf, bfd * arch));
+extern struct vmap *map_vmap (bfd * bf, bfd * arch);
extern struct target_ops exec_ops;
-static void
-vmap_exec PARAMS ((void));
+static void vmap_exec (void);
-static void
-vmap_ldinfo PARAMS ((struct ld_info *));
+static void vmap_ldinfo (struct ld_info *);
-static struct vmap *
- add_vmap PARAMS ((struct ld_info *));
+static struct vmap *add_vmap (struct ld_info *);
-static int
-objfile_symbol_add PARAMS ((char *));
+static int objfile_symbol_add (char *);
-static void
-vmap_symtab PARAMS ((struct vmap *));
+static void vmap_symtab (struct vmap *);
-static void
-fetch_core_registers PARAMS ((char *, unsigned int, int, CORE_ADDR));
+static void fetch_core_registers (char *, unsigned int, int, CORE_ADDR);
-static void
-exec_one_dummy_insn PARAMS ((void));
+static void exec_one_dummy_insn (void);
extern void
-fixup_breakpoints PARAMS ((CORE_ADDR low, CORE_ADDR high, CORE_ADDR delta));
+fixup_breakpoints (CORE_ADDR low, CORE_ADDR high, CORE_ADDR delta);
/* Conversion from gdb-to-system special purpose register numbers.. */
else if (regno < FP0_REGNUM) /* a GPR */
{
+ if (regno == SP_REGNUM)
+ exec_one_dummy_insn ();
ptrace (PT_WRITE_GPR, inferior_pid, (PTRACE_ARG3_TYPE) regno,
*(int *) ®isters[REGISTER_BYTE (regno)], 0);
}
*(int *) ®isters[REGISTER_BYTE (regno)], 0);
}
+ else if (regno < NUM_REGS)
+ {
+ /* Ignore it. */
+ }
+
else
fprintf_unfiltered (gdb_stderr,
"Gdb error: register no %d not implemented.\n",
objfile = symfile_objfile;
}
- new_offsets = alloca
- (sizeof (struct section_offsets)
- + sizeof (new_offsets->offsets) * objfile->num_sections);
+ new_offsets = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS);
for (i = 0; i < objfile->num_sections; ++i)
ANOFFSET (new_offsets, i) = ANOFFSET (objfile->section_offsets, i);
/* The symbols in the object file are linked to the VMA of the section,
relocate them VMA relative. */
- ANOFFSET (new_offsets, SECT_OFF_TEXT) = vp->tstart - vp->tvma;
- ANOFFSET (new_offsets, SECT_OFF_DATA) = vp->dstart - vp->dvma;
- ANOFFSET (new_offsets, SECT_OFF_BSS) = vp->dstart - vp->dvma;
+ ANOFFSET (new_offsets, SECT_OFF_TEXT (objfile)) = vp->tstart - vp->tvma;
+ ANOFFSET (new_offsets, SECT_OFF_DATA (objfile)) = vp->dstart - vp->dvma;
+ ANOFFSET (new_offsets, SECT_OFF_BSS (objfile)) = vp->dstart - vp->dvma;
objfile_relocate (objfile, new_offsets);
}
{
struct objfile *obj = (struct objfile *) arg;
- syms_from_objfile (obj, 0, 0, 0);
+ syms_from_objfile (obj, NULL, 0, 0);
new_symfile_objfile (obj, 0, 0);
return 1;
}
objname, bfd_errmsg (bfd_get_error ()));
/*NOTREACHED */
}
- obj = allocate_objfile (vp->bfd, 0, 0, 0);
+ obj = allocate_objfile (vp->bfd, 0);
vp->objfile = obj;
#ifndef SOLIB_SYMBOLS_MANUAL
xcoff_relocate_symtab (pid)
unsigned int pid;
{
-#define MAX_LOAD_SEGS 64 /* maximum number of load segments */
-
- struct ld_info *ldi;
-
- ldi = (void *) alloca (MAX_LOAD_SEGS * sizeof (*ldi));
-
- /* According to my humble theory, AIX has some timing problems and
- when the user stack grows, kernel doesn't update stack info in time
- and ptrace calls step on user stack. That is why we sleep here a little,
- and give kernel to update its internals. */
+ int load_segs = 64; /* number of load segments */
+ int rc;
+ struct ld_info *ldi = NULL;
- usleep (36000);
+ do
+ {
+ ldi = (void *) xrealloc (ldi, load_segs * sizeof (*ldi));
- errno = 0;
- ptrace (PT_LDINFO, pid, (PTRACE_ARG3_TYPE) ldi,
- MAX_LOAD_SEGS * sizeof (*ldi), (int *) ldi);
- if (errno)
- perror_with_name ("ptrace ldinfo");
+ /* According to my humble theory, AIX has some timing problems and
+ when the user stack grows, kernel doesn't update stack info in time
+ and ptrace calls step on user stack. That is why we sleep here a
+ little, and give kernel to update its internals. */
- vmap_ldinfo (ldi);
+ usleep (36000);
- /* relocate the exec and core sections as well. */
- vmap_exec ();
+ errno = 0;
+ rc = ptrace (PT_LDINFO, pid, (PTRACE_ARG3_TYPE) ldi,
+ load_segs * sizeof (*ldi), (int *) ldi);
+ if (rc == -1)
+ {
+ if (errno == ENOMEM)
+ load_segs *= 2;
+ else
+ perror_with_name ("ptrace ldinfo");
+ }
+ else
+ {
+ vmap_ldinfo (ldi);
+ vmap_exec (); /* relocate the exec and core sections as well. */
+ }
+ } while (rc == -1);
+ if (ldi)
+ free (ldi);
}
\f
/* Core file stuff. */
add our sections to the section table for the core target. */
if (vp != vmap)
{
- int count;
struct section_table *stp;
- int update_coreops;
-
- /* We must update the to_sections field in the core_ops structure
- now to avoid dangling pointer dereferences. */
- update_coreops = core_ops.to_sections == target->to_sections;
-
- count = target->to_sections_end - target->to_sections;
- count += 2;
- target->to_sections = (struct section_table *)
- xrealloc (target->to_sections,
- sizeof (struct section_table) * count);
- target->to_sections_end = target->to_sections + count;
-
- /* 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;
- }
+
+ target_resize_to_sections (target, 2);
stp = target->to_sections_end - 2;
stp->bfd = vp->bfd;
static struct core_fns rs6000_core_fns =
{
- bfd_target_coff_flavour,
- fetch_core_registers,
- NULL
+ bfd_target_coff_flavour, /* core_flavour */
+ default_check_format, /* check_format */
+ default_core_sniffer, /* core_sniffer */
+ fetch_core_registers, /* core_read_registers */
+ NULL /* next */
};
void