#include "xcoffsolib.h"
-#include <sys/param.h>
-#include <sys/dir.h>
-#include <sys/user.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-
#include <a.out.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <sys/core.h>
-#include <sys/ldr.h>
-
extern struct obstack frame_cache_obstack;
dest = read_register (LR_REGNUM) & ~3;
else if (ext_op == 528) /* br cond to count reg */
- dest = read_register (CTR_REGNUM) & ~3;
-
+ {
+ dest = read_register (CTR_REGNUM) & ~3;
+
+ /* If we are about to execute a system call, dest is something
+ like 0x22fc or 0x3b00. Upon completion the system call
+ will return to the address in the link register. */
+ if (dest < TEXT_SEGMENT_BASE)
+ dest = read_register (LR_REGNUM) & ~3;
+ }
else return -1;
break;
skip_prologue (pc)
CORE_ADDR pc;
{
+ char buf[4];
unsigned int tmp;
- unsigned int op; /* FIXME, assumes instruction size matches host int!!! */
+ unsigned long op;
- if (target_read_memory (pc, (char *)&op, sizeof (op)))
+ if (target_read_memory (pc, buf, 4))
return pc; /* Can't access it -- assume no prologue. */
- SWAP_TARGET_AND_HOST (&op, sizeof (op));
+ op = extract_unsigned_integer (buf, 4);
/* Assume that subsequent fetches can fail with low probability. */
set_current_frame (create_new_frame (prev_sp, lr));
}
-
/* fixup the call sequence of a dummy function, with the real function address.
its argumets will be passed by gdb. */
if (tmp == 0x93e1) {
if (fdata->offset)
/* fatal ("Unrecognized prolog."); */
- printf ("Unrecognized prolog!\n");
+ printf_unfiltered ("Unrecognized prolog!\n");
fdata->saved_gpr = 31;
tmp2 = op & 0xffff;
CORE_ADDR
push_arguments (nargs, args, sp, struct_return, struct_addr)
int nargs;
- value *args;
+ value_ptr *args;
CORE_ADDR sp;
int struct_return;
CORE_ADDR struct_addr;
int argno; /* current argument number */
int argbytes; /* current argument byte */
char tmp_buffer [50];
- value arg;
+ value_ptr arg;
int f_argno = 0; /* current floating point argno */
CORE_ADDR saved_sp, pc;
if ( dummy_frame_count <= 0)
- printf ("FATAL ERROR -push_arguments()! frame not found!!\n");
+ printf_unfiltered ("FATAL ERROR -push_arguments()! frame not found!!\n");
/* The first eight words of ther arguments are passed in registers. Copy
them appropriately.
there is no way we would run out of them. */
if (len > 8)
- printf (
+ printf_unfiltered (
"Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno);
- bcopy (VALUE_CONTENTS (arg),
- ®isters[REGISTER_BYTE(FP0_REGNUM + 1 + f_argno)], len);
+ memcpy (®isters[REGISTER_BYTE(FP0_REGNUM + 1 + f_argno)], VALUE_CONTENTS (arg),
+ len);
++f_argno;
}
while (argbytes < len) {
*(int*)®isters[REGISTER_BYTE(ii+3)] = 0;
- bcopy ( ((char*)VALUE_CONTENTS (arg))+argbytes,
- ®isters[REGISTER_BYTE(ii+3)],
+ memcpy (®isters[REGISTER_BYTE(ii+3)],
+ ((char*)VALUE_CONTENTS (arg))+argbytes,
(len - argbytes) > 4 ? 4 : len - argbytes);
++ii, argbytes += 4;
}
else { /* Argument can fit in one register. No problem. */
*(int*)®isters[REGISTER_BYTE(ii+3)] = 0;
- bcopy (VALUE_CONTENTS (arg), ®isters[REGISTER_BYTE(ii+3)], len);
+ memcpy (®isters[REGISTER_BYTE(ii+3)], VALUE_CONTENTS (arg), len);
}
++argno;
}
if ((argno < nargs) || argbytes) {
int space = 0, jj;
- value val;
+ value_ptr val;
if (argbytes) {
space += ((len - argbytes + 3) & -4);
if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_FLT && f_argno < 13) {
if (len > 8)
- printf (
+ printf_unfiltered (
"Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno);
- bcopy (VALUE_CONTENTS (arg),
- ®isters[REGISTER_BYTE(FP0_REGNUM + 1 + f_argno)], len);
+ memcpy (®isters[REGISTER_BYTE(FP0_REGNUM + 1 + f_argno)], VALUE_CONTENTS (arg),
+ len);
++f_argno;
}
necessary. */
if (TYPE_LENGTH (valtype) > 4) /* this is a double */
- bcopy (®buf[REGISTER_BYTE (FP0_REGNUM + 1)], valbuf,
+ memcpy (valbuf, ®buf[REGISTER_BYTE (FP0_REGNUM + 1)],
TYPE_LENGTH (valtype));
else { /* float */
- bcopy (®buf[REGISTER_BYTE (FP0_REGNUM + 1)], &dd, 8);
+ memcpy (&dd, ®buf[REGISTER_BYTE (FP0_REGNUM + 1)], 8);
ff = (float)dd;
- bcopy (&ff, valbuf, sizeof(float));
+ memcpy (valbuf, &ff, sizeof(float));
}
}
else
/* return value is copied starting from r3. */
- bcopy (®buf[REGISTER_BYTE (3)], valbuf, TYPE_LENGTH (valtype));
+ memcpy (valbuf, ®buf[REGISTER_BYTE (3)], TYPE_LENGTH (valtype));
}
if (fi->next != NULL)
/* Don't even think about framelessness except on the innermost frame. */
+ /* FIXME: Can also be frameless if fi->next->signal_handler_caller (if
+ a signal happens while executing in a frameless function). */
return 0;
func_start = get_pc_function_start (fi->pc) + FUNCTION_START_OFFSET;
fi->cache_fsr = (struct frame_saved_regs *)
obstack_alloc (&frame_cache_obstack, sizeof (struct frame_saved_regs));
- bzero (fi->cache_fsr, sizeof (struct frame_saved_regs));
+ memset (fi->cache_fsr, '\0', sizeof (struct frame_saved_regs));
if (fi->prev && fi->prev->frame)
frame_addr = fi->prev->frame;
return fp;
}
-
-\f
-/* xcoff_relocate_symtab - hook for symbol table relocation.
- also reads shared libraries.. */
-
-xcoff_relocate_symtab (pid)
-unsigned int pid;
-{
-#define MAX_LOAD_SEGS 64 /* maximum number of load segments */
-
- struct ld_info *ldi;
- int temp;
-
- 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. */
-
- usleep (36000);
-
- errno = 0;
- ptrace(PT_LDINFO, pid, (PTRACE_ARG3_TYPE) ldi,
- MAX_LOAD_SEGS * sizeof(*ldi), ldi);
- if (errno) {
- perror_with_name ("ptrace ldinfo");
- return 0;
- }
-
- vmap_ldinfo(ldi);
-
- do {
- /* We are allowed to assume CORE_ADDR == pointer. This code is
- native only. */
- add_text_to_loadinfo ((CORE_ADDR) ldi->ldinfo_textorg,
- (CORE_ADDR) ldi->ldinfo_dataorg);
- } while (ldi->ldinfo_next
- && (ldi = (void *) (ldi->ldinfo_next + (char *) ldi)));
-
-#if 0
- /* Now that we've jumbled things around, re-sort them. */
- sort_minimal_symbols ();
-#endif
-
- /* relocate the exec and core sections as well. */
- vmap_exec ();
-}
\f
/* Keep an array of load segment information and their TOC table addresses.
This info will be useful when calling a shared library function by hand. */
loadinfo [loadinfotocindex++].toc_offset = tocoff;
}
-
void
add_text_to_loadinfo (textaddr, dataaddr)
CORE_ADDR textaddr;