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!");
130 if (base_target_specs) {
131 lcopy = g_list_copy(base_target_specs);
139 else if (error_specs) {
140 vwarn(
"could not instantiate target spec %d\n",i);
141 *error_specs = g_list_append(*error_specs,spec);
144 verror(
"could not instantiate target spec %d\n",i);
149 retval = g_list_append(retval,target);
151 else if (error_specs) {
152 vwarn(
"could not instantiate target spec %d\n",i);
155 *error_specs = g_list_append(*error_specs,spec);
158 verror(
"could not instantiate target spec %d\n",i);
169 if (overlay_target_specs) {
170 lcopy = g_list_copy(overlay_target_specs);
174 base_target = primary_target;
180 verror(
"could not instantiate overlay target spec %d;"
181 " no base target with id %d\n",
186 vwarn(
"could not instantiate overlay target spec %d;"
187 " no base target with id %d\n",
189 *error_specs = g_list_append(*error_specs,spec);
200 verror(
"could not instantiate overlay target spec %d;"
201 " no base target thread named %s\n",
206 vwarn(
"could not instantiate overlay target spec %d;"
207 " no base target thread named %s\n",
209 *error_specs = g_list_append(*error_specs,spec);
218 retval = g_list_append(retval,target);
220 else if (!error_specs) {
221 verror(
"could not instantiate overlay target spec %d"
222 " on base thread %d\n",
227 vwarn(
"could not instantiate overlay target spec %d"
228 " on base thread %d\n",
230 *error_specs = g_list_append(*error_specs,spec);
234 retval = g_list_append(retval,target);
236 else if (error_specs) {
237 vwarn(
"could not instantiate target spec %d\n",i);
240 *error_specs = g_list_append(*error_specs,spec);
243 verror(
"could not instantiate target spec %d\n",i);
262 retval = g_list_reverse(retval);
273 GList **error_specs) {
279 GList *retval = NULL;
280 int progress,last_progress;
281 struct target *base_target;
282 tid_t base_thread_id;
284 lcopy = g_list_copy(target_specs);
297 last_progress = progress;
303 #ifdef ENABLE_XENSUPPORT
314 if (!base_target && !last_progress) {
316 verror(
"could not lookup base target id %d for"
321 vwarn(
"could not lookup base target id %d for"
324 *error_specs = g_list_append(*error_specs,spec);
328 else if (!base_target) {
339 if (base_thread_id < 0) {
341 verror(
"could not lookup base target thread name %s"
342 " for overlay target spec\n",
347 vwarn(
"could not lookup base target thread name %s"
348 " for overlay target spec; skipping\n",
351 *error_specs = g_list_append(*error_specs,spec);
365 retval = g_list_append(retval,target);
367 else if (error_specs) {
368 vwarn(
"could not instantiate target spec %d\n",i);
369 *error_specs = g_list_append(*error_specs,spec);
372 vwarn(
"could not instantiate target spec %d\n",i);
385 retval = g_list_reverse(retval);
398 tspec = calloc(1,
sizeof(*tspec));
401 tspec = calloc(1,
sizeof(*tspec));
404 #ifdef ENABLE_XENSUPPORT
406 tspec = calloc(1,
sizeof(*tspec));
411 tspec = calloc(1,
sizeof(*tspec));
415 tspec = calloc(1,
sizeof(*tspec));
419 tspec = calloc(1,
sizeof(*tspec));
443 #ifdef ENABLE_XENSUPPORT
504 verror(
"cannot open a target without a specification!\n");
517 "loading user-specified personality '%s' (%s)\n",
521 verror(
"Failed to initialize user-specified personality (%d)!\n",rc);
526 verror(
"cannot specify a personality library without a"
527 " personality name!\n");
533 if ((rc = target->
ops->
init(target))) {
541 target->
name = strdup(buf);
544 verror(
"cannot init a target in BPMODE_STRICT that does not have"
584 "target(%s:%s:0x%"PRIxADDR") finished region(%s:%s,"
623 "no active probing support in target(%s)\n",target->
name);
642 verror(
"could not load available threads!\n");
646 retval = array_list_create(g_hash_table_size(target->
threads));
647 g_hash_table_iter_init(&iter,target->
threads);
648 while (g_hash_table_iter_next(&iter,NULL,(gpointer)&tthread)) {
653 || (type & tthread->supported_overlay_types))
654 array_list_append(retval,(
void *)(uintptr_t)tthread->tid);
656 array_list_compact(retval);
664 if (g_hash_table_size(target->
overlays) == 0)
667 return array_list_create_from_g_hash_table(target->
overlays);
674 verror(
"no overlay support in target(%s)!\n",target->
name);
694 verror(
"no overlay support in target(%s)!\n",target->
name);
726 struct target *overlay;
731 verror(
"no overlay support in target(%s)!\n",target->
name);
739 if (g_hash_table_lookup(target->
overlays,(gpointer)(uintptr_t)tid)
740 || g_hash_table_lookup(target->
overlay_aliases,(gpointer)(uintptr_t)tid)) {
749 verror(
"target(%s) tid %d could not be loaded!\n",target->
name,tid);
756 verror(
"target(%s) tid %"PRIiTID" failed to create overlay!\n",
771 g_hash_table_insert(target->
overlays,
772 (gpointer)(uintptr_t)tthread->
tid,overlay);
773 RHOLD(overlay,target);
775 if (tid == tthread->
tid) {
777 "target(%s) tid %"PRIiTID" new overlay target(%s) (id %d)\n",
782 "target(%s) tid %"PRIiTID" new overlay target(%s) (id %d)"
783 " (not using user-supplied thread %d; base target overrode it!)\n",
797 verror(
"an evloop is already associated with target(%s)!\n",
811 vwarn(
"no evloop is associated with target(%s)!\n",
825 if (target->
evloop && evloop && target->
evloop == evloop)
832 verror(
"cannot monitor target(%s) in state %s; ERROR!\n",
873 &fdinfo,&fdtype,&hrc);
876 if (errno == EINTR) {
887 else if (errno == EBADF || errno == EINVAL || errno == ENOMEM
888 || errno == ENOENT || errno == EBADSLT || errno == ENOTSUP) {
894 "evloop_handlone: unexpected error '%s' (%d)\n",
895 strerror(errno),errno);
906 t = (
struct target *)fdinfo->
rhstate;
908 t = (
struct target *)fdinfo->
whstate;
910 t = (
struct target *)fdinfo->
xhstate;
932 verror(
"evloop_handleone returned 0 but still FDs to handle!\n");
939 verror(
"evloop_handleone returned unexpected code '%d'; aborting!\n",
948 *target = (
struct target *)fdinfo->
rhstate;
950 *target = (
struct target *)fdinfo->
whstate;
952 *target = (
struct target *)fdinfo->
xhstate;
956 if (status && *target)
957 *status = (*target)->
status;
965 verror(
"cannot poll target(%s) in state %s; ERROR!\n",
970 return target->
ops->
poll(target,tv,outcome,pstatus);
975 verror(
"cannot resume target(%s) in state %s; ERROR!\n",
981 "not pausing target(%s); already finished\n",target->
name);
991 "not pausing target(%s); already paused\n",target->
name);
996 "not pausing target(%s); already finished\n",target->
name);
1000 return target->
ops->
pause(target,0);
1009 "calling backend to get target(%s) status\n",target->
name);
1015 unsigned long length,
unsigned char *buf) {
1017 target->
name,addr,buf,length);
1018 return target->
ops->
read(target,addr,length,buf);
1022 unsigned long length,
unsigned char *buf) {
1024 target->
name,addr,length);
1025 return target->
ops->
write(target,addr,length,buf);
1030 vwarn(
"target(%s) does not support v2p addr translation!\n",target->
name);
1036 return target->
ops->
addr_v2p(target,tid,vaddr,paddr);
1040 unsigned long length,
unsigned char *buf) {
1042 vwarn(
"target(%s) does not support phys addr reads!\n",target->
name);
1047 "reading target(%s) at phys 0x%"PRIxADDR" into %p (%d)\n",
1048 target->
name,paddr,buf,length);
1049 return target->
ops->
read_phys(target,paddr,length,buf);
1053 unsigned long length,
unsigned char *buf) {
1055 vwarn(
"target(%s) does not support phys addr writes!\n",target->
name);
1060 "writing target(%s) at phys 0x%"PRIxADDR" (%d)\n",
1061 target->
name,paddr,length);
1085 target->
name,tid,reg);
1095 target->
name,tid,reg,value);
1097 return target->
ops->
writereg(target,tid,reg,value);
1106 "reading target(%s:%"PRIiTID") reg %d tidctxt %d)\n",
1107 target->
name,tid,reg,tidctxt);
1115 target->
name,tid,reg,tidctxt,value);
1140 "copying target(%s:%"PRIiTID") regs\n",
1147 GHashTableIter iter;
1151 if (g_hash_table_size(target->
threads) == 0)
1154 retval = array_list_create(g_hash_table_size(target->
threads));
1156 g_hash_table_iter_init(&iter,target->
threads);
1157 while (g_hash_table_iter_next(&iter,&key,(gpointer)&tthread)) {
1162 array_list_append(retval,(
void *)(
ptr_t)tthread->tid);
1170 GHashTableIter iter;
1174 retval = array_list_create(g_hash_table_size(target->
threads));
1176 g_hash_table_iter_init(&iter,target->
threads);
1177 while (g_hash_table_iter_next(&iter,&key,(gpointer)&tthread)) {
1182 array_list_append(retval,tthread);
1190 GHashTableIter iter;
1194 retval = g_hash_table_new_full(g_direct_hash,g_direct_equal,NULL,NULL);
1196 g_hash_table_iter_init(&iter,target->
threads);
1197 while (g_hash_table_iter_next(&iter,&key,(gpointer)&tthread))
1202 g_hash_table_insert(retval,key,tthread);
1220 verror(
"could not load available tids!\n");
1224 retval = g_hash_table_new_full(g_direct_hash,g_direct_equal,NULL,NULL);
1226 for (i = 0; i < array_list_len(tids); ++i) {
1228 g_hash_table_insert(retval,(gpointer)(
ptr_t)tid,(gpointer)(
ptr_t)tid);
1230 array_list_free(tids);
1260 target->
name,tid,nowait);
1276 GHashTableIter iter;
1277 struct target *overlay;
1281 "flushing all target(%s) threads\n",target->
name);
1286 g_hash_table_iter_init(&iter,target->
overlays);
1287 while (g_hash_table_iter_next(&iter,NULL,(gpointer)&overlay)) {
1289 "flushing all overlay target(%s) threads\n",overlay->name);
1292 "flushing all overlay target(%s) threads (%d)\n",overlay->name,rc);
1307 GHashTable *real_tids;
1318 verror(
"could not list cached threads!\n");
1324 verror(
"could not load currently available threads!\n");
1325 array_list_free(cached_tids);
1329 for (i = 0; i < array_list_len(cached_tids); ++i) {
1330 tid = (
tid_t)(
ptr_t)array_list_item(cached_tids,i);
1335 if (!g_hash_table_lookup_extended(real_tids,(gpointer)(
ptr_t)tid,
1338 vwarn(
"thread %d seems to no longer exist, but is the"
1339 " current thread; not detaching!\n",tid);
1344 "cached thread %"PRIiTID" no longer exists; detaching!\n",tid);
1350 array_list_free(cached_tids);
1351 g_hash_table_destroy(real_tids);
1361 char *buf,
int bufsiz,
1362 int detail,
char *sep,
char *kvsep) {
1385 return snprintf(buf,bufsiz,
"tid%s%"PRIiTID,kvsep,tthread->
tid);
1386 else if (detail < 0)
1387 return snprintf(buf,bufsiz,
"tid%s%"PRIiTID "%s" "name%s%s" "%s"
1389 kvsep,tid,sep,kvsep,tthread->
name,sep,
1392 return snprintf(buf,bufsiz,
1393 "tid%s%"PRIiTID "%s" "name%s%s" "%s" "curctxt%s%d" "%s"
1395 "uid%s%d" "%s" "gid%s%d",
1396 kvsep,tthread->
tid,sep,kvsep,tthread->
name,sep,
1398 kvsep,tthread->
ptid,sep,kvsep,tthread->
tgid,sep,
1399 kvsep,tthread->
uid,sep,kvsep,tthread->
gid);
1401 rc = snprintf(buf,bufsiz,
1402 "tid%s%"PRIiTID
"%s" "name%s%s" "%s" "curctxt%s%d" "%s"
1403 "ptid%s%"PRIiTID
"%s" "ptid%s%"PRIiTID
"%s"
1404 "uid%s%d" "%s" "gid%s%d" "%s",
1405 kvsep,tthread->
tid,sep,kvsep,tthread->
name,sep,
1407 kvsep,tthread->
ptid,sep,kvsep,tthread->
tgid,sep,
1408 kvsep,tthread->
uid,sep,kvsep,tthread->
gid,sep);
1430 fprintf(stream ? stream : stdout,
"tid(%"PRIiTID"): <API ERROR>\n",tid);
1432 fprintf(stream ? stream : stdout,
"tid(%"PRIiTID"): %s\n",tid,buf);
1437 GHashTableIter iter;
1441 g_hash_table_iter_init(&iter,target->
threads);
1442 while (g_hash_table_iter_next(&iter,NULL,(gpointer)&tthread))
1448 GHashTableIter iter;
1450 struct target *overlay;
1467 g_hash_table_iter_init(&iter,target->
overlays);
1468 while (g_hash_table_iter_next(&iter,NULL,(gpointer)&overlay)) {
1470 "closing overlay target(%s)\n",overlay->name);
1473 "closed overlay target(%s) (%d)\n",overlay->name,rc);
1489 while (g_hash_table_iter_next(&iter,NULL,(gpointer)&probepoint)) {
1497 g_hash_table_iter_init(&iter,target->
mmods);
1498 while (g_hash_table_iter_next(&iter,NULL,(gpointer)&mmod)) {
1499 g_hash_table_iter_remove(&iter);
1509 if (rlen != mmod->orig_len) {
1511 " but cannot do anything!\n",mmod->addr);
1515 if (mmod->threads) {
1516 array_list_free(mmod->threads);
1523 "sw bp removal notification failed; ignoring\n");
1534 verror(
"detach target(%s) failed: %s\n",target->
name,strerror(errno));
1558 GHashTableIter iter;
1569 g_hash_table_iter_init(&iter,target->
threads);
1570 while (g_hash_table_iter_next(&iter,NULL,&vp)) {
1589 return target->
ops->
kill(target,sig);
1593 RHOLD(target,target);
1598 RPUT(target,target,target,trefcnt);
1602 return (
struct probe *)g_hash_table_lookup(target->
probes,
1603 (gpointer)(uintptr_t)probe_id);
1607 return (
struct action *)g_hash_table_lookup(target->
actions,
1608 (gpointer)(uintptr_t)action_id);
1628 verror(
"mmod already at 0x%"PRIxADDR"; but not breakpoint!\n",addr);
1633 verror(
"mmod already at 0x%"PRIxADDR"; state is not SUBST (%d)!\n",
1640 if (array_list_find(mmod->
threads,tthread) < 0)
1641 array_list_append(mmod->
threads,tthread);
1643 vwarn(
"tid %"PRIiTID" already on threads list; BUG!\n",tid);
1658 vwarn(
"sw bp insertion notification failed; ignoring\n");
1689 vwarn(
"sw bp removal notification failed; ignoring\n");
1731 unsigned char *code,
unsigned long code_len) {
1737 unsigned char *code,
unsigned long code_len) {
1767 target->
name,tid,retval);
1773 "setting hw breakpoint at 0x%"PRIxADDR" on target(%s:%"PRIiTID") dreg %d\n",
1774 addr,target->
name,tid,reg);
1781 "setting hw watchpoint at 0x%"PRIxADDR" on target(%s:%"PRIiTID") dreg %d (%d)\n",
1782 addr,target->
name,tid,reg,watchsize);
1788 "removing hw breakpoint on target(%s:%"PRIiTID") dreg %d\n",
1789 target->
name,tid,reg);
1795 "removing hw watchpoint on target(%s:%"PRIiTID") dreg %d\n",
1796 target->
name,tid,reg);
1802 "disable hw breakpoints on target(%s:%"PRIiTID")\n",target->
name,tid);
1808 "enable hw breakpoints on target(%s:%"PRIiTID")\n",target->
name,tid);
1815 dreg,target->
name,tid);
1822 dreg,target->
name,tid);
1830 "notify sw breakpoint (%d) on target(%s)\n",
1831 notification,target->
name);
1840 target->
name,tid,isbp);
1859 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)
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
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)
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_unchange_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
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)
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)
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)
int _target_enable_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
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)
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)
int _target_remove_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
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)
int _target_disable_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
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_obj_flags_propagate(struct target *target, obj_flags_t orf, obj_flags_t nandf)
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)
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)
struct target_memmod * _target_insert_sw_breakpoint(struct target *target, tid_t tid, ADDR addr, int is_phys, int nowrite)
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)
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)
int _target_change_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod, unsigned char *code, unsigned long code_len)
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)