41 #define LOGDUMPBSYMBOL(dl,lt,s) \
43 "bsymbol(lsymbol(%s,%s,%"PRIxSMOFFSET";chainlen=%d)," \
44 "region=(%s(space=%s:0x%"PRIxADDR")))", \
45 symbol_get_name((s)->lsymbol->symbol), \
46 SYMBOL_TYPE((s)->lsymbol->symbol->type), \
47 (s)->lsymbol->symbol->ref, \
48 array_list_len((s)->lsymbol->chain), \
49 (s)->region ? (s)->region->name : NULL, \
50 (s)->region ? (s)->region->space->name : NULL, \
51 (s)->region ? (s)->region->space->tag : 0);
53 #define LOGDUMPBSYMBOL_NL(dl,lt,s) \
54 LOGDUMPBSYMBOL((dl),(lt),(s)); \
55 vdebugc((dl),(lt),"\n");
57 #define ERRORDUMPBSYMBOL(s) \
58 verrorc("bsymbol(lsymbol(%s,%s,%"PRIxSMOFFSET";chainlen=%d)," \
59 "region=(%s(space=%s:0x%"PRIxADDR")))", \
60 symbol_get_name((s)->lsymbol->symbol), \
61 SYMBOL_TYPE((s)->lsymbol->symbol->type), \
62 (s)->lsymbol->symbol->ref, \
63 array_list_len((s)->lsymbol->chain), \
64 (s)->region ? (s)->region->name : NULL, \
65 (s)->region ? (s)->region->space->name : NULL, \
66 (s)->region ? (s)->region->space->tag : 0);
68 #define ERRORDUMPBSYMBOL_NL(s) \
69 ERRORDUMPBSYMBOL((s)); \
88 struct mmap_entry *mme);
90 struct mmap_entry *mme);
126 unsigned char *buf,
int bufsiz);
144 unsigned char *code,
unsigned long code_len);
165 REG reg,
void *rawval,
int rawlen,
190 int detail,
char *sep,
char *kvsep,
int flags);
241 char *personality,
char *personality_lib);
335 #define MEMMOD_TYPE_BITS 2
341 unsigned int code_len,
int nowrite);
354 unsigned char *code,
unsigned long code_len);
365 #define MEMMOD_STATE_BITS 2
455 void *tstate,
void *tpstate);
528 struct mmap_entry *mme);
530 struct mmap_entry *mme);
540 char *key,
void *
value);
542 static inline void target_gkv_dtor_free(
struct target *target,
543 char *key,
void *
value) {
547 static inline void target_gkv_dtor_bsymbol(
struct target *target,
548 char *key,
void *
value) {
552 static inline void target_gkv_dtor_probe(
struct target *target,
553 char *key,
void *value) {
557 static inline void target_gkv_dtor_alist_deep_free(
struct target *target,
558 char *key,
void *value) {
560 array_list_deep_free((
struct array_list *)value);
562 static inline void target_thread_gkv_dtor_free(
struct target *target,
563 char *key,
void *value) {
577 char *key,
void *value,
640 ADDR *start,
ADDR *end,
int *is_noncontiguous,
648 struct symbol **o_datatype,
653 ADDR *start,
ADDR *end,
int *is_noncontiguous,
658 ADDR *start,
ADDR *end,
int *is_noncontiguous,
716 #ifdef ENABLE_DISTORM
723 unsigned char *inst_buf,
unsigned int buf_len,
724 struct array_list **idata_list_saveptr,
int noabort);
726 unsigned char *inst_buf,
unsigned int buf_len,
730 unsigned char *inst_buf,
unsigned int buf_len,
737 #define SAFE_PERSONALITY_OP_WARN(op,outvar,expoutval,target,...) \
739 if (target->personality_ops && target->personality_ops->op) { \
740 vdebug(5,LA_TARGET,LF_TARGET, \
741 "target(%s): personality_ops->" #op "\n", \
743 outvar = target->personality_ops->op(target, ## __VA_ARGS__); \
744 if (outvar != expoutval) { \
745 vwarnopt(5,LA_TARGET,LF_TARGET, \
746 "target(%s): personality_ops->" #op " failed!\n", \
752 outvar = expoutval; \
755 #define SAFE_PERSONALITY_OP_WARN_NORET(op,outvar,expoutval,target,...) \
757 if (target->personality_ops && target->personality_ops->op) { \
758 vdebug(5,LA_TARGET,LF_TARGET, \
759 "target(%s): personality_ops->" #op "\n", \
761 outvar = target->personality_ops->op(target, ## __VA_ARGS__); \
762 if (outvar != expoutval) { \
763 vwarnopt(5,LA_TARGET,LF_TARGET, \
764 "target(%s): personality_ops->" #op " failed!\n", \
769 outvar = expoutval; \
772 #define SAFE_PERSONALITY_OP(op,outvar,defoutval,target,...) \
774 if (target->personality_ops && target->personality_ops->op) { \
775 vdebug(5,LA_TARGET,LF_TARGET, \
776 "target(%s): personality_ops->" #op "\n", \
778 outvar = target->personality_ops->op(target, ## __VA_ARGS__); \
781 outvar = defoutval; \
784 #define SAFE_TARGET_OP(op,outvar,expoutval,target,...) \
786 if (target->ops && target->ops->op) { \
787 vdebug(5,LA_TARGET,LF_TARGET, \
788 "target(%s): ops->" #op "\n", \
790 outvar = target->ops->op(target, ## __VA_ARGS__); \
791 if (outvar != expoutval) { \
792 vwarnopt(5,LA_TARGET,LF_TARGET, \
793 "target(%s): ops->" #op " failed!\n", \
798 else if (target->personality_ops && target->personality_ops->op) { \
799 vdebug(5,LA_TARGET,LF_TARGET, \
800 "target(%s): personality_ops->" #op "\n", \
802 outvar = target->personality_ops->op(target, ## __VA_ARGS__); \
803 if (outvar != expoutval) { \
804 vwarnopt(5,LA_TARGET,LF_TARGET, \
805 "target(%s): personality_ops->" #op " failed!\n", \
811 outvar = expoutval; \
814 #define SAFE_TARGET_OP_WARN_NORET(op,outvar,expoutval,target,...) \
816 if (target->ops && target->ops->op) { \
817 vdebug(5,LA_TARGET,LF_TARGET, \
818 "target(%s): ops->" #op "\n", \
820 outvar = target->ops->op(target, ## __VA_ARGS__); \
821 if (outvar != expoutval) { \
822 vwarnopt(5,LA_TARGET,LF_TARGET, \
823 "target(%s): ops->" #op " failed!\n", \
827 else if (target->personality_ops && target->personality_ops->op) { \
828 vdebug(5,LA_TARGET,LF_TARGET, \
829 "target(%s): personality_ops->" #op "\n", \
831 outvar = target->personality_ops->op(target, ## __VA_ARGS__); \
832 if (outvar != expoutval) { \
833 vwarnopt(5,LA_TARGET,LF_TARGET, \
834 "target(%s): personality_ops->" #op " failed!\n", \
839 outvar = expoutval; \
842 #define SAFE_TARGET_ONLY_OP(op,outvar,expoutval,target,...) \
844 if (target->ops && target->ops->op) { \
845 vdebug(5,LA_TARGET,LF_TARGET, \
846 "target(%s): ops->" #op "\n", \
848 outvar = target->ops->op(target, ## __VA_ARGS__); \
849 if (outvar != expoutval) { \
850 vwarnopt(5,LA_TARGET,LF_TARGET, \
851 "target(%s): ops->" #op " failed!\n", \
857 outvar = expoutval; \
struct bsymbol * bsymbol_create(struct lsymbol *lsymbol, struct memregion *region)
REFCNT target_thread_free(struct target_thread *tthread, int force)
unsigned long target_generic_fd_write(int fd, ADDR addr, unsigned long length, unsigned char *buf)
int addrspace_detach_region(struct addrspace *space, struct memregion *region)
int memregion_contains_real(struct memregion *region, ADDR addr)
REGVAL target_regcache_readreg_tidctxt(struct target *target, tid_t tid, thread_ctxt_t tidctxt, REG reg)
struct array_list * threads
struct value * value_create_noalloc(struct target_thread *thread, struct memrange *range, struct lsymbol *lsymbol, struct symbol *type)
REFCNT memrange_free(struct memrange *range, int force)
unsigned long target_memmod_length(struct target *target, struct target_memmod *mmod)
int disasm_generic(struct target *target, unsigned char *inst_buf, unsigned int buf_len, struct array_list **idata_list_saveptr, int noabort)
void value_set_strlen(struct value *value, int len)
target_status_t target_get_status(struct target *target)
int(* target_regcache_regval_handler_t)(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg, REGVAL regval, void *priv)
int target_regcache_zero(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt)
ADDR memregion_unrelocate(struct memregion *region, ADDR real_addr, struct memrange **range_saveptr)
void target_release_mmap_entry(struct target *target, struct mmap_entry *mme)
void memrange_dump(struct memrange *range, struct dump_info *ud)
int target_insert_probepoint(struct target *target, struct target_thread *tthread, struct probepoint *probepoint)
void addrspace_obj_flags_propagate(struct addrspace *space, obj_flags_t orf, obj_flags_t nandf)
int target_personality_register(char *personality, target_personality_t pt, struct target_personality_ops *ptops, void *pops)
void target_thread_gkv_remove(struct target *target, tid_t tid, char *key)
int addrspace_find_range_real(struct addrspace *space, ADDR addr, struct memregion **region_saveptr, struct memrange **range_saveptr)
int target_detach_probe(struct target *target, struct probe *probe)
int target_regcache_copy_all(struct target_thread *sthread, thread_ctxt_t stidctxt, struct target_thread *dthread, thread_ctxt_t dtidctxt)
int target_lsymbol_resolve_bounds(struct target *target, struct target_location_ctxt *tlctxt, struct lsymbol *lsymbol, ADDR base_addr, ADDR *start, ADDR *end, int *is_noncontiguous, ADDR *alt_start, ADDR *alt_end)
int target_regcache_copy_dirty_to(struct target_thread *sthread, thread_ctxt_t stidctxt, struct regcache *dregcache)
struct target_thread * owner
GHashTable * target_regcache_copy_registers(struct target *target, tid_t tid)
int memregion_detach_range(struct memregion *region, struct memrange *range)
struct probepoint * target_lookup_probepoint(struct target *target, struct target_thread *tthread, ADDR addr)
int memrange_contains_obj(struct memrange *range, ADDR obj_addr)
int target_regcache_copy_from(struct target_thread *dthread, thread_ctxt_t dtidctxt, struct regcache *sregcache)
int target_regcache_init_done(struct target *target, tid_t tid, thread_ctxt_t tctxt)
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_unchange_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
int target_detach_space(struct target *target, struct addrspace *space)
struct regcache * target_regcache_get(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt)
struct target * target_create(char *type, struct target_spec *spec)
void * target_gkv_steal(struct target *target, char *key)
target_memmod_state_t state
struct debugfile * target_lookup_debugfile(struct target *target, ADDR addr)
int target_regcache_writereg_tidctxt(struct target *target, tid_t tid, thread_ctxt_t tidctxt, REG reg, REGVAL value)
int target_remove_probepoint(struct target *target, struct target_thread *tthread, struct probepoint *probepoint)
int target_associate_debugfile(struct target *target, struct memregion *region, struct debugfile *debugfile)
int target_detach_action(struct target *target, struct action *action)
struct target_thread * thread
target_personality_t ptype
unsigned char * __target_load_addr_real(struct target *target, struct memrange *range, ADDR addr, load_flags_t flags, unsigned char *buf, int bufsiz)
int target_attach_space(struct target *target, struct addrspace *space)
void target_detach_thread(struct target *target, struct target_thread *tthread)
#define MEMMOD_STATE_BITS
int target_regcache_isdirty_reg(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg)
struct memrange * memregion_find_range_obj(struct memregion *region, ADDR obj_addr)
int(* target_regcache_rawval_handler_t)(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg, void *rawval, int rawlen, void *priv)
struct memregion * memregion_create(struct addrspace *space, region_type_t type, char *name)
int target_invalidate_thread(struct target *target, struct target_thread *tthread)
int target_personality_attach(struct target *target, char *personality, char *personality_lib)
int value_set_mmap(struct value *value, ADDR addr, struct memcache_mmap_entry *mme, char *offset_ptr)
int disasm_get_control_flow_offsets(struct target *target, inst_cf_flags_t flags, unsigned char *inst_buf, unsigned int buf_len, struct array_list **offset_list, ADDR base, int noabort)
int target_regcache_foreach_dirty(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, target_regcache_regval_handler_t regh, target_regcache_rawval_handler_t rawh, void *priv)
struct target_memmod * mmod
void(* target_gkv_dtor_t)(struct target *target, char *key, void *value)
int target_thread_gkv_insert(struct target *target, tid_t tid, char *key, void *value, target_thread_gkv_dtor_t dtor)
int target_bsymbol_resolve_bounds(struct target *target, struct target_location_ctxt *tlctxt, struct bsymbol *bsymbol, ADDR base_addr, ADDR *start, ADDR *end, int *is_noncontiguous, ADDR *alt_start, ADDR *alt_end)
struct memrange * memrange_create(struct memregion *region, ADDR start, ADDR end, OFFSET offset, unsigned int prot_flags)
REFCNT memregion_free(struct memregion *region, int force)
void memregion_dump(struct memregion *region, struct dump_info *ud)
REFCNT bsymbol_release(struct bsymbol *bsymbol)
REFCNT bsymbol_free(struct bsymbol *bsymbol, int force)
struct value * value_create_raw(struct target *target, struct target_thread *thread, struct memrange *range, int len)
struct memregion * addrspace_match_region_start(struct addrspace *space, region_type_t rtype, ADDR start)
struct target_memmod * target_memmod_lookup(struct target *target, tid_t tid, ADDR addr, int is_phys)
void(* target_thread_gkv_dtor_t)(struct target *target, tid_t tid, char *key, void *value)
void target_memmod_set_writeable(struct target *target, struct target_memmod *mmod, int writeable)
int probe_free(struct probe *probe, int force)
int target_attach_overlay_thread(struct target *base, struct target *overlay, tid_t newtid)
struct memrange * memregion_find_range_real(struct memregion *region, ADDR real_addr)
target_memmod_type_t type
int value_set_child(struct value *value, struct value *parent_value, ADDR addr)
int target_symbol_resolve_bounds(struct target *target, struct target_location_ctxt *tlctxt, struct symbol *symbol, ADDR *start, ADDR *end, int *is_noncontiguous, ADDR *alt_start, ADDR *alt_end)
struct value * parent_value
target_breakpoint_type_t bptype
struct memregion * addrspace_match_region_name(struct addrspace *space, region_type_t rtype, char *name)
void memregion_obj_flags_propagate(struct memregion *region, obj_flags_t orf, obj_flags_t nandf)
struct memrange * memregion_match_range(struct memregion *region, ADDR start)
int target_memmod_unset(struct target *target, tid_t tid, struct target_memmod *mmod)
struct value * value_create_type(struct target_thread *thread, struct memrange *range, struct symbol *type)
int target_regcache_copy_all_zero(struct target_thread *sthread, thread_ctxt_t stidctxt, struct target_thread *dthread, thread_ctxt_t dtidctxt)
struct target * memrange_target(struct memrange *range)
int target_gkv_insert(struct target *target, char *key, void *value, target_gkv_dtor_t dtor)
int target_regcache_snprintf(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, char *buf, int bufsiz, int detail, char *sep, char *kvsep, int flags)
unsigned char * target_generic_fd_read(int fd, ADDR addr, unsigned long length, unsigned char *buf)
int value_set_addr(struct value *value, ADDR addr)
int target_attach_probe(struct target *target, struct target_thread *thread, struct probe *probe)
ADDR memrange_unrelocate(struct memrange *range, ADDR real)
int target_regcache_readreg_ifdirty(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg, REGVAL *regval)
REFCNT target_free(struct target *target, int force)
int _target_enable_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
const char * disasm_get_inst_name(inst_type_t type)
int target_regcache_init_reg_tidctxt(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg, REGVAL regval)
GSList * value_regex_list
struct memregion * region
struct target_ops * target_get_ops(target_type_t target_type)
void target_detach_overlay(struct target *base, tid_t overlaytid)
struct value * value_create(struct target_thread *thread, struct memrange *range, struct lsymbol *lsymbol, struct symbol *type)
int target_detach_overlay_thread(struct target *base, struct target *overlay, tid_t tid)
struct target_nv_filter * target_nv_filter_parse(char *expr)
struct target_personality_ops * ptops
int value_set_reg(struct value *value, REG reg)
int target_regcache_mark_flushed(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt)
unsigned int thread_ctxt_t
void target_thread_set_status(struct target_thread *tthread, thread_status_t status)
void addrspace_dump(struct addrspace *space, struct dump_info *ud)
void * target_thread_gkv_lookup(struct target *target, tid_t tid, char *key)
int target_memmod_release(struct target *target, tid_t tid, struct target_memmod *mmod)
int target_attach_action(struct target *target, struct action *action)
int target_invalidate_all_threads(struct target *target)
struct location_ops target_location_ops
int memrange_contains_real(struct memrange *range, ADDR real_addr)
int target_regcache_isdirty(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt)
void target_reuse_thread_as_global(struct target *target, struct target_thread *thread)
struct addrspace * memrange_space(struct memrange *range)
void target_thread_gkv_destroy(struct target *target, struct target_thread *tthread)
void target_nv_filter_free(struct target_nv_filter *pf)
int target_load_reg(struct target *target, struct target_thread *tthread, REG reg, REGVAL regval)
struct target * target_lookup_overlay(struct target *target, tid_t tid)
int _target_remove_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
int target_memmod_set(struct target *target, tid_t tid, struct target_memmod *mmod)
int _target_disable_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
ADDR memregion_relocate(struct memregion *region, ADDR obj_addr, struct memrange **range_saveptr)
int target_obj_flags_propagate(struct target *target, obj_flags_t orf, obj_flags_t nandf)
void target_gkv_destroy(struct target *target)
struct mmap_entry * target_lookup_mmap_entry(struct target *target, ADDR base_addr)
int target_regcache_isdirty_reg_range(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG start, REG end)
int target_regcache_invalidate(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt)
REGVAL target_regcache_readreg(struct target *target, tid_t tid, REG reg)
void target_tid_set_status(struct target *target, tid_t tid, thread_status_t status)
struct target_spec * spec
ADDR memrange_relocate(struct memrange *range, ADDR obj)
int target_memmod_set_tmp(struct target *target, tid_t tid, struct target_memmod *mmod, unsigned char *code, unsigned long code_len)
void target_attach_mmap_entry(struct target *target, struct mmap_entry *mme)
debugfile_type_flags_t flags
int disasm_get_prologue_stack_size(struct target *target, unsigned char *inst_buf, unsigned int buf_len, int *sp)
void symbol_rvalue_print(FILE *stream, struct symbol *symbol, void *buf, int bufsiz, load_flags_t flags, struct target *target)
struct target_thread * target_lookup_thread(struct target *target, tid_t tid)
void target_set_status(struct target *target, target_status_t status)
target_type_t target_type(struct target *target)
struct target_memmod * _target_insert_sw_breakpoint(struct target *target, tid_t tid, ADDR addr, int is_phys, int nowrite)
void value_set_const(struct value *value)
void memrange_obj_flags_propagate(struct memrange *range, obj_flags_t orf, obj_flags_t nandf)
void target_gkv_remove(struct target *target, char *key)
void * target_gkv_lookup(struct target *target, char *key)
struct memregion * addrspace_find_region(struct addrspace *space, char *name)
GHashTable * target_regcache_copy_registers_tidctxt(struct target *target, tid_t tid, thread_ctxt_t tidctxt)
int target_thread_filter_check(struct target *target, tid_t tid, struct target_nv_filter *tf)
struct target_thread * target_create_thread(struct target *target, tid_t tid, void *tstate, void *tpstate)
int _target_change_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod, unsigned char *code, unsigned long code_len)
int target_regcache_writereg(struct target *target, tid_t tid, REG reg, REGVAL value)
void * target_thread_gkv_steal(struct target *target, tid_t tid, char *key)
struct target_breakpoint::@22::@24 probe
int target_thread_obj_flags_propagate(struct target_thread *tthread, obj_flags_t orf, obj_flags_t nandf)
int target_memmod_free(struct target *target, tid_t tid, struct target_memmod *mmod, int force)
struct memregion * region
loctype_t target_lsymbol_resolve_location(struct target *target, struct target_location_ctxt *tlctxt, struct lsymbol *lsymbol, ADDR base_addr, load_flags_t flags, struct location *o_loc, struct symbol **o_datatype, struct memrange **o_range)
REFCNT addrspace_free(struct addrspace *space, int force)
struct addrspace * addrspace_create(struct target *target, char *name, ADDR tag)