39 #include <sys/ptrace.h> 45 #include <sys/ioctl.h> 53 #define __LDINFO_PTRACE32__ 54 #define __LDINFO_PTRACE64__ 56 #include <sys/systemcfg.h> 65 #if defined (__ld_info32) || defined (__ld_info64) 74 # define ARCH64() (register_size (target_gdbarch (), 0) == 8) 127 int ret = ptrace64 (req,
id, (uintptr_t) addr, data, buf);
129 int ret =
ptrace (req,
id, (
int *)addr, data, buf);
132 printf (
"rs6000_ptrace32 (%d, %d, 0x%x, %08x, 0x%x) = 0x%x\n",
133 req,
id, (
unsigned int)addr, data, (
unsigned int)buf, ret);
144 # ifdef HAVE_PTRACE64 145 int ret = ptrace64 (req,
id, addr, data, (PTRACE_TYPE_ARG5) buf);
147 int ret = ptracex (req,
id, addr, data, (PTRACE_TYPE_ARG5) buf);
153 printf (
"rs6000_ptrace64 (%d, %d, %s, %08x, 0x%x) = 0x%x\n",
154 req,
id,
hex_string (addr), data, (
unsigned int)buf, ret);
183 "gdb error: register no %d not implemented.\n",
200 memcpy (addr, &buf, 8);
212 perror (
_(
"ptrace read"));
245 "gdb error: register no %d not implemented.\n",
263 memcpy (&buf, addr, 8);
272 perror (
_(
"ptrace write"));
366 const char *annex,
gdb_byte *readbuf,
399 if (partial_len > len)
407 if (rounded_offset <
offset 414 rounded_offset, 0, NULL);
425 writebuf, partial_len);
430 rounded_offset,
buffer.word, NULL);
433 (
int *) (uintptr_t) rounded_offset,
444 rounded_offset, 0, NULL);
447 (
int *)(uintptr_t)rounded_offset,
453 memcpy (readbuf,
buffer.byte + (
offset - rounded_offset),
457 *xfered_len = (
ULONGEST) partial_len;
486 while (
pid == -1 && errno == EINTR);
493 _(
"Child process unexpectedly missing: %s.\n"),
498 ourstatus->
value.
sig = GDB_SIGNAL_UNKNOWN;
528 const char *exec_file,
530 char **env,
int from_tty);
533 const std::string &allargs,
char **env,
int from_tty)
535 enum bfd_architecture arch;
544 arch = bfd_arch_rs6000;
545 mach = bfd_mach_rs6k;
549 arch = bfd_arch_powerpc;
563 const struct bfd_arch_info *exec_bfd_arch_info;
565 exec_bfd_arch_info = bfd_get_arch_info (
exec_bfd);
566 if (arch == exec_bfd_arch_info->arch)
570 bfd_default_set_arch_mach (&abfd, arch, mach);
578 _(
"rs6000_create_inferior: failed " 579 "to select architecture"));
595 void *ldi =
xmalloc (ldi_size);
653 *xfered_len = result;
struct gdbarch * target_gdbarch(void)
void add_target(struct target_ops *t)
char * hex_string(LONGEST num)
int ptid_get_pid(const ptid_t &ptid)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int int rusage_t pid_t pid
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)
ptid_t regcache_get_ptid(const struct regcache *regcache)
void internal_error(const char *file, int line, const char *fmt,...)
int gdbarch_update_p(struct gdbarch_info info)
union target_waitstatus::@174 value
void set_sigint_trap(void)
int gdbarch_num_regs(struct gdbarch *gdbarch)
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
#define PPC_MAX_REGISTER_SIZE
static void rs6000_create_inferior(struct target_ops *ops, const char *exec_file, const std::string &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,...)
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)
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)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
#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)
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)
static int rs6000_ptrace32(int req, int id, int *addr, int data, int *buf)
char * safe_strerror(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)
static void(* super_create_inferior)(struct target_ops *, const char *exec_file, const std::string &allargs, char **env, int from_tty)
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_create_inferior)(struct target_ops *, const char *, const std::string &, char **, int)
void(* to_store_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
ptid_t(* to_wait)(struct target_ops *, ptid_t, struct target_waitstatus *, int TARGET_DEBUG_PRINTER(target_debug_print_options)) TARGET_DEFAULT_FUNC(default_target_wait)
static void fetch_register(struct regcache *regcache, int regno)
void do_cleanups(struct cleanup *old_chain)