88 #define BSD_UTHREAD_PTHREAD_MAGIC 0xd09ba115
103 #define BSD_UTHREAD_PS_RUNNING 0
104 #define BSD_UTHREAD_PS_DEAD 18
114 static int bsd_uthread_thread_state_offset = -1;
115 static int bsd_uthread_thread_next_offset = -1;
167 if (bsd_uthread_active)
175 bsd_uthread_thread_run_addr =
177 if (bsd_uthread_thread_run_addr == 0)
180 bsd_uthread_thread_list_addr =
182 if (bsd_uthread_thread_list_addr == 0)
185 bsd_uthread_thread_state_offset =
187 if (bsd_uthread_thread_state_offset == 0)
190 bsd_uthread_thread_next_offset =
192 if (bsd_uthread_thread_next_offset == 0)
195 bsd_uthread_thread_ctx_offset =
199 bsd_uthread_active = 1;
208 bsd_uthread_active = 0;
209 bsd_uthread_thread_run_addr = 0;
210 bsd_uthread_thread_list_addr = 0;
211 bsd_uthread_thread_state_offset = 0;
212 bsd_uthread_thread_next_offset = 0;
213 bsd_uthread_thread_ctx_offset = 0;
214 bsd_uthread_solib_name = NULL;
223 if (!bsd_uthread_active)
236 static const char *bsd_uthread_solib_names[] =
238 "/usr/lib/libc_r.so",
239 "/usr/lib/libpthread.so",
248 for (names = bsd_uthread_solib_names; *names; names++)
266 if (!bsd_uthread_solib_name)
300 if (addr != 0 && addr != active_addr)
304 addr + bsd_uthread_thread_ctx_offset);
319 if (addr != 0 && addr != active_addr)
323 addr + bsd_uthread_thread_ctx_offset);
342 ptid = beneath->
to_wait (beneath, ptid, status, options);
389 beneath->
to_resume (beneath, ptid, step, sig);
444 static char *bsd_uthread_state[] =
484 if (state < ARRAY_SIZE (bsd_uthread_state))
485 return bsd_uthread_state[state];
498 xsnprintf (buf,
sizeof buf,
"process %d, thread 0x%lx",
513 t->
to_doc =
"BSD user-level threads";
526 bsd_uthread_ops_hack = t;
struct gdbarch * target_gdbarch(void)
ULONGEST extract_unsigned_integer(const gdb_byte *, int, enum bfd_endian)
static ptid_t bsd_uthread_wait(struct target_ops *ops, ptid_t ptid, struct target_waitstatus *status, int options)
struct thread_info * add_thread(ptid_t ptid)
static int bsd_uthread_thread_next_offset
static CORE_ADDR bsd_uthread_read_memory_address(CORE_ADDR addr)
struct gdbarch * get_regcache_arch(const struct regcache *regcache)
#define BMSYMBOL_VALUE_ADDRESS(symbol)
char *(* to_pid_to_str)(struct target_ops *, ptid_t) TARGET_DEFAULT_FUNC(default_pid_to_str)
void push_target(struct target_ops *t)
void * gdbarch_data(struct gdbarch *gdbarch, struct gdbarch_data *data)
char *(* to_extra_thread_info)(struct target_ops *, struct thread_info *) TARGET_DEFAULT_RETURN(NULL)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
int unpush_target(struct target_ops *t)
void(* to_close)(struct target_ops *)
static const char * bsd_uthread_solib_name
static int bsd_uthread_thread_ctx_offset
struct gdbarch_data * gdbarch_data_register_pre_init(gdbarch_data_pre_init_ftype *pre_init)
void bsd_uthread_set_collect_uthread(struct gdbarch *gdbarch, void(*collect_uthread)(const struct regcache *, int, CORE_ADDR))
ptid_t(* to_wait)(struct target_ops *, ptid_t, struct target_waitstatus *, int TARGET_DEBUG_PRINTER(target_debug_print_options)) TARGET_DEFAULT_NORETURN(noprocess())
static struct target_ops * bsd_uthread_target(void)
static void bsd_uthread_update_thread_list(struct target_ops *ops)
static CORE_ADDR bsd_uthread_lookup_address(const char *name, struct objfile *objfile)
static const char * bsd_uthread_solib_names[]
void(* collect_uthread)(const struct regcache *, int, CORE_ADDR)
ptid_t ptid_build(int pid, long lwp, long tid)
struct observer * observer_attach_inferior_created(observer_inferior_created_ftype *f)
int in_thread_list(ptid_t ptid)
static char * bsd_uthread_pid_to_str(struct target_ops *ops, ptid_t ptid)
static int bsd_uthread_active
void initialize_file_ftype(void)
static char * bsd_uthread_extra_thread_info(struct target_ops *self, struct thread_info *info)
static struct target_ops * bsd_uthread_ops_hack
void complete_target_initialization(struct target_ops *t)
static void bsd_uthread_inferior_created(struct target_ops *ops, int from_tty)
static void bsd_uthread_fetch_registers(struct target_ops *ops, struct regcache *regcache, int regnum)
static CORE_ADDR bsd_uthread_thread_list_addr
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int status
void(* to_resume)(struct target_ops *, ptid_t, int TARGET_DEBUG_PRINTER(target_debug_print_step), enum gdb_signal) TARGET_DEFAULT_NORETURN(noprocess())
struct observer * observer_attach_solib_unloaded(observer_solib_unloaded_ftype *f)
char so_original_name[SO_NAME_MAX_PATH_SIZE]
int solib_read_symbols(struct so_list *so, int flags)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
static void * bsd_uthread_init(struct obstack *obstack)
initialize_file_ftype _initialize_bsd_uthread
void thread_change_ptid(ptid_t old_ptid, ptid_t new_ptid)
static int startswith(const char *string, const char *pattern)
#define BSD_UTHREAD_PS_DEAD
static int bsd_uthread_lookup_offset(const char *name, struct objfile *objfile)
struct target_ops * find_target_beneath(struct target_ops *t)
static void bsd_uthread_deactivate(void)
static int bsd_uthread_thread_state_offset
char * normal_pid_to_str(ptid_t ptid)
int ptid_get_pid(ptid_t ptid)
static struct gdbarch_data * bsd_uthread_data
const char const char int
static int bsd_uthread_thread_alive(struct target_ops *ops, ptid_t ptid)
void(* to_fetch_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_IGNORE()
long ptid_get_tid(ptid_t ptid)
void(* to_mourn_inferior)(struct target_ops *) TARGET_DEFAULT_FUNC(default_mourn_inferior)
static void bsd_uthread_solib_loaded(struct so_list *so)
int xsnprintf(char *str, size_t size, const char *format,...)
enum target_waitkind kind
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
static void bsd_uthread_solib_unloaded(struct so_list *so)
struct type * builtin_data_ptr
static void bsd_uthread_check_magic(CORE_ADDR addr)
static void bsd_uthread_mourn_inferior(struct target_ops *ops)
#define BSD_UTHREAD_PTHREAD_MAGIC
int is_exited(ptid_t ptid)
const char * to_shortname
unsigned long long ULONGEST
#define OBSTACK_ZALLOC(OBSTACK, TYPE)
int(* to_thread_alive)(struct target_ops *, ptid_t ptid) TARGET_DEFAULT_RETURN(0)
ULONGEST read_memory_unsigned_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
CORE_ADDR read_memory_typed_address(CORE_ADDR addr, struct type *type)
static void bsd_uthread_store_registers(struct target_ops *ops, struct regcache *regcache, int regnum)
void(* to_update_thread_list)(struct target_ops *) TARGET_DEFAULT_IGNORE()
void(* to_store_registers)(struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN(noprocess())
struct bound_minimal_symbol lookup_minimal_symbol(const char *name, const char *sfile, struct objfile *objf)
void bsd_uthread_set_supply_uthread(struct gdbarch *gdbarch, void(*supply_uthread)(struct regcache *, int, CORE_ADDR))
static CORE_ADDR bsd_uthread_thread_run_addr
void error(const char *fmt,...)
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int int rusage_t pid_t pid
struct target_ops * beneath
static void bsd_uthread_close(struct target_ops *self)
void(* supply_uthread)(struct regcache *, int, CORE_ADDR)
struct observer * observer_attach_solib_loaded(observer_solib_loaded_ftype *f)
static void bsd_uthread_resume(struct target_ops *ops, ptid_t ptid, int step, enum gdb_signal sig)
static int bsd_uthread_activate(struct objfile *objfile)