39 #ifdef PT_GET_PROCESS_STATE 45 inf_ptrace_follow_fork (
struct target_ops *ops,
int follow_child,
64 inf_ptrace_insert_fork_catchpoint (
struct target_ops *
self,
int pid)
70 inf_ptrace_remove_fork_catchpoint (
struct target_ops *
self,
int pid)
96 char **env,
int from_tty)
106 if (! ops_already_pushed)
131 #ifdef PT_GET_PROCESS_STATE 139 memset (&pe, 0,
sizeof pe);
140 pe.pe_set_event |= PTRACE_FORK;
181 if (
pid == getpid ())
182 error (
_(
"I refuse to debug myself!"));
184 if (! ops_already_pushed)
212 error (
_(
"This system does not support attaching to a process"));
217 inf->attach_flag = 1;
227 #ifdef PT_GET_PROCESS_STATE 235 memset (&pe, 0,
sizeof pe);
236 pe.pe_set_event |= PTRACE_FORK;
267 error (
_(
"This system does not support detaching from a process"));
338 ptid_t ptid,
int step,
enum gdb_signal signal)
394 while (
pid == -1 && errno == EINTR);
401 _(
"Child process unexpectedly missing: %s.\n"),
406 ourstatus->
value.
sig = GDB_SIGNAL_UNKNOWN;
416 #ifdef PT_GET_PROCESS_STATE 426 switch (pe.pe_report_event)
433 fpid = waitpid (pe.pe_other_pid, &
status, 0);
437 if (
ptrace (PT_GET_PROCESS_STATE, fpid,
441 gdb_assert (pe.pe_report_event == PTRACE_FORK);
500 memcpy (readbuf + n, buf.byte + skip, chunk);
502 if (writebuf != NULL)
504 memcpy (buf.byte + skip, writebuf + n, chunk);
528 const char *annex,
gdb_byte *readbuf,
542 struct ptrace_io_desc piod;
550 piod.piod_op = writebuf ? PIOD_WRITE_I : PIOD_READ_D;
551 piod.piod_addr = writebuf ? (
void *) writebuf : readbuf;
552 piod.piod_offs = (
void *) (
long)
offset;
556 if (
ptrace (PT_IO,
pid, (caddr_t)&piod, 0) == 0)
559 *xfered_len = piod.piod_len;
577 #if defined (PT_IO) && defined (PIOD_READ_AUXV) 582 struct ptrace_io_desc piod;
586 piod.piod_op = PIOD_READ_AUXV;
587 piod.piod_addr = readbuf;
588 piod.piod_offs = (
void *) (
long)
offset;
592 if (
ptrace (PT_IO,
pid, (caddr_t)&piod, 0) == 0)
595 *xfered_len = piod.piod_len;
627 inf->attach_flag ?
"attached" :
"child",
637 #if defined (PT_IO) && defined (PIOD_READ_AUXV) 650 const int sizeof_auxv_type =
TYPE_LENGTH (int_type);
651 const int sizeof_auxv_val =
TYPE_LENGTH (ptr_type);
658 if (endptr - ptr < 2 * sizeof_auxv_val)
662 ptr += sizeof_auxv_val;
664 ptr += sizeof_auxv_val;
687 #ifdef PT_GET_PROCESS_STATE 699 #if defined (PT_IO) && defined (PIOD_READ_AUXV) 744 error (
_(
"Couldn't read register %s (#%d): %s."),
800 error (
_(
"Couldn't write register %s (#%d): %s."),
struct gdbarch * target_gdbarch(void)
int catch_syscall_enabled(void)
static void inf_ptrace_files_info(struct target_ops *ignore)
static void inf_ptrace_store_registers(struct target_ops *ops, struct regcache *regcache, int regnum)
void target_announce_detach(int from_tty)
static void inf_ptrace_fetch_registers(struct target_ops *ops, struct regcache *regcache, int regnum)
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
void push_target(struct target_ops *t)
char * get_exec_file(int err)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
static void inf_ptrace_interrupt(struct target_ops *self, ptid_t ptid)
ptid_t regcache_get_ptid(const struct regcache *regcache)
int(* to_follow_fork)(struct target_ops *, int, int) TARGET_DEFAULT_FUNC(default_follow_fork)
void * memset(T *s, int c, size_t n)=delete
struct thread_info * inferior_thread(void)
const char *(* to_pid_to_str)(struct target_ops *, ptid_t) TARGET_DEFAULT_FUNC(default_pid_to_str)
union target_waitstatus::@174 value
void set_sigint_trap(void)
int gdbarch_num_regs(struct gdbarch *gdbarch)
struct target_ops * inf_ptrace_target(void)
void inf_child_maybe_unpush_target(struct target_ops *ops)
struct target_ops * inf_ptrace_trad_target(CORE_ADDR(*register_u_offset)(struct gdbarch *, int, int))
void printf_filtered(const char *format,...)
static int inf_ptrace_thread_alive(struct target_ops *ops, ptid_t ptid)
static ULONGEST inf_ptrace_peek_poke(pid_t pid, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST addr, ULONGEST len)
void(* to_files_info)(struct target_ops *) TARGET_DEFAULT_IGNORE()
struct cleanup * make_cleanup_unpush_target(struct target_ops *ops)
void null_cleanup(void *arg)
const char * normal_pid_to_str(ptid_t ptid)
int(* to_remove_fork_catchpoint)(struct target_ops *, int) TARGET_DEFAULT_RETURN(1)
static void inf_ptrace_create_inferior(struct target_ops *ops, const char *exec_file, const std::string &allargs, char **env, int from_tty)
static ULONGEST extract_unsigned_integer(const gdb_byte *addr, int len, enum bfd_endian byte_order)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
int gdbarch_cannot_store_register(struct gdbarch *gdbarch, int regnum)
void(* to_resume)(struct target_ops *, ptid_t, int TARGET_DEBUG_PRINTER(target_debug_print_step), enum gdb_signal) TARGET_DEFAULT_NORETURN(noprocess())
int gdbarch_cannot_fetch_register(struct gdbarch *gdbarch, int regnum)
static void inf_ptrace_kill(struct target_ops *ops)
ptid_t pid_to_ptid(int pid)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
static ptid_t inf_ptrace_wait(struct target_ops *ops, ptid_t ptid, struct target_waitstatus *ourstatus, int options)
void store_waitstatus(struct target_waitstatus *ourstatus, int hoststatus)
int gdb_signal_to_host(enum gdb_signal)
pid_t inferior_process_group(void)
struct target_waitstatus pending_follow
void target_mourn_inferior(ptid_t ptid)
const char * gdbarch_register_name(struct gdbarch *gdbarch, int regnr)
int(* to_insert_fork_catchpoint)(struct target_ops *, int) TARGET_DEFAULT_RETURN(1)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
static void inf_ptrace_detach(struct target_ops *ops, const char *args, int from_tty)
static enum target_xfer_status inf_ptrace_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)
struct thread_info * add_thread_silent(ptid_t ptid)
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)
void printf_unfiltered(const char *format,...)
void(* to_detach)(struct target_ops *ops, const char *, int) TARGET_DEFAULT_IGNORE()
void inf_child_mourn_inferior(struct target_ops *ops)
ptid_t gdb_startup_inferior(pid_t pid, int num_traps)
long ptid_get_lwp(const ptid_t &ptid)
int target_is_pushed(struct target_ops *t)
int(* to_auxv_parse)(struct target_ops *ops, gdb_byte **readptr, gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp) TARGET_DEFAULT_FUNC(default_auxv_parse)
static void inf_ptrace_store_register(const struct regcache *regcache, int regnum)
static void inf_ptrace_me(void)
struct target_ops * inf_child_target(void)
void discard_cleanups(struct cleanup *old_chain)
void(* to_fetch_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_IGNORE()
static void inf_ptrace_mourn_inferior(struct target_ops *ops)
void(* to_mourn_inferior)(struct target_ops *) TARGET_DEFAULT_FUNC(default_mourn_inferior)
void trace_start_error_with_name(const char *string)
void void void void void void void void void perror_with_name(const char *string) ATTRIBUTE_NORETURN
pid_t fork_inferior(const char *exec_file_arg, const std::string &allargs, char **env, void(*traceme_fun)(), void(*init_trace_fun)(int), void(*pre_trace_fun)(), const char *shell_file_arg, void(*exec_fun)(const char *file, char *const *argv, char *const *env))
enum target_waitkind kind
void(* to_kill)(struct target_ops *) TARGET_DEFAULT_NORETURN(noprocess())
struct type * builtin_data_ptr
void detach_inferior(int pid)
char * safe_strerror(int)
static void inf_ptrace_resume(struct target_ops *ops, ptid_t ptid, int step, enum gdb_signal signal)
const char * target_pid_to_str(ptid_t ptid)
void(* to_post_attach)(struct target_ops *, int) TARGET_DEFAULT_IGNORE()
static void inf_ptrace_fetch_register(struct regcache *regcache, int regnum)
int parse_pid_to_attach(const char *args)
static const char * inf_ptrace_pid_to_str(struct target_ops *ops, ptid_t ptid)
int ptid_equal(const ptid_t &ptid1, const ptid_t &ptid2)
#define START_INFERIOR_TRAPS_EXPECTED
struct inferior * current_inferior(void)
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
unsigned long long ULONGEST
static int ignore(struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
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)
void(* to_interrupt)(struct target_ops *, ptid_t) TARGET_DEFAULT_IGNORE()
static void inf_ptrace_attach(struct target_ops *ops, const char *args, int from_tty)
void(* to_create_inferior)(struct target_ops *, const char *, const std::string &, char **, int)
#define TYPE_LENGTH(thistype)
int(* to_thread_alive)(struct target_ops *, ptid_t ptid) TARGET_DEFAULT_RETURN(0)
pid_t get_ptrace_pid(ptid_t ptid)
void(* to_attach)(struct target_ops *ops, const char *, int)
void gdb_flush(struct ui_file *file)
static CORE_ADDR(* inf_ptrace_register_u_offset)(struct gdbarch *, int, int)
void inf_ptrace_detach_success(struct target_ops *ops)
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)
void error(const char *fmt,...)
#define target_post_startup_inferior(ptid)
void inferior_appeared(struct inferior *inf, int pid)
void(* to_post_startup_inferior)(struct target_ops *, ptid_t) TARGET_DEFAULT_IGNORE()
struct type * builtin_int