74 struct target *overlay,
int force_emulate) {
76 overlay,force_emulate);
80 struct target *overlay,
int force_emulate) {
82 overlay,force_emulate);
100 " at 0x%"PRIxADDR"; cannot do another one!\n",
114 vwarn(
"could not pause the target for blocking thread"
123 if (!ipval && errno) {
130 verror(
"could not disable breakpoint before singlestep;"
131 " assuming breakpoint is left in place and"
132 " skipping single step, but badness will ensue!");
145 verror(
"could not write IP!\n");
150 array_list_append(mmod->
threads,tthread);
178 " at 0x%"PRIxADDR"; cannot do another one!\n",
184 vwarn(
"not set to emulate a debug mmod; trying anyway!\n");
193 array_list_remove_item(mmod->
threads,tthread);
204 " at 0x%"PRIxADDR"; cannot clear it!\n",
223 GList *newlist = NULL;
243 while (g_hash_table_iter_next(&iter,NULL,&vp)) {
248 if (tthread->
tgid == tgid) {
250 g_hash_table_lookup(process->
threads,
251 (gpointer)(uintptr_t)tthread->
tid);
253 if (othread != tthread) {
255 g_hash_table_iter_remove(&iter);
256 newlist = g_list_prepend(newlist,tthread);
260 newlist = g_list_prepend(newlist,tthread);
269 g_hash_table_insert(process->
threads,
270 (gpointer)(uintptr_t)tthread->
tid,tthread);
271 RHOLD(tthread,process);
273 g_list_free(newlist);
281 g_hash_table_iter_init(&iter,process->
threads);
282 while (g_hash_table_iter_next(&iter,NULL,&vp)) {
285 g_hash_table_iter_remove(&iter);
303 while (g_hash_table_iter_next(&iter,NULL,&vp)) {
308 if (tthread->
ptid == tid) {
311 g_hash_table_lookup(process->
children,
312 (gpointer)(uintptr_t)tthread->
tid);
314 if (child_old != child) {
316 "removing old child pid %d for pid %d\n",
317 child_old->
tid,process->
tid);
319 g_hash_table_iter_remove(&iter);
321 newlist = g_list_prepend(newlist,child);
325 newlist = g_list_prepend(newlist,child);
334 g_hash_table_insert(process->
children,
335 (gpointer)(uintptr_t)child->
tid,child);
336 RHOLD(child,process);
338 "added child %d to pid %d\n",child->
tid,process->
tid);
340 g_list_free(newlist);
347 g_hash_table_iter_init(&iter,process->
threads);
348 while (g_hash_table_iter_next(&iter,NULL,&vp)) {
351 g_hash_table_iter_remove(&iter);
354 "removed stale thread %d from pid %d\n",
355 tthread->
tid,process->
tid);
363 if (!process->
parent && parent) {
367 "new parent pid %d for pid %d\n",parent->
tid,process->
tid);
369 else if (process->
parent && !parent) {
373 "removed parent pid %d\n",process->
tid);
375 else if (process->
parent && parent && process->
parent != parent) {
380 "changed parent to pid %d for pid %d\n",
381 parent->
tid,process->
tid);
400 int signo,
void *data) {
434 return g_hash_table_size(sctab);
471 target,tid,syscall,pre_handler,post_handler,handler_data);
479 target,tid,pre_handler,post_handler,handler_data);
485 static const char *_target_os_syscall_probe_gettype(
struct probe *
probe) {
486 return "target_os_syscall_probe";
489 #define TARGET_OS_SYSCALL_GKV_KEY "target_os_syscall_state"
500 .
gettype = _target_os_syscall_probe_gettype,
507 char *key,
void *
value) {
549 scs =
calloc(1,
sizeof(*scs));
553 _target_os_syscall_state_dtor)) {
554 verror(
"could not insert syscall state for tid %"PRIiTID"!\n",tid);
570 verror(
"could not store arg values; no syscall entry recorded!\n");
587 verror(
"could not store return value; no syscall entry recorded!\n");
void * target_os_syscall_probe_summarize_tid(struct probe *probe, tid_t tid)
#define RPUTW(x, objtype, hx, rc)
struct array_list * threads
result_t pre_handler(struct probe *probe, tid_t tid, void *data, struct probe *trigger, struct probe *base)
#define SAFE_TARGET_OS_OP(target, op, errval,...)
struct target_os_syscall_state * target_os_syscall_probe_last(struct target *target, tid_t tid)
int target_load_available_threads(struct target *target, int force)
void * target_os_syscall_probe_summarize(struct probe *probe)
void target_thread_gkv_remove(struct target *target, tid_t tid, char *key)
struct probe_ops target_os_syscall_ret_probe_ops
target_os_type_t target_os_type(struct target *target)
GHashTable * target_os_syscall_table_get(struct target *target)
static uint64_t unsigned int i
struct array_list * argvals
int target_os_version_cmp(struct target *target, uint64_t vers)
#define v_g_list_foreach(glhead, glcur, elm)
int target_os_thread_is_user(struct target *target, tid_t tid)
int target_pause(struct target *target)
struct target_os_syscall_state * target_os_syscall_record_entry(struct target *target, tid_t tid, struct target_os_syscall *syscall)
struct target_os_syscall * target_os_syscall_lookup_name(struct target *target, char *name)
#define verror(format,...)
tid_t target_os_thread_get_leader(struct target *target, tid_t tid)
uint64_t target_os_version(struct target *target)
const char *(* gettype)(struct probe *probe)
result_t(* probe_handler_t)(struct probe *probe, tid_t tid, void *handler_data, struct probe *trigger, struct probe *base)
int target_os_syscall_table_unload(struct target *target)
#define TARGET_OS_SYSCALL_GKV_KEY
#define vwarn(format,...)
int target_write_reg_ctxt(struct target *target, tid_t tid, thread_ctxt_t tidctxt, REG reg, REGVAL value)
struct target_thread * target_load_thread(struct target *target, tid_t tid, int force)
int target_thread_gkv_insert(struct target *target, tid_t tid, char *key, void *value, target_thread_gkv_dtor_t dtor)
#define array_list_foreach(alist, lpc, placeholder)
int target_os_syscall_record_argv(struct target *target, tid_t tid, struct array_list *regvals, struct array_list *argvals)
int target_os_thread_get_pgd_phys(struct target *target, tid_t tid, ADDR *pgdp)
int target_os_syscall_record_clear(struct target *target, tid_t tid)
int target_os_syscall_table_load(struct target *target)
struct probe * target_os_syscall_probe(struct target *target, tid_t tid, struct target_os_syscall *syscall, probe_handler_t pre_handler, probe_handler_t post_handler, void *handler_data)
struct target_os_syscall * target_os_syscall_lookup_num(struct target *target, int num)
GHashTable * target_os_process_table_get(struct target *target)
struct target_os_syscall * syscall
int target_memmod_unset(struct target *target, tid_t tid, struct target_memmod *mmod)
void value_free(struct value *value)
struct target_memmod * emulating_debug_mmod
#define vdebug(devel, areas, flags, format,...)
struct target_process * target_os_process_get(struct target *target, tid_t tid)
int target_os_syscall_table_get_max_num(struct target *target)
void * calloc(size_t nmemb, size_t size)
result_t post_handler(struct probe *probe, tid_t tid, void *data, struct probe *trigger, struct probe *base)
int target_os_syscall_table_reload(struct target *target, int force)
unsigned int thread_ctxt_t
int target_os_signal_from_name(struct target *target, const char *name)
int target_os_syscall_record_return(struct target *target, tid_t tid, REGVAL retval)
void * target_thread_gkv_lookup(struct target *target, tid_t tid, char *key)
struct probe * target_os_syscall_probe_all(struct target *target, tid_t tid, probe_handler_t pre_handler, probe_handler_t post_handler, void *handler_data)
int target_os_update_process_threads_generic(struct target_process *process, int no_event_send)
int target_os_syscall_table_store(struct target *target)
unsigned int breakpoint_instrs_len
const char * target_os_signal_to_name(struct target *target, int signo)
REGVAL target_read_reg_ctxt(struct target *target, tid_t tid, thread_ctxt_t tidctxt, REG reg)
int target_memmod_set(struct target *target, tid_t tid, struct target_memmod *mmod)
int target_os_thread_singlestep(struct target *target, tid_t tid, int isbp, struct target *overlay, int force_emulate)
struct target_process * parent
struct target_spec * spec
result_t target_os_emulate_ss_handler(struct target *target, tid_t tid, thread_ctxt_t tidctxt, struct target_memmod *mmod)
#define RPUT(x, objtype, hx, rc)
struct array_list * regvals
#define SAFE_TARGET_OS_OP_NORET(target, op, errval, outvar,...)
struct target_thread * target_lookup_thread(struct target *target, tid_t tid)
struct target_thread * blocking_thread
void * target_gkv_lookup(struct target *target, char *key)
int target_os_signal_enqueue(struct target *target, tid_t tid, int signo, void *data)
struct target_os_syscall * target_os_syscall_lookup_addr(struct target *target, ADDR addr)
struct target_thread * thread
result_t target_os_emulate_bp_handler(struct target *target, tid_t tid, thread_ctxt_t tidctxt, struct target_memmod *mmod)
int target_os_thread_singlestep_end(struct target *target, tid_t tid, struct target *overlay, int force_emulate)