#include <stdint.h>
#include <sys/types.h>
+typedef void *psaddr_t;
+typedef pid_t lwpid_t;
#define TD_THR_ANY_USER_FLAGS 0xffffffff
#define TD_THR_LOWEST_PRIORITY -20
typedef struct
{
pid_t pid;
+ struct ps_prochandle *ph;
} td_thragent_t;
typedef struct
extern "C"{
#endif
-extern td_err_e td_ta_new(struct ps_prochandle const * proc_handle, td_thragent_t ** thread_agent);
+extern td_err_e td_ta_new(struct ps_prochandle * proc_handle, td_thragent_t ** thread_agent);
+
+extern td_err_e td_ta_delete(td_thragent_t * ta);
extern td_err_e td_ta_set_event(td_thragent_t const * agent, td_thr_events_t * event);
extern td_err_e td_ta_event_addr(td_thragent_t const * agent, td_event_e event, td_notify_t * notify);
+extern td_err_e td_ta_clear_event(const td_thragent_t * ta_arg,
+ td_thr_events_t * event);
+
extern td_err_e td_ta_event_getmsg(td_thragent_t const * agent, td_event_msg_t * event);
+extern td_err_e td_ta_map_lwp2thr(td_thragent_t const * agent, lwpid_t lwpid,
+ td_thrhandle_t *th);
+
+extern td_err_e td_thr_get_info(td_thrhandle_t const * handle,
+ td_thrinfo_t * info);
+
+extern td_err_e td_thr_event_enable(td_thrhandle_t const * handle,
+ td_event_e event);
+
extern td_err_e td_ta_thr_iter(td_thragent_t const * agent, td_thr_iter_f * func, void * cookie,
td_thr_state_e state, int32_t prio, sigset_t * sigmask, uint32_t user_flags);
extern char const ** td_symbol_list(void);
+extern td_err_e td_thr_tls_get_addr(const td_thrhandle_t * th,
+ psaddr_t map_address, size_t offset,
+ psaddr_t * address);
+
#ifdef __cplusplus
}
#endif
#include <stdio.h>
extern int ps_pglobal_lookup (void *, const char *obj, const char *name, void **sym_addr);
-
-struct ps_prochandle
-{
- pid_t pid;
-};
-
+extern pid_t ps_getpid(struct ps_prochandle *ph);
/*
* This is the list of "special" symbols we care about whose addresses are
td_err_e
-td_ta_new(struct ps_prochandle const * proc_handle, td_thragent_t ** agent_out)
+td_ta_new(struct ps_prochandle * proc_handle, td_thragent_t ** agent_out)
{
td_thragent_t * agent;
return TD_MALLOC;
}
- agent->pid = proc_handle->pid;
+ agent->pid = ps_getpid(proc_handle);
+ agent->ph = proc_handle;
*agent_out = agent;
return TD_OK;
td_err_e
+td_ta_delete(td_thragent_t * ta)
+{
+ free(ta);
+ // FIXME: anything else to do?
+ return TD_OK;
+}
+
+
+/* NOTE: not used by gdb 7.0 */
+
+td_err_e
td_ta_set_event(td_thragent_t const * agent, td_thr_events_t * events)
{
return TD_OK;
}
+/* NOTE: not used by gdb 7.0 */
static td_thrhandle_t gEventMsgHandle;
+/* NOTE: not used by gdb 7.0 */
+
static int
_event_getmsg_helper(td_thrhandle_t const * handle, void * bkpt_addr)
{
return 0;
}
+/* NOTE: not used by gdb 7.0 */
+
td_err_e
td_ta_event_getmsg(td_thragent_t const * agent, td_event_msg_t * event)
{
td_err_e
+td_ta_map_lwp2thr(td_thragent_t const * agent, lwpid_t lwpid,
+ td_thrhandle_t *th)
+{
+ th->pid = ps_getpid(agent->ph);
+ th->tid = lwpid;
+ return TD_OK;
+}
+
+
+td_err_e
td_thr_get_info(td_thrhandle_t const * handle, td_thrinfo_t * info)
{
info->ti_tid = handle->tid;
}
+/* NOTE: not used by gdb 7.0 */
+
td_err_e
td_thr_event_enable(td_thrhandle_t const * handle, td_event_e event)
{
}
+/* NOTE: not used by gdb 7.0 */
+
td_err_e
td_ta_event_addr(td_thragent_t const * agent, td_event_e event, td_notify_t * notify_out)
{
td_err_e
+td_ta_clear_event(const td_thragent_t * ta_arg, td_thr_events_t * event)
+{
+ /* Given that gdb 7.0 doesn't use thread events,
+ there's nothing we need to do here. */
+ return TD_OK;
+}
+
+
+td_err_e
td_ta_thr_iter(td_thragent_t const * agent, td_thr_iter_f * func, void * cookie,
td_thr_state_e state, int32_t prio, sigset_t * sigmask, uint32_t user_flags)
{
continue;
}
handle.tid = atoi(entry->d_name);
- err = func(&handle, cookie);
- if (err) {
+ if (func(&handle, cookie) != 0) {
+ err = TD_DBERR;
break;
}
}
return err;
}
+td_err_e
+td_thr_tls_get_addr(const td_thrhandle_t * th,
+ psaddr_t map_address, size_t offset, psaddr_t * address)
+{
+ return TD_NOAPLIC; // FIXME: TODO
+}