40 #include <sys/ptrace.h>
46 #include <sys/ioctl.h>
54 #define __LDINFO_PTRACE32__
55 #define __LDINFO_PTRACE64__
57 #include <sys/systemcfg.h>
66 #if defined (__ld_info32) || defined (__ld_info64)
75 # define ARCH64() (register_size (target_gdbarch (), 0) == 8)
128 int ret = ptrace64 (req,
id, (uintptr_t) addr, data, buf);
130 int ret =
ptrace (req,
id, (
int *)addr, data, buf);
133 printf (
"rs6000_ptrace32 (%d, %d, 0x%x, %08x, 0x%x) = 0x%x\n",
134 req,
id, (
unsigned int)addr, data, (
unsigned int)buf, ret);
145 # ifdef HAVE_PTRACE64
146 int ret = ptrace64 (req,
id, addr, data, buf);
148 int ret = ptracex (req,
id, addr, data, buf);
154 printf (
"rs6000_ptrace64 (%d, %d, %s, %08x, 0x%x) = 0x%x\n",
155 req,
id,
hex_string (addr), data, (
unsigned int)buf, ret);
172 nr =
regmap (gdbarch, regno, &isfloat);
183 "gdb error: register no %d not implemented.\n",
202 memcpy (addr, &buf, 8);
214 perror (
_(
"ptrace read"));
235 nr =
regmap (gdbarch, regno, &isfloat);
246 "gdb error: register no %d not implemented.\n",
258 (
int *) nr, *addr, 0);
265 memcpy (&buf, addr, 8);
275 perror (
_(
"ptrace write"));
369 const char *annex,
gdb_byte *readbuf,
381 offset, len, xfered_len);
402 if (partial_len > len)
410 if (rounded_offset < offset
411 || (offset + partial_len
417 rounded_offset, 0, NULL);
427 memcpy (
buffer.byte + (offset - rounded_offset),
428 writebuf, partial_len);
433 rounded_offset,
buffer.word, NULL);
436 (
int *) (uintptr_t) rounded_offset,
447 rounded_offset, 0, NULL);
450 (
int *)(uintptr_t)rounded_offset,
456 memcpy (readbuf,
buffer.byte + (offset - rounded_offset),
460 *xfered_len = (
ULONGEST) partial_len;
489 while (pid == -1 && errno == EINTR);
496 _(
"Child process unexpectedly missing: %s.\n"),
501 ourstatus->
value.
sig = GDB_SIGNAL_UNKNOWN;
517 else if (status == 0x7f)
531 char *allargs,
char **env,
int from_tty);
534 char *allargs,
char **env,
int from_tty)
536 enum bfd_architecture arch;
545 arch = bfd_arch_rs6000;
546 mach = bfd_mach_rs6k;
550 arch = bfd_arch_powerpc;
564 const struct bfd_arch_info *exec_bfd_arch_info;
566 exec_bfd_arch_info = bfd_get_arch_info (
exec_bfd);
567 if (arch == exec_bfd_arch_info->arch)
571 bfd_default_set_arch_mach (&abfd, arch, mach);
579 _(
"rs6000_create_inferior: failed "
580 "to select architecture"));
645 readbuf, offset, len, 1);
654 *xfered_len = result;
struct gdbarch * target_gdbarch(void)
void add_target(struct target_ops *t)
char * hex_string(LONGEST num)
struct gdbarch * get_regcache_arch(const struct regcache *regcache)
static enum target_xfer_status rs6000_xfer_partial(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
void internal_error(const char *file, int line, const char *fmt,...)
int gdbarch_update_p(struct gdbarch_info info)
void set_sigint_trap(void)
static void rs6000_create_inferior(struct target_ops *ops, char *exec_file, char *allargs, char **env, int from_tty)
int gdbarch_num_regs(struct gdbarch *gdbarch)
ptid_t(* to_wait)(struct target_ops *, ptid_t, struct target_waitstatus *, int TARGET_DEBUG_PRINTER(target_debug_print_options)) TARGET_DEFAULT_NORETURN(noprocess())
const struct bfd_arch_info * bfd_arch_info
struct target_ops * inf_ptrace_target(void)
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
static target_xfer_partial_ftype rs6000_xfer_shared_libraries
static void(* super_create_inferior)(struct target_ops *, char *exec_file, char *allargs, char **env, int from_tty)
void _initialize_rs6000_nat(void)
static void store_register(struct regcache *regcache, int regno)
static void rs6000_store_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regno)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int status
ptid_t pid_to_ptid(int pid)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
void store_waitstatus(struct target_waitstatus *ourstatus, int hoststatus)
union target_waitstatus::@161 value
static int regmap(struct gdbarch *gdbarch, int regno, int *isfloat)
enum target_xfer_status target_xfer_partial_ftype(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
static int rs6000_ptrace64(int req, int id, long long addr, int data, void *buf)
#define target_has_execution
enum target_xfer_status(* to_xfer_partial)(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len) TARGET_DEFAULT_RETURN(TARGET_XFER_E_IO)
static ptid_t rs6000_wait(struct target_ops *ops, ptid_t ptid, struct target_waitstatus *ourstatus, int options)
static void rs6000_fetch_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regno)
int ptid_get_pid(ptid_t ptid)
PTR xrealloc(PTR ptr, size_t size)
void(* to_fetch_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_IGNORE()
void void void void void void void void void perror_with_name(const char *string) ATTRIBUTE_NORETURN
enum target_waitkind kind
void gdbarch_info_init(struct gdbarch_info *info)
struct ui_file * gdb_stderr
static int rs6000_ptrace32(int req, int id, int *addr, int data, int *buf)
char * safe_strerror(int)
void(* to_create_inferior)(struct target_ops *, char *, char *, char **, int)
ULONGEST rs6000_aix_ld_info_to_xml(struct gdbarch *gdbarch, const gdb_byte *ldi_buf, gdb_byte *readbuf, ULONGEST offset, ULONGEST len, int close_ldinfo_fd)
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
static gdb_byte * rs6000_ptrace_ldinfo(ptid_t ptid)
unsigned long long ULONGEST
void clear_sigint_trap(void)
int register_size(struct gdbarch *gdbarch, int regnum)
void regcache_raw_collect(const struct regcache *regcache, int regnum, void *buf)
int gdbarch_pc_regnum(struct gdbarch *gdbarch)
void(* to_store_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int int rusage_t pid_t pid
static void fetch_register(struct regcache *regcache, int regno)
void do_cleanups(struct cleanup *old_chain)
const ULONGEST const LONGEST len