32 #include <sys/types.h>
41 #ifdef ENABLE_XENSUPPORT
62 #ifdef ENABLE_XENSUPPORT
68 verror(
"cannot directly instantiate TARGET_TYPE_OS_PROCESS;"
69 " call target_instantiate_overlay instead.\n");
74 verror(
"cannot directly instantiate TARGET_TYPE_PHP;"
75 " call target_instantiate_overlay instead.\n");
93 GList *base_target_specs,
94 GList *overlay_target_specs,
96 GList **error_specs) {
97 struct target *primary_target = NULL,*
target = NULL,*base_target;
102 GList *retval = NULL;
113 if (primary_target_spec) {
115 if (!primary_target) {
117 vwarn(
"could not instantiate primary target; skipping!\n");
118 *error_specs = g_list_append(*error_specs,primary_target_spec);
121 verror(
"could not instantiate primary target; aborting\n!");
128 retval = g_list_append(retval,primary_target);
130 else if (error_specs) {
131 vwarn(
"could not open primary target spec %d\n",i);
134 *error_specs = g_list_append(*error_specs,primary_target_spec);
137 verror(
"could not open primary target spec %d\n",i);
140 primary_target = NULL;
146 if (base_target_specs) {
147 lcopy = g_list_copy(base_target_specs);
155 else if (error_specs) {
156 vwarn(
"could not instantiate target spec %d\n",i);
157 *error_specs = g_list_append(*error_specs,spec);
160 verror(
"could not instantiate target spec %d\n",i);
165 retval = g_list_append(retval,target);
167 else if (error_specs) {
168 vwarn(
"could not instantiate target spec %d\n",i);
171 *error_specs = g_list_append(*error_specs,spec);
174 verror(
"could not instantiate target spec %d\n",i);
185 if (overlay_target_specs) {
186 lcopy = g_list_copy(overlay_target_specs);
190 base_target = primary_target;
196 verror(
"could not instantiate overlay target spec %d;"
197 " no base target with id %d\n",
202 vwarn(
"could not instantiate overlay target spec %d;"
203 " no base target with id %d\n",
205 *error_specs = g_list_append(*error_specs,spec);
216 verror(
"could not instantiate overlay target spec %d;"
217 " no base target thread named %s\n",
222 vwarn(
"could not instantiate overlay target spec %d;"
223 " no base target thread named %s\n",
225 *error_specs = g_list_append(*error_specs,spec);
234 retval = g_list_append(retval,target);
236 else if (!error_specs) {
237 verror(
"could not instantiate overlay target spec %d"
238 " on base thread %d\n",
243 vwarn(
"could not instantiate overlay target spec %d"
244 " on base thread %d\n",
246 *error_specs = g_list_append(*error_specs,spec);
250 retval = g_list_append(retval,target);
252 else if (error_specs) {
253 vwarn(
"could not instantiate target spec %d\n",i);
256 *error_specs = g_list_append(*error_specs,spec);
259 verror(
"could not instantiate target spec %d\n",i);
278 retval = g_list_reverse(retval);
289 GList **error_specs) {
295 GList *retval = NULL;
296 int progress,last_progress;
297 struct target *base_target;
298 tid_t base_thread_id;
300 lcopy = g_list_copy(target_specs);
313 last_progress = progress;
319 #ifdef ENABLE_XENSUPPORT
330 if (!base_target && !last_progress) {
332 verror(
"could not lookup base target id %d for"
337 vwarn(
"could not lookup base target id %d for"
340 *error_specs = g_list_append(*error_specs,spec);
344 else if (!base_target) {
355 if (base_thread_id < 0) {
357 verror(
"could not lookup base target thread name %s"
358 " for overlay target spec\n",
363 vwarn(
"could not lookup base target thread name %s"
364 " for overlay target spec; skipping\n",
367 *error_specs = g_list_append(*error_specs,spec);
381 retval = g_list_append(retval,target);
383 else if (error_specs) {
384 vwarn(
"could not instantiate target spec %d\n",i);
385 *error_specs = g_list_append(*error_specs,spec);
388 vwarn(
"could not instantiate target spec %d\n",i);
401 retval = g_list_reverse(retval);
414 tspec =
calloc(1,
sizeof(*tspec));
417 tspec =
calloc(1,
sizeof(*tspec));
420 #ifdef ENABLE_XENSUPPORT
422 tspec =
calloc(1,
sizeof(*tspec));
427 tspec =
calloc(1,
sizeof(*tspec));
431 tspec =
calloc(1,
sizeof(*tspec));
435 tspec =
calloc(1,
sizeof(*tspec));
460 #ifdef ENABLE_XENSUPPORT
521 verror(
"cannot open a target without a specification!\n");
534 "loading user-specified personality '%s' (%s)\n",
538 verror(
"Failed to initialize user-specified personality (%d)!\n",rc);
543 verror(
"cannot specify a personality library without a"
544 " personality name!\n");
550 if ((rc = target->
ops->
init(target))) {
558 target->
name = strdup(buf);
561 verror(
"cannot init a target in BPMODE_STRICT that does not have"
601 "target(%s:%s:0x%"PRIxADDR") finished region(%s:%s,"
637 verror(
"target not writeable; cannot enable any active probing!\n");
646 "no active probing support in target(%s)\n",target->
name);
665 verror(
"could not load available threads!\n");
669 retval = array_list_create(g_hash_table_size(target->
threads));
670 g_hash_table_iter_init(&iter,target->
threads);
671 while (g_hash_table_iter_next(&iter,NULL,(gpointer)&tthread)) {
676 || (type & tthread->supported_overlay_types))
677 array_list_append(retval,(
void *)(uintptr_t)tthread->tid);
679 array_list_compact(retval);
687 if (g_hash_table_size(target->
overlays) == 0)
690 return array_list_create_from_g_hash_table(target->
overlays);
697 verror(
"no overlay support in target(%s)!\n",target->
name);
717 verror(
"no overlay support in target(%s)!\n",target->
name);
748 verror(
"base target not writeable; cannot enable writeable overlay!\n");
759 struct target *overlay;
764 verror(
"no overlay support in target(%s)!\n",target->
name);
770 verror(
"base target not writeable; cannot enable writeable overlay!\n");
778 if (g_hash_table_lookup(target->
overlays,(gpointer)(uintptr_t)tid)
779 || g_hash_table_lookup(target->
overlay_aliases,(gpointer)(uintptr_t)tid)) {
788 verror(
"target(%s) tid %d could not be loaded!\n",target->
name,tid);
795 verror(
"target(%s) tid %"PRIiTID" failed to create overlay!\n",
810 g_hash_table_insert(target->
overlays,
811 (gpointer)(uintptr_t)tthread->
tid,overlay);
812 RHOLD(overlay,target);
814 if (tid == tthread->
tid) {
816 "target(%s) tid %"PRIiTID" new overlay target(%s) (id %d)\n",
821 "target(%s) tid %"PRIiTID" new overlay target(%s) (id %d)"
822 " (not using user-supplied thread %d; base target overrode it!)\n",
836 verror(
"an evloop is already associated with target(%s)!\n",
850 vwarn(
"no evloop is associated with target(%s)!\n",
864 if (target->
evloop && evloop && target->
evloop == evloop)
871 verror(
"cannot monitor target(%s) in state %s; ERROR!\n",
912 &fdinfo,&fdtype,&hrc);
915 if (errno == EINTR) {
926 else if (errno == EBADF || errno == EINVAL || errno == ENOMEM
927 || errno == ENOENT || errno == EBADSLT || errno == ENOTSUP) {
933 "evloop_handlone: unexpected error '%s' (%d)\n",
934 strerror(errno),errno);
945 t = (
struct target *)fdinfo->
rhstate;
947 t = (
struct target *)fdinfo->
whstate;
949 t = (
struct target *)fdinfo->
xhstate;
971 verror(
"evloop_handleone returned 0 but still FDs to handle!\n");
978 verror(
"evloop_handleone returned unexpected code '%d'; aborting!\n",
987 *target = (
struct target *)fdinfo->
rhstate;
989 *target = (
struct target *)fdinfo->
whstate;
991 *target = (
struct target *)fdinfo->
xhstate;
995 if (status && *target)
996 *status = (*target)->
status;
1004 verror(
"cannot poll target(%s) in state %s; ERROR!\n",
1009 return target->
ops->
poll(target,tv,outcome,pstatus);
1014 verror(
"cannot resume target(%s) in state %s; ERROR!\n",
1020 "not pausing target(%s); already finished\n",target->
name);
1030 "not pausing target(%s); already paused\n",target->
name);
1035 "not pausing target(%s); already finished\n",target->
name);
1039 return target->
ops->
pause(target,0);
1048 "calling backend to get target(%s) status\n",target->
name);
1054 unsigned long length,
unsigned char *buf) {
1056 target->
name,addr,buf,length);
1057 return target->
ops->
read(target,addr,length,buf);
1061 unsigned long length,
unsigned char *buf) {
1063 target->
name,addr,length);
1065 verror(
"target not writeable!\n");
1069 return target->
ops->
write(target,addr,length,buf);
1074 vwarn(
"target(%s) does not support v2p addr translation!\n",target->
name);
1080 return target->
ops->
addr_v2p(target,tid,vaddr,paddr);
1084 unsigned long length,
unsigned char *buf) {
1086 vwarn(
"target(%s) does not support phys addr reads!\n",target->
name);
1091 "reading target(%s) at phys 0x%"PRIxADDR" into %p (%d)\n",
1092 target->
name,paddr,buf,length);
1093 return target->
ops->
read_phys(target,paddr,length,buf);
1097 unsigned long length,
unsigned char *buf) {
1099 vwarn(
"target(%s) does not support phys addr writes!\n",target->
name);
1104 "writing target(%s) at phys 0x%"PRIxADDR" (%d)\n",
1105 target->
name,paddr,length);
1107 verror(
"target not writeable!\n");
1134 target->
name,tid,reg);
1144 target->
name,tid,reg,value);
1146 verror(
"target not writeable!\n");
1151 return target->
ops->
writereg(target,tid,reg,value);
1160 "reading target(%s:%"PRIiTID") reg %d tidctxt %d)\n",
1161 target->
name,tid,reg,tidctxt);
1169 target->
name,tid,reg,tidctxt,value);
1171 verror(
"target not writeable!\n");
1192 verror(
"target not writeable!\n");
1205 "copying target(%s:%"PRIiTID") regs\n",
1212 GHashTableIter iter;
1216 if (g_hash_table_size(target->
threads) == 0)
1219 retval = array_list_create(g_hash_table_size(target->
threads));
1221 g_hash_table_iter_init(&iter,target->
threads);
1222 while (g_hash_table_iter_next(&iter,&key,(gpointer)&tthread)) {
1227 array_list_append(retval,(
void *)(
ptr_t)tthread->tid);
1235 GHashTableIter iter;
1239 retval = array_list_create(g_hash_table_size(target->
threads));
1241 g_hash_table_iter_init(&iter,target->
threads);
1242 while (g_hash_table_iter_next(&iter,&key,(gpointer)&tthread)) {
1247 array_list_append(retval,tthread);
1255 GHashTableIter iter;
1259 retval = g_hash_table_new_full(g_direct_hash,g_direct_equal,NULL,NULL);
1261 g_hash_table_iter_init(&iter,target->
threads);
1262 while (g_hash_table_iter_next(&iter,&key,(gpointer)&tthread))
1267 g_hash_table_insert(retval,key,tthread);
1285 verror(
"could not load available tids!\n");
1289 retval = g_hash_table_new_full(g_direct_hash,g_direct_equal,NULL,NULL);
1291 for (i = 0; i < array_list_len(tids); ++
i) {
1293 g_hash_table_insert(retval,(gpointer)(
ptr_t)tid,(gpointer)(
ptr_t)tid);
1295 array_list_free(tids);
1325 target->
name,tid,nowait);
1341 GHashTableIter iter;
1342 struct target *overlay;
1346 "flushing all target(%s) threads\n",target->
name);
1351 g_hash_table_iter_init(&iter,target->
overlays);
1352 while (g_hash_table_iter_next(&iter,NULL,(gpointer)&overlay)) {
1354 "flushing all overlay target(%s) threads\n",overlay->name);
1357 "flushing all overlay target(%s) threads (%d)\n",overlay->name,rc);
1372 GHashTable *real_tids;
1383 verror(
"could not list cached threads!\n");
1389 verror(
"could not load currently available threads!\n");
1390 array_list_free(cached_tids);
1394 for (i = 0; i < array_list_len(cached_tids); ++
i) {
1395 tid = (
tid_t)(
ptr_t)array_list_item(cached_tids,i);
1400 if (!g_hash_table_lookup_extended(real_tids,(gpointer)(
ptr_t)tid,
1403 vwarn(
"thread %d seems to no longer exist, but is the"
1404 " current thread; not detaching!\n",tid);
1409 "cached thread %"PRIiTID" no longer exists; detaching!\n",tid);
1415 array_list_free(cached_tids);
1416 g_hash_table_destroy(real_tids);
1426 char *buf,
int bufsiz,
1427 int detail,
char *sep,
char *kvsep) {
1450 return snprintf(buf,bufsiz,
"tid%s%"PRIiTID,kvsep,tthread->
tid);
1451 else if (detail < 0)
1452 return snprintf(buf,bufsiz,
"tid%s%"PRIiTID "%s" "name%s%s" "%s"
1454 kvsep,tid,sep,kvsep,tthread->
name,sep,
1457 return snprintf(buf,bufsiz,
1458 "tid%s%"PRIiTID "%s" "name%s%s" "%s" "curctxt%s%d" "%s"
1460 "uid%s%d" "%s" "gid%s%d",
1461 kvsep,tthread->
tid,sep,kvsep,tthread->
name,sep,
1463 kvsep,tthread->
ptid,sep,kvsep,tthread->
tgid,sep,
1464 kvsep,tthread->
uid,sep,kvsep,tthread->
gid);
1466 rc = snprintf(buf,bufsiz,
1467 "tid%s%"PRIiTID
"%s" "name%s%s" "%s" "curctxt%s%d" "%s"
1468 "ptid%s%"PRIiTID
"%s" "ptid%s%"PRIiTID
"%s"
1469 "uid%s%d" "%s" "gid%s%d" "%s",
1470 kvsep,tthread->
tid,sep,kvsep,tthread->
name,sep,
1472 kvsep,tthread->
ptid,sep,kvsep,tthread->
tgid,sep,
1473 kvsep,tthread->
uid,sep,kvsep,tthread->
gid,sep);
1495 fprintf(stream ? stream : stdout,
"tid(%"PRIiTID"): <API ERROR>\n",tid);
1497 fprintf(stream ? stream : stdout,
"tid(%"PRIiTID"): %s\n",tid,buf);
1502 GHashTableIter iter;
1506 g_hash_table_iter_init(&iter,target->
threads);
1507 while (g_hash_table_iter_next(&iter,NULL,(gpointer)&tthread))
1513 GHashTableIter iter;
1515 struct target *overlay;
1532 g_hash_table_iter_init(&iter,target->
overlays);
1533 while (g_hash_table_iter_next(&iter,NULL,(gpointer)&overlay)) {
1535 "closing overlay target(%s)\n",overlay->name);
1538 "closed overlay target(%s) (%d)\n",overlay->name,rc);
1554 while (g_hash_table_iter_next(&iter,NULL,(gpointer)&probepoint)) {
1562 g_hash_table_iter_init(&iter,target->
mmods);
1563 while (g_hash_table_iter_next(&iter,NULL,(gpointer)&mmod)) {
1564 g_hash_table_iter_remove(&iter);
1574 if (rlen != mmod->orig_len) {
1576 " but cannot do anything!\n",mmod->addr);
1580 if (mmod->threads) {
1581 array_list_free(mmod->threads);
1588 "sw bp removal notification failed; ignoring\n");
1599 verror(
"detach target(%s) failed: %s\n",target->
name,strerror(errno));
1623 GHashTableIter iter;
1634 g_hash_table_iter_init(&iter,target->
threads);
1635 while (g_hash_table_iter_next(&iter,NULL,&vp)) {
1654 return target->
ops->
kill(target,sig);
1658 RHOLD(target,target);
1663 RPUT(target,target,target,trefcnt);
1667 return (
struct probe *)g_hash_table_lookup(target->
probes,
1668 (gpointer)(uintptr_t)probe_id);
1672 return (
struct action *)g_hash_table_lookup(target->
actions,
1673 (gpointer)(uintptr_t)action_id);
1693 verror(
"mmod already at 0x%"PRIxADDR"; but not breakpoint!\n",addr);
1698 verror(
"mmod already at 0x%"PRIxADDR"; state is not SUBST (%d)!\n",
1705 if (array_list_find(mmod->
threads,tthread) < 0)
1706 array_list_append(mmod->
threads,tthread);
1708 vwarn(
"tid %"PRIiTID" already on threads list; BUG!\n",tid);
1723 vwarn(
"sw bp insertion notification failed; ignoring\n");
1754 vwarn(
"sw bp removal notification failed; ignoring\n");
1796 unsigned char *code,
unsigned long code_len) {
1802 unsigned char *code,
unsigned long code_len) {
1832 target->
name,tid,retval);
1838 "setting hw breakpoint at 0x%"PRIxADDR" on target(%s:%"PRIiTID") dreg %d\n",
1839 addr,target->
name,tid,reg);
1846 "setting hw watchpoint at 0x%"PRIxADDR" on target(%s:%"PRIiTID") dreg %d (%d)\n",
1847 addr,target->
name,tid,reg,watchsize);
1853 "removing hw breakpoint on target(%s:%"PRIiTID") dreg %d\n",
1854 target->
name,tid,reg);
1860 "removing hw watchpoint on target(%s:%"PRIiTID") dreg %d\n",
1861 target->
name,tid,reg);
1867 "disable hw breakpoints on target(%s:%"PRIiTID")\n",target->
name,tid);
1873 "enable hw breakpoints on target(%s:%"PRIiTID")\n",target->
name,tid);
1880 dreg,target->
name,tid);
1887 dreg,target->
name,tid);
1895 "notify sw breakpoint (%d) on target(%s)\n",
1896 notification,target->
name);
1905 target->
name,tid,isbp);
1924 target->
name,retval);
#define SAFE_TARGET_OP_WARN_NORET(op, outvar, expoutval, target,...)
struct target * target_instantiate_overlay(struct target *target, tid_t tid, struct target_spec *spec)
int target_thread_snprintf(struct target *target, tid_t tid, char *buf, int bufsiz, int detail, char *sep, char *kvsep)
uint8_t * breakpoint_instrs
int target_flush_all_threads(struct target *target)
tid_t target_lookup_overlay_thread_by_name(struct target *target, char *name)
int target_obj_flags_propagate(struct target *target, obj_flags_t orf, obj_flags_t nandf)
struct array_list * threads
#define vwarnopt(level, area, flags, format,...)
int(* singlestep)(struct target *target, tid_t tid, int isbp, struct target *overlay)
int target_change_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod, unsigned char *code, unsigned long code_len)
int(* flush_current_thread)(struct target *target)
#define SAFE_TARGET_OP(op, outvar, expoutval, target,...)
target_mode_t target_mode
#define SAFE_PERSONALITY_OP_WARN(op, outvar, expoutval, target,...)
int arch_regno(struct arch *arch, char *name, REG *reg)
unsigned char *(* read)(struct target *target, ADDR addr, unsigned long length, unsigned char *buf)
int(* addr_v2p)(struct target *target, tid_t tid, ADDR vaddr, ADDR *paddr)
int(* disable_hw_breakpoints)(struct target *target, tid_t tid)
void addrspace_obj_flags_propagate(struct addrspace *space, obj_flags_t orf, obj_flags_t nandf)
int target_load_available_threads(struct target *target, int force)
tid_t target_lookup_overlay_thread_by_id(struct target *target, int id)
struct target_spec * tspec
int(* flush_all_threads)(struct target *target)
uint64_t target_get_tsc(struct target *target)
int target_set_hw_watchpoint(struct target *target, tid_t tid, REG reg, ADDR addr, probepoint_whence_t whence, int watchsize)
struct linux_userproc_spec * linux_userproc_build_spec(void)
int(* unchange_sw_breakpoint)(struct target *target, tid_t tid, struct target_memmod *mmod)
GHashTable * soft_probepoints
static uint64_t unsigned int i
tid_t(* gettid)(struct target *target)
int target_monitor_evloop(struct evloop *evloop, struct timeval *timeout, struct target **target, target_status_t *status)
struct target_personality_ops * personality_ops
int target_remove_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
int(* set_active_probing)(struct target *target, active_probe_flags_t flags)
#define v_g_list_foreach_remove(glhead, glcur, glnext)
GHashTable * target_copy_registers(struct target *target, tid_t tid)
struct target_spec *(* build_default_overlay_spec)(struct target *target, tid_t tid)
struct action * target_lookup_action(struct target *target, int action_id)
int target_resume(struct target *target)
#define v_g_list_foreach(glhead, glcur, elm)
int target_is_evloop_attached(struct target *target, struct evloop *evloop)
int target_disable_feature(struct target *target, int feature)
int _target_change_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod, unsigned char *code, unsigned long code_len)
int _target_remove_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
void target_dump_thread(struct target *target, tid_t tid, FILE *stream, int detail)
struct target_thread * base_thread
struct os_process_spec * os_process_build_spec(void)
struct php_spec * php_build_spec(void)
void php_free_spec(struct php_spec *spec)
int(* unset_hw_breakpoint)(struct target *target, tid_t tid, REG reg)
int target_pause(struct target *target)
struct target_memmod * target_memmod_create(struct target *target, tid_t tid, ADDR addr, int is_phys, target_memmod_type_t mmt, unsigned char *code, unsigned int code_len, int nowrite)
int target_pause_thread(struct target *target, tid_t tid, int nowait)
int target_cregno(struct target *target, common_reg_t creg, REG *reg)
int evloop_handleone(struct evloop *evloop, evloop_flags_t flags, struct timeval *timeout, struct evloop_fdinfo **handled_fdinfo, int *handled_fdtype, int *handled_hrc)
tid_t target_gettid(struct target *target)
struct target_thread * global_thread
int(* disable_sw_breakpoint)(struct target *target, tid_t tid, struct target_memmod *mmod)
target_memmod_state_t state
int(* load_available_threads)(struct target *target, int force)
int(* set_hw_breakpoint)(struct target *target, tid_t tid, REG reg, ADDR addr)
int target_flush_thread(struct target *target, tid_t tid)
int target_unchange_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
GHashTable * target_hash_threads(struct target *target)
int target_close(struct target *target)
target_status_t(* status)(struct target *target)
int(* writereg)(struct target *target, tid_t tid, REG reg, REGVAL value)
#define verror(format,...)
unsigned char * target_read_addr(struct target *target, ADDR addr, unsigned long length, unsigned char *buf)
int target_singlestep(struct target *target, tid_t tid, int isbp)
int target_is_open(struct target *target)
void linux_userproc_free_spec(struct linux_userproc_spec *lspec)
int target_regno(struct target *target, char *name, REG *reg)
void probepoint_free_ext(struct probepoint *probepoint)
void target_detach_thread(struct target *target, struct target_thread *tthread)
int(* writereg_tidctxt)(struct target *target, tid_t tid, thread_ctxt_t tidctxt, REG reg, REGVAL value)
int(* pause)(struct target *target, int nowait)
int target_personality_attach(struct target *target, char *personality, char *personality_lib)
GList * target_instantiate_and_open_list(GList *target_specs, struct evloop *evloop, GList **error_specs)
int _target_disable_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
struct target_thread *(* lookup_overlay_thread_by_id)(struct target *target, int id)
#define vwarn(format,...)
unsigned char * target_read_physaddr(struct target *target, ADDR paddr, unsigned long length, unsigned char *buf)
int target_snprintf(struct target *target, char *buf, int bufsiz)
REGVAL target_read_reg(struct target *target, tid_t tid, REG reg)
int(* thread_snprintf)(struct target *target, struct target_thread *tthread, char *buf, int bufsiz, int detail, char *sep, char *key_val_sep)
uint64_t(* get_tsc)(struct target *target)
REG target_get_unused_debug_reg(struct target *target, tid_t tid)
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_singlestep_end(struct target *target, tid_t tid)
int target_attach_evloop(struct target *target, struct evloop *evloop)
GHashTable *(* copy_registers)(struct target *target, tid_t tid)
void target_monitor_clear_global_interrupt(void)
int target_flush_current_thread(struct target *target)
thread_status_t target_thread_status(struct target *target, tid_t tid)
uint64_t target_get_time(struct target *target)
struct array_list * target_list_available_overlay_tids(struct target *target, target_type_t type)
struct xen_vm_spec * xen_vm_build_spec(void)
struct target_thread * target_load_current_thread(struct target *target, int force)
struct target_thread * current_thread
int target_monitor_was_interrupted(siginfo_t *last_siginfo)
struct probe * target_lookup_probe(struct target *target, int probe_id)
int target_enable_hw_breakpoint(struct target *target, tid_t tid, REG dreg)
struct target_memmod * target_memmod_lookup(struct target *target, tid_t tid, ADDR addr, int is_phys)
struct array_list * target_list_tids(struct target *target)
uint64_t(* get_time)(struct target *target)
int(* detach)(struct target *target, int stay_paused)
void target_free_spec(struct target_spec *spec)
target_memmod_type_t type
struct target_thread *(* load_thread)(struct target *target, tid_t tid, int force)
int target_set_active_probing(struct target *target, active_probe_flags_t flags)
struct target * linux_userproc_instantiate(struct target_spec *spec, struct evloop *evloop)
int(* flush_thread)(struct target *target, tid_t tid)
unsigned long target_write_physaddr(struct target *target, ADDR paddr, unsigned long length, unsigned char *buf)
struct target_spec * target_build_default_overlay_spec(struct target *target, tid_t tid)
char * target_name(struct target *target)
void gdb_free_spec(struct gdb_spec *xspec)
const char * target_regname(struct target *target, REG reg)
int(* set_hw_watchpoint)(struct target *target, tid_t tid, REG reg, ADDR addr, probepoint_whence_t whence, probepoint_watchsize_t watchsize)
REG(* get_unused_debug_reg)(struct target *target, tid_t tid)
int _target_enable_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
target_status_t(* monitor)(struct target *target)
int target_memmod_unset(struct target *target, tid_t tid, struct target_memmod *mmod)
int(* resume)(struct target *target)
int(* load_all_threads)(struct target *target, int force)
struct array_list *(* list_available_tids)(struct target *target)
int target_enable_feature(struct target *target, int feature, void *arg)
int(* disable_hw_breakpoint)(struct target *target, tid_t tid, REG dreg)
target_type_t target_type
REGVAL(* readreg_tidctxt)(struct target *target, tid_t tid, thread_ctxt_t tidctxt, REG reg)
const char * arch_regname(struct arch *arch, REG reg)
REGVAL target_read_creg(struct target *target, tid_t tid, common_reg_t reg)
int(* remove_sw_breakpoint)(struct target *target, tid_t tid, struct target_memmod *mmod)
#define v_g_list_foreach_safe(glhead, glcur, glnext, elm)
#define vdebug(devel, areas, flags, format,...)
int target_notify_sw_breakpoint(struct target *target, ADDR addr, int notification)
int(* gc_threads)(struct target *target)
int(* set_active_probing)(struct target *target, active_probe_flags_t flags)
GHashTable * target_hash_available_tids(struct target *target)
int target_load_all_threads(struct target *target, int force)
int arch_cregno(struct arch *arch, common_reg_t creg, REG *reg)
int(* attach_evloop)(struct target *target, struct evloop *evloop)
struct target * xen_vm_instantiate(struct target_spec *spec, struct evloop *evloop)
struct array_list * target_list_available_tids(struct target *target)
int(* enable_sw_breakpoint)(struct target *target, tid_t tid, struct target_memmod *mmod)
int target_detach_evloop(struct target *target)
int evloop_maxsize(struct evloop *evloop)
int(* notify_sw_breakpoint)(struct target *target, ADDR addr, int notification)
void os_process_free_spec(struct os_process_spec *spec)
int(* unset_hw_watchpoint)(struct target *target, tid_t tid, REG reg)
void * calloc(size_t nmemb, size_t size)
struct array_list * debugfile_load_opts_list
unsigned int thread_ctxt_t
int target_disable_hw_breakpoints(struct target *target, tid_t tid)
GHashTable * overlay_aliases
#define THREAD_CTXT_DEFAULT
int target_memmod_release(struct target *target, tid_t tid, struct target_memmod *mmod)
struct target * target_lookup_target_id(int id)
target_status_t target_status(struct target *target)
int target_disable_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
void target_hold(struct target *target)
struct target_spec * target_build_spec(target_type_t type, target_mode_t mode)
int target_write_creg(struct target *target, tid_t tid, common_reg_t reg, REGVAL value)
int target_kill(struct target *target, int sig)
int target_disable_hw_breakpoint(struct target *target, tid_t tid, REG dreg)
uint64_t(* get_counter)(struct target *target)
int target_finalize(struct target *target)
unsigned long(* write_phys)(struct target *target, ADDR paddr, unsigned long length, unsigned char *buf)
unsigned int breakpoint_instrs_len
struct target_thread *(* lookup_overlay_thread_by_name)(struct target *target, char *name)
int(* enable_feature)(struct target *target, int feature, void *arg)
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)
struct target_memmod * target_insert_sw_breakpoint(struct target *target, tid_t tid, ADDR addr)
target_status_t target_poll(struct target *target, struct timeval *tv, target_poll_outcome_t *outcome, int *pstatus)
GList * target_instantiate_and_open(struct target_spec *primary_target_spec, GList *base_target_specs, GList *overlay_target_specs, struct evloop *evloop, GList **error_specs)
int target_open(struct target *target)
void target_release(struct target *target)
int target_unset_hw_breakpoint(struct target *target, tid_t tid, REG reg)
struct target * gdb_instantiate(struct target_spec *spec, struct evloop *evloop)
void target_dump_all_threads(struct target *target, FILE *stream, int detail)
target_status_t target_monitor(struct target *target)
int target_id(struct target *target)
int(* snprintf)(struct target *target, char *buf, int bufsiz)
int(* detach_evloop)(struct target *target)
struct target_spec * spec
int target_memmod_set_tmp(struct target *target, tid_t tid, struct target_memmod *mmod, unsigned char *code, unsigned long code_len)
int _target_unchange_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
struct target * target_instantiate(struct target_spec *spec, struct evloop *evloop)
#define RPUT(x, objtype, hx, rc)
REGVAL(* readreg)(struct target *target, tid_t tid, REG reg)
void debugfile_load_opts_free(struct debugfile_load_opts *opts)
int target_set_hw_breakpoint(struct target *target, tid_t tid, REG reg, ADDR addr)
struct target_thread * target_lookup_thread(struct target *target, tid_t tid)
int target_gc_threads(struct target *target)
int target_enable_hw_breakpoints(struct target *target, tid_t tid)
int(* disable_feature)(struct target *target, int feature)
unsigned long(* write)(struct target *target, ADDR addr, unsigned long length, unsigned char *buf)
target_type_t target_type(struct target *target)
unsigned char *(* read_phys)(struct target *target, ADDR paddr, unsigned long length, unsigned char *buf)
unsigned long target_write_addr(struct target *target, ADDR addr, unsigned long length, unsigned char *buf)
struct gdb_spec * gdb_build_spec(void)
int(* singlestep_end)(struct target *target, tid_t tid, struct target *overlay)
uint64_t target_get_counter(struct target *target)
void xen_vm_free_spec(struct xen_vm_spec *xspec)
int target_addr_v2p(struct target *target, tid_t tid, ADDR vaddr, ADDR *paddr)
int(* change_sw_breakpoint)(struct target *target, tid_t tid, struct target_memmod *mmod, unsigned char *code, unsigned long code_len)
int(* init)(struct target *target)
struct target_thread *(* load_current_thread)(struct target *target, int force)
int target_enable_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
struct target_memmod * _target_insert_sw_breakpoint(struct target *target, tid_t tid, ADDR addr, int is_phys, int nowrite)
int target_unset_hw_watchpoint(struct target *target, tid_t tid, REG reg)
int(* pause_thread)(struct target *target, tid_t tid, int nowait)
struct target *(* instantiate_overlay)(struct target *target, struct target_thread *tthread, struct target_spec *spec, struct target_thread **ntthread)
struct array_list * target_list_threads(struct target *target)
struct target_memmod *(* insert_sw_breakpoint)(struct target *target, tid_t tid, ADDR addr)
int(* enable_hw_breakpoint)(struct target *target, tid_t tid, REG dreg)
int target_write_reg(struct target *target, tid_t tid, REG reg, REGVAL value)
int(* kill)(struct target *target, int sig)
target_status_t(* poll)(struct target *target, struct timeval *tv, target_poll_outcome_t *outcome, int *pstatus)
active_probe_flags_t ap_flags
#define OBJSDEAD(obj, type)
int(* enable_hw_breakpoints)(struct target *target, tid_t tid)
struct array_list * target_list_overlays(struct target *target)