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);
251 char *decoder_lib_lib);
346 #define MEMMOD_TYPE_BITS 2
352 unsigned int code_len,
int nowrite);
365 unsigned char *code,
unsigned long code_len);
376 #define MEMMOD_STATE_BITS 2
466 void *tstate,
void *tpstate);
539 struct mmap_entry *mme);
541 struct mmap_entry *mme);
551 char *key,
void *
value);
553 static inline void target_gkv_dtor_free(
struct target *target,
554 char *key,
void *
value) {
558 static inline void target_gkv_dtor_bsymbol(
struct target *target,
559 char *key,
void *
value) {
563 static inline void target_gkv_dtor_probe(
struct target *target,
564 char *key,
void *value) {
568 static inline void target_gkv_dtor_alist_deep_free(
struct target *target,
569 char *key,
void *value) {
571 array_list_deep_free((
struct array_list *)value);
573 static inline void target_thread_gkv_dtor_free(
struct target *target,
574 char *key,
void *value) {
588 char *key,
void *value,
651 ADDR *start,
ADDR *end,
int *is_noncontiguous,
659 struct symbol **o_datatype,
664 ADDR *start,
ADDR *end,
int *is_noncontiguous,
669 ADDR *start,
ADDR *end,
int *is_noncontiguous,
727 #ifdef ENABLE_DISTORM
734 unsigned char *inst_buf,
unsigned int buf_len,
735 struct array_list **idata_list_saveptr,
int noabort);
737 unsigned char *inst_buf,
unsigned int buf_len,
741 unsigned char *inst_buf,
unsigned int buf_len,
748 #define SAFE_PERSONALITY_OP_WARN(op,outvar,expoutval,target,...) \
750 if (target->personality_ops && target->personality_ops->op) { \
751 vdebug(5,LA_TARGET,LF_TARGET, \
752 "target(%s): personality_ops->" #op "\n", \
754 outvar = target->personality_ops->op(target, ## __VA_ARGS__); \
755 if (outvar != expoutval) { \
756 vwarnopt(5,LA_TARGET,LF_TARGET, \
757 "target(%s): personality_ops->" #op " failed!\n", \
763 outvar = expoutval; \
766 #define SAFE_PERSONALITY_OP_WARN_NORET(op,outvar,expoutval,target,...) \
768 if (target->personality_ops && target->personality_ops->op) { \
769 vdebug(5,LA_TARGET,LF_TARGET, \
770 "target(%s): personality_ops->" #op "\n", \
772 outvar = target->personality_ops->op(target, ## __VA_ARGS__); \
773 if (outvar != expoutval) { \
774 vwarnopt(5,LA_TARGET,LF_TARGET, \
775 "target(%s): personality_ops->" #op " failed!\n", \
780 outvar = expoutval; \
783 #define SAFE_PERSONALITY_OP(op,outvar,defoutval,target,...) \
785 if (target->personality_ops && target->personality_ops->op) { \
786 vdebug(5,LA_TARGET,LF_TARGET, \
787 "target(%s): personality_ops->" #op "\n", \
789 outvar = target->personality_ops->op(target, ## __VA_ARGS__); \
792 outvar = defoutval; \
795 #define SAFE_TARGET_OP(op,outvar,expoutval,target,...) \
797 if (target->ops && target->ops->op) { \
798 vdebug(5,LA_TARGET,LF_TARGET, \
799 "target(%s): ops->" #op "\n", \
801 outvar = target->ops->op(target, ## __VA_ARGS__); \
802 if (outvar != expoutval) { \
803 vwarnopt(5,LA_TARGET,LF_TARGET, \
804 "target(%s): ops->" #op " failed!\n", \
809 else if (target->personality_ops && target->personality_ops->op) { \
810 vdebug(5,LA_TARGET,LF_TARGET, \
811 "target(%s): personality_ops->" #op "\n", \
813 outvar = target->personality_ops->op(target, ## __VA_ARGS__); \
814 if (outvar != expoutval) { \
815 vwarnopt(5,LA_TARGET,LF_TARGET, \
816 "target(%s): personality_ops->" #op " failed!\n", \
822 outvar = expoutval; \
825 #define SAFE_TARGET_OP_WARN_NORET(op,outvar,expoutval,target,...) \
827 if (target->ops && target->ops->op) { \
828 vdebug(5,LA_TARGET,LF_TARGET, \
829 "target(%s): ops->" #op "\n", \
831 outvar = target->ops->op(target, ## __VA_ARGS__); \
832 if (outvar != expoutval) { \
833 vwarnopt(5,LA_TARGET,LF_TARGET, \
834 "target(%s): ops->" #op " failed!\n", \
838 else if (target->personality_ops && target->personality_ops->op) { \
839 vdebug(5,LA_TARGET,LF_TARGET, \
840 "target(%s): personality_ops->" #op "\n", \
842 outvar = target->personality_ops->op(target, ## __VA_ARGS__); \
843 if (outvar != expoutval) { \
844 vwarnopt(5,LA_TARGET,LF_TARGET, \
845 "target(%s): personality_ops->" #op " failed!\n", \
850 outvar = expoutval; \
853 #define SAFE_TARGET_ONLY_OP(op,outvar,expoutval,target,...) \
855 if (target->ops && target->ops->op) { \
856 vdebug(5,LA_TARGET,LF_TARGET, \
857 "target(%s): ops->" #op "\n", \
859 outvar = target->ops->op(target, ## __VA_ARGS__); \
860 if (outvar != expoutval) { \
861 vwarnopt(5,LA_TARGET,LF_TARGET, \
862 "target(%s): ops->" #op " failed!\n", \
868 outvar = expoutval; \
int target_regcache_isdirty_reg_range(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG start, REG end)
int memrange_contains_real(struct memrange *range, ADDR real_addr)
unsigned long target_generic_fd_write(int fd, ADDR addr, unsigned long length, unsigned char *buf)
ADDR memrange_relocate(struct memrange *range, ADDR obj)
struct array_list * threads
struct value * value_create_noalloc(struct target_thread *thread, struct memrange *range, struct lsymbol *lsymbol, struct symbol *type)
int target_memmod_release(struct target *target, tid_t tid, 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)
struct target_thread * target_create_thread(struct target *target, tid_t tid, void *tstate, void *tpstate)
void target_gkv_destroy(struct target *target)
void value_set_strlen(struct value *value, int len)
int target_associate_debugfile(struct target *target, struct memregion *region, struct debugfile *debugfile)
void memrange_obj_flags_propagate(struct memrange *range, obj_flags_t orf, obj_flags_t nandf)
int target_memmod_free(struct target *target, tid_t tid, struct target_memmod *mmod, int force)
int target_regcache_copy_dirty_to(struct target_thread *sthread, thread_ctxt_t stidctxt, struct regcache *dregcache)
int(* target_regcache_regval_handler_t)(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg, REGVAL regval, void *priv)
int memrange_contains_obj(struct memrange *range, ADDR obj_addr)
struct target_thread * target_lookup_thread(struct target *target, tid_t tid)
unsigned long target_memmod_length(struct target *target, struct target_memmod *mmod)
struct memrange * memrange_create(struct memregion *region, ADDR start, ADDR end, OFFSET offset, unsigned int prot_flags)
int target_decoder_lib_bind(struct target *target, char *decoder_lib, char *decoder_lib_lib)
void target_release_mmap_entry(struct target *target, struct mmap_entry *mme)
int target_regcache_writereg_tidctxt(struct target *target, tid_t tid, thread_ctxt_t tidctxt, REG reg, REGVAL value)
int target_personality_register(char *personality, target_personality_t pt, struct target_personality_ops *ptops, void *pops)
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)
int target_regcache_init_reg_tidctxt(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg, REGVAL regval)
int target_regcache_isdirty_reg(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg)
int target_memmod_set(struct target *target, tid_t tid, struct target_memmod *mmod)
struct target_thread * owner
target_status_t target_get_status(struct target *target)
GHashTable * target_regcache_copy_registers(struct target *target, tid_t tid)
int target_detach_action(struct target *target, struct action *action)
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_attach_space(struct target *target, struct addrspace *space)
int _target_unchange_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
struct location_ops target_location_ops
struct target * target_lookup_overlay(struct target *target, tid_t tid)
target_memmod_state_t state
int target_remove_probepoint(struct target *target, struct target_thread *tthread, struct probepoint *probepoint)
void target_thread_gkv_destroy(struct target *target, struct target_thread *tthread)
int addrspace_find_range_real(struct addrspace *space, ADDR addr, struct memregion **region_saveptr, struct memrange **range_saveptr)
struct target_thread * thread
target_personality_t ptype
int memregion_detach_range(struct memregion *region, struct memrange *range)
void * target_gkv_steal(struct target *target, char *key)
int target_attach_probe(struct target *target, struct target_thread *thread, struct probe *probe)
struct target_decoder_binding * target_decoder_binding_create(struct target_decoder_lib *lib, struct target *target)
void target_reuse_thread_as_global(struct target *target, struct target_thread *thread)
void memregion_obj_flags_propagate(struct memregion *region, obj_flags_t orf, obj_flags_t nandf)
#define MEMMOD_STATE_BITS
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 debugfile * target_lookup_debugfile(struct target *target, ADDR addr)
int target_memmod_set_writeable(struct target *target, struct target_memmod *mmod, int writeable)
void memrange_dump(struct memrange *range, struct dump_info *ud)
REFCNT bsymbol_free(struct bsymbol *bsymbol, int force)
int target_regcache_readreg_ifdirty(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg, REGVAL *regval)
int memregion_contains_real(struct memregion *region, ADDR addr)
int target_thread_obj_flags_propagate(struct target_thread *tthread, obj_flags_t orf, obj_flags_t nandf)
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)
struct regcache * target_regcache_get(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt)
int target_personality_attach(struct target *target, char *personality, char *personality_lib)
void target_gkv_remove(struct target *target, char *key)
struct target * memrange_target(struct memrange *range)
int target_attach_overlay_thread(struct target *base, struct target *overlay, tid_t newtid)
struct target_memmod * mmod
void(* target_gkv_dtor_t)(struct target *target, char *key, void *value)
void target_thread_gkv_remove(struct target *target, tid_t tid, char *key)
int target_invalidate_all_threads(struct target *target)
REFCNT bsymbol_release(struct bsymbol *bsymbol)
struct target_decoder_lib * lib
int target_insert_probepoint(struct target *target, struct target_thread *tthread, struct probepoint *probepoint)
void * target_thread_gkv_lookup(struct target *target, tid_t tid, char *key)
struct value * value_create_raw(struct target *target, struct target_thread *thread, struct memrange *range, int len)
void(* target_thread_gkv_dtor_t)(struct target *target, tid_t tid, char *key, void *value)
struct memregion * addrspace_match_region_start(struct addrspace *space, region_type_t rtype, ADDR start)
int probe_free(struct probe *probe, int force)
void target_detach_thread(struct target *target, struct target_thread *tthread)
target_memmod_type_t type
void * target_gkv_lookup(struct target *target, char *key)
int value_set_child(struct value *value, struct value *parent_value, ADDR addr)
int target_regcache_init_done(struct target *target, tid_t tid, thread_ctxt_t tctxt)
struct value * parent_value
target_breakpoint_type_t bptype
int target_thread_gkv_insert(struct target *target, tid_t tid, char *key, void *value, target_thread_gkv_dtor_t dtor)
REFCNT memrange_free(struct memrange *range, int force)
int target_regcache_isdirty(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt)
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)
int target_memmod_unset(struct target *target, tid_t tid, struct target_memmod *mmod)
unsigned char * __target_load_addr_real(struct target *target, struct memrange *range, ADDR addr, load_flags_t flags, unsigned char *buf, int bufsiz)
struct value * value_create_type(struct target_thread *thread, struct memrange *range, struct symbol *type)
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 memrange * memregion_match_range(struct memregion *region, ADDR start)
REFCNT target_thread_free(struct target_thread *tthread, int force)
int addrspace_detach_region(struct addrspace *space, struct memregion *region)
void addrspace_obj_flags_propagate(struct addrspace *addrspace, obj_flags_t orf, obj_flags_t nandf)
int target_detach_space(struct target *target, struct addrspace *space)
struct addrspace * addrspace_create(struct target *target, char *name, ADDR tag)
REFCNT addrspace_free(struct addrspace *space, int force)
int target_memmod_set_tmp(struct target *target, tid_t tid, struct target_memmod *mmod, unsigned char *code, unsigned long code_len)
unsigned char * target_generic_fd_read(int fd, ADDR addr, unsigned long length, unsigned char *buf)
void memregion_dump(struct memregion *region, struct dump_info *ud)
struct target_ops * target_get_ops(target_type_t target_type)
struct memregion * memregion_create(struct addrspace *space, region_type_t type, char *name)
int value_set_addr(struct value *value, ADDR addr)
int target_gkv_insert(struct target *target, char *key, void *value, target_gkv_dtor_t dtor)
int target_regcache_zero(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt)
int target_attach_action(struct target *target, struct action *action)
struct memrange * memregion_find_range_obj(struct memregion *region, ADDR obj_addr)
REFCNT memregion_free(struct memregion *region, int force)
struct memregion * addrspace_find_region(struct addrspace *space, char *name)
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)
struct bsymbol * bsymbol_create(struct lsymbol *lsymbol, struct memregion *region)
struct probepoint * target_lookup_probepoint(struct target *target, struct target_thread *tthread, ADDR addr)
ADDR memregion_relocate(struct memregion *region, ADDR obj_addr, struct memrange **range_saveptr)
GSList * value_regex_list
struct memregion * region
void target_thread_set_status(struct target_thread *tthread, thread_status_t status)
struct value * value_create(struct target_thread *thread, struct memrange *range, struct lsymbol *lsymbol, struct symbol *type)
struct target_nv_filter * target_nv_filter_parse(char *expr)
struct target_personality_ops * ptops
int value_set_reg(struct value *value, REG reg)
unsigned int thread_ctxt_t
struct addrspace * memrange_space(struct memrange *range)
int target_regcache_copy_from(struct target_thread *dthread, thread_ctxt_t dtidctxt, struct regcache *sregcache)
void addrspace_dump(struct addrspace *space, struct dump_info *ud)
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)
REGVAL target_regcache_readreg(struct target *target, tid_t tid, REG reg)
int target_decoder_lib_register(struct target_decoder_lib *lib)
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 * target_create(char *type, struct target_spec *spec)
struct memregion * addrspace_match_region_name(struct addrspace *space, region_type_t rtype, char *name)
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_thread_filter_check(struct target *target, tid_t tid, struct target_nv_filter *tf)
struct target_memmod * target_memmod_lookup(struct target *target, tid_t tid, ADDR addr, int is_phys)
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)
REGVAL target_regcache_readreg_tidctxt(struct target *target, tid_t tid, thread_ctxt_t tidctxt, REG reg)
int target_regcache_invalidate(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt)
int _target_remove_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
REFCNT target_free(struct target *target, int force)
int _target_disable_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod)
int target_obj_flags_propagate(struct target *target, obj_flags_t orf, obj_flags_t nandf)
struct mmap_entry * target_lookup_mmap_entry(struct target *target, ADDR base_addr)
void symbol_rvalue_print(FILE *stream, struct symbol *symbol, void *buf, int bufsiz, load_flags_t flags, struct target *target)
int target_regcache_copy_all_zero(struct target_thread *sthread, thread_ctxt_t stidctxt, struct target_thread *dthread, thread_ctxt_t dtidctxt)
void target_tid_set_status(struct target *target, tid_t tid, thread_status_t status)
int target_decoder_lib_load(char *filename)
int target_invalidate_thread(struct target *target, struct target_thread *tthread)
struct target_spec * spec
void target_attach_mmap_entry(struct target *target, struct mmap_entry *mme)
debugfile_type_flags_t flags
GHashTable * target_regcache_copy_registers_tidctxt(struct target *target, tid_t tid, thread_ctxt_t tidctxt)
int disasm_get_prologue_stack_size(struct target *target, unsigned char *inst_buf, unsigned int buf_len, int *sp)
int target_regcache_mark_flushed(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt)
void target_decoder_binding_free(struct target_decoder_binding *tdb)
int target_detach_overlay_thread(struct target *base, struct target *overlay, tid_t tid)
ADDR memregion_unrelocate(struct memregion *region, ADDR real_addr, struct memrange **range_saveptr)
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)
ADDR memrange_unrelocate(struct memrange *range, ADDR real)
void value_set_const(struct value *value)
int target_regcache_copy_all(struct target_thread *sthread, thread_ctxt_t stidctxt, struct target_thread *dthread, thread_ctxt_t dtidctxt)
int target_detach_probe(struct target *target, struct probe *probe)
int _target_change_sw_breakpoint(struct target *target, tid_t tid, struct target_memmod *mmod, unsigned char *code, unsigned long code_len)
void target_detach_overlay(struct target *base, tid_t overlay)
struct target_breakpoint::@22::@24 probe
struct memrange * memregion_find_range_real(struct memregion *region, ADDR real_addr)
struct memregion * region
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)
void target_set_status(struct target *target, target_status_t status)