34 #include <asm/ptrace.h> 35 #include <sys/types.h> 40 #define INSTR_SC 0x44000002 41 #define NR_spu_run 0x0116 79 xsnprintf (mess,
sizeof mess,
"reading PPC register #%d", regno);
95 uint64_t addr_8 = (uint64_t) memaddr;
111 #ifndef __powerpc64__ 114 uint64_t addr_8 = (uint64_t) memaddr;
245 xsnprintf (buf,
sizeof buf,
"/proc/%d/fd/%s",
pid, annex);
246 fd = open (buf, writebuf? O_WRONLY : O_RDONLY);
258 ret = write (fd, writebuf, (
size_t) len);
260 ret =
read (fd, readbuf, (
size_t) len);
295 file_ptr nbytes, file_ptr
offset)
301 bfd_set_error (bfd_error_invalid_operation);
316 memset (sb, 0,
sizeof (
struct stat));
327 *open_closure = addr;
337 if (!bfd_check_format (nbfd.
get (), bfd_object))
341 spu_name = bfd_get_section_by_name (nbfd.
get (),
".note.spu_name");
344 int sect_size = bfd_section_size (nbfd.
get (), spu_name);
347 char *buf = (
char *)alloca (sect_size - 20 + 1);
348 bfd_get_section_contents (nbfd.
get (), spu_name, buf, 20,
350 buf[sect_size - 20] =
'\0';
352 xfree ((
char *)nbfd->filename);
353 nbfd->filename = xstrdup (buf);
375 xsnprintf (annex,
sizeof annex,
"%d/object-id", inferior_fd);
380 addr =
strtoulst ((
const char *)
id, NULL, 16);
410 waitpid (
tid, NULL,
__WALL | __WNOTHREAD);
428 waitpid (
pid, NULL,
__WALL | __WNOTHREAD);
453 if (
pid == -1 && errno == ECHILD)
470 while (
pid == -1 && save_errno == EINTR);
474 warning (
_(
"Child process unexpectedly missing: %s"),
479 ourstatus->
value.
sig = GDB_SIGNAL_UNKNOWN;
523 if (regno == -1 || (regno >= 0 && regno <
SPU_NUM_GPRS))
530 xsnprintf (annex,
sizeof annex,
"%d/regs", fd);
533 && len ==
sizeof buf)
565 if (regno == -1 || (regno >= 0 && regno <
SPU_NUM_GPRS))
575 xsnprintf (annex,
sizeof annex,
"%d/regs", fd);
595 char mem_annex[32], lslr_annex[32];
605 xsnprintf (mem_annex,
sizeof mem_annex,
"%d/mem", fd);
615 xsnprintf (lslr_annex,
sizeof lslr_annex,
"%d/lslr", fd);
616 memset (buf, 0,
sizeof buf);
621 lslr =
strtoulst ((
const char *) buf, NULL, 16);
623 offset & lslr, len, xfered_len);
struct gdbarch * target_gdbarch(void)
void add_target(struct target_ops *t)
ssize_t read(int fd, void *buf, size_t count)
static constexpr ptid_t tid
static file_ptr spu_bfd_iovec_pread(struct bfd *abfd, void *stream, void *buf, file_ptr nbytes, file_ptr offset)
static int store_ppc_memory_1(int tid, ULONGEST memaddr, PTRACE_TYPE_RET word)
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 int fetch_ppc_memory(ULONGEST memaddr, gdb_byte *myaddr, int len)
void warning(const char *fmt,...)
char * get_exec_file(int err)
ptid_t regcache_get_ptid(const struct regcache *regcache)
void * memset(T *s, int c, size_t n)=delete
union target_waitstatus::@174 value
void set_sigint_trap(void)
static enum target_xfer_status spu_proc_xfer_spu(const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
int(* to_can_use_hw_breakpoint)(struct target_ops *, enum bptype, int, int) TARGET_DEFAULT_RETURN(0)
struct target_ops * inf_ptrace_target(void)
scoped_restore_tmpl< T > make_scoped_restore(T *var)
static void spu_symbol_file_add_from_memory(int inferior_fd)
struct objfile * symbol_file_add_from_bfd(bfd *abfd, const char *name, symfile_add_flags add_flags, struct section_addr_info *addrs, objfile_flags flags, struct objfile *parent)
static void spu_child_post_attach(struct target_ops *self, int pid)
static ULONGEST extract_unsigned_integer(const gdb_byte *addr, int len, enum bfd_endian byte_order)
ptid_t pid_to_ptid(int pid)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
void _initialize_spu_nat(void)
void store_waitstatus(struct target_waitstatus *ourstatus, int hoststatus)
static int spu_bfd_iovec_stat(struct bfd *abfd, void *stream, struct stat *sb)
static gdb_bfd_ref_ptr spu_bfd_open(ULONGEST addr)
static int store_ppc_memory(ULONGEST memaddr, const gdb_byte *myaddr, int len)
static void spu_fetch_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regno)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
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)
ULONGEST strtoulst(const char *num, const char **trailer, int base)
static void spu_child_post_startup_inferior(struct target_ops *self, ptid_t ptid)
static int parse_spufs_run(int *fd, ULONGEST *addr)
long ptid_get_lwp(const ptid_t &ptid)
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
int xsnprintf(char *str, size_t size, const char *format,...)
static int spu_bfd_iovec_close(struct bfd *nbfd, void *stream)
enum target_waitkind kind
gdb_bfd_ref_ptr gdb_bfd_openr_iovec(const char *filename, const char *target, void *(*open_func)(struct bfd *nbfd, void *open_closure), void *open_closure, file_ptr(*pread_func)(struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes, file_ptr offset), int(*close_func)(struct bfd *nbfd, void *stream), int(*stat_func)(struct bfd *abfd, void *stream, struct stat *sb))
char * safe_strerror(int)
void(* to_post_attach)(struct target_ops *, int) TARGET_DEFAULT_IGNORE()
static int fetch_ppc_memory_1(int tid, ULONGEST memaddr, PTRACE_TYPE_RET *word)
static void * spu_bfd_iovec_open(struct bfd *nbfd, void *open_closure)
static enum target_xfer_status spu_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 regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
unsigned long long ULONGEST
static int spu_can_use_hw_breakpoint(struct target_ops *self, enum bptype type, int cnt, int othertype)
static void spu_store_inferior_registers(struct target_ops *ops, struct regcache *regcache, int regno)
void clear_sigint_trap(void)
void regcache_raw_collect(const struct regcache *regcache, int regnum, void *buf)
static ptid_t spu_child_wait(struct target_ops *ops, ptid_t ptid, struct target_waitstatus *ourstatus, int options)
static ULONGEST fetch_ppc_register(int regno)
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)
enum bfd_endian byte_order
void(* to_post_startup_inferior)(struct target_ops *, ptid_t) TARGET_DEFAULT_IGNORE()
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)