Stackdb
Stackdb is a stackable, multi-target and -level source debugger and memory forensics library.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
target.h File Reference
#include "config.h"
#include <stdint.h>
#include <inttypes.h>
#include <glib.h>
#include "common.h"
#include "object.h"
#include "debugpred.h"
#include "alist.h"
#include "log.h"
#include "memcache.h"
#include "target_api.h"
#include "dwdebug.h"
#include "probe.h"
Include dependency graph for target.h:

Go to the source code of this file.

Data Structures

struct  target_personality_info
 
struct  target_breakpoint
 
struct  target_memmod
 
struct  target_nv_filter_regex
 
struct  target_nv_filter
 
struct  addrspace
 
struct  memregion
 
struct  memrange
 
struct  bsymbol
 

Macros

#define LOGDUMPBSYMBOL(dl, lt, s)
 
#define LOGDUMPBSYMBOL_NL(dl, lt, s)
 
#define ERRORDUMPBSYMBOL(s)
 
#define ERRORDUMPBSYMBOL_NL(s)
 
#define MEMMOD_TYPE_BITS   2
 
#define MEMMOD_STATE_BITS   2
 
#define SAFE_PERSONALITY_OP_WARN(op, outvar, expoutval, target,...)
 
#define SAFE_PERSONALITY_OP_WARN_NORET(op, outvar, expoutval, target,...)
 
#define SAFE_PERSONALITY_OP(op, outvar, defoutval, target,...)
 
#define SAFE_TARGET_OP(op, outvar, expoutval, target,...)
 
#define SAFE_TARGET_OP_WARN_NORET(op, outvar, expoutval, target,...)
 
#define SAFE_TARGET_ONLY_OP(op, outvar, expoutval, target,...)
 

Typedefs

typedef int(* target_regcache_regval_handler_t )(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg, REGVAL regval, void *priv)
 
typedef 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)
 
typedef void(* target_gkv_dtor_t )(struct target *target, char *key, void *value)
 
typedef void(* target_thread_gkv_dtor_t )(struct target *target, tid_t tid, char *key, void *value)
 

Enumerations

enum  target_breakpoint_type_t { BP_NONE = 0, BP_SW = 1, BP_HW = 2, BP_PROBE = 3 }
 
enum  target_memmod_type_t { MMT_NONE = 0, MMT_BP = 1, MMT_DATA = 2, MMT_CODE = 3 }
 
enum  target_memmod_state_t { MMS_ORIG = 1, MMS_SUBST = 2, MMS_TMP = 3 }
 

Functions

struct target_opstarget_get_ops (target_type_t target_type)
 
struct targettarget_create (char *type, struct target_spec *spec)
 
struct mmap_entry * target_lookup_mmap_entry (struct target *target, ADDR base_addr)
 
void target_attach_mmap_entry (struct target *target, struct mmap_entry *mme)
 
void target_release_mmap_entry (struct target *target, struct mmap_entry *mme)
 
unsigned char * target_generic_fd_read (int fd, ADDR addr, unsigned long length, unsigned char *buf)
 
unsigned long target_generic_fd_write (int fd, ADDR addr, unsigned long length, unsigned char *buf)
 
int target_associate_debugfile (struct target *target, struct memregion *region, struct debugfile *debugfile)
 
struct debugfiletarget_lookup_debugfile (struct target *target, ADDR addr)
 
int target_attach_space (struct target *target, struct addrspace *space)
 
int target_detach_space (struct target *target, struct addrspace *space)
 
int target_load_reg (struct target *target, struct target_thread *tthread, REG reg, REGVAL regval)
 
unsigned char * __target_load_addr_real (struct target *target, struct memrange *range, ADDR addr, load_flags_t flags, unsigned char *buf, int bufsiz)
 
struct target_memmod_target_insert_sw_breakpoint (struct target *target, tid_t tid, ADDR addr, int is_phys, int nowrite)
 
int _target_remove_sw_breakpoint (struct target *target, tid_t tid, struct target_memmod *mmod)
 
int _target_enable_sw_breakpoint (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)
 
int _target_change_sw_breakpoint (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)
 
int target_regcache_init_reg_tidctxt (struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg, REGVAL regval)
 
int target_regcache_init_done (struct target *target, tid_t tid, thread_ctxt_t tctxt)
 
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)
 
int target_regcache_readreg_ifdirty (struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg, REGVAL *regval)
 
int target_regcache_isdirty (struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt)
 
int target_regcache_isdirty_reg (struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg)
 
int target_regcache_isdirty_reg_range (struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG start, REG end)
 
struct regcachetarget_regcache_get (struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt)
 
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)
 
int target_regcache_zero (struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt)
 
int target_regcache_mark_flushed (struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt)
 
int target_regcache_invalidate (struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt)
 
int target_regcache_copy_all (struct target_thread *sthread, thread_ctxt_t stidctxt, struct target_thread *dthread, thread_ctxt_t dtidctxt)
 
int target_regcache_copy_all_zero (struct target_thread *sthread, thread_ctxt_t stidctxt, struct target_thread *dthread, thread_ctxt_t dtidctxt)
 
int target_regcache_copy_from (struct target_thread *dthread, thread_ctxt_t dtidctxt, struct regcache *sregcache)
 
int target_regcache_copy_dirty_to (struct target_thread *sthread, thread_ctxt_t stidctxt, struct regcache *dregcache)
 
REGVAL target_regcache_readreg (struct target *target, tid_t tid, REG reg)
 
int target_regcache_writereg (struct target *target, tid_t tid, REG reg, REGVAL value)
 
GHashTable * target_regcache_copy_registers (struct target *target, tid_t tid)
 
REGVAL target_regcache_readreg_tidctxt (struct target *target, tid_t tid, thread_ctxt_t tidctxt, REG reg)
 
int target_regcache_writereg_tidctxt (struct target *target, tid_t tid, thread_ctxt_t tidctxt, REG reg, REGVAL value)
 
GHashTable * target_regcache_copy_registers_tidctxt (struct target *target, tid_t tid, thread_ctxt_t tidctxt)
 
int target_personality_attach (struct target *target, char *personality, char *personality_lib)
 
int target_personality_register (char *personality, target_personality_t pt, struct target_personality_ops *ptops, void *pops)
 
int target_decoder_lib_load (char *filename)
 
int target_decoder_lib_register (struct target_decoder_lib *lib)
 
int target_decoder_lib_bind (struct target *target, char *decoder_lib, char *decoder_lib_lib)
 
struct target_decoder_bindingtarget_decoder_binding_create (struct target_decoder_lib *lib, struct target *target)
 
void target_decoder_binding_free (struct target_decoder_binding *tdb)
 
struct targettarget_lookup_overlay (struct target *target, tid_t tid)
 
void target_detach_overlay (struct target *base, tid_t overlay)
 
int target_attach_overlay_thread (struct target *base, struct target *overlay, tid_t newtid)
 
int target_detach_overlay_thread (struct target *base, struct target *overlay, tid_t tid)
 
struct target_memmodtarget_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_memmod_set_writeable (struct target *target, struct target_memmod *mmod, int writeable)
 
struct target_memmodtarget_memmod_lookup (struct target *target, tid_t tid, ADDR addr, int is_phys)
 
unsigned long target_memmod_length (struct target *target, struct target_memmod *mmod)
 
int target_memmod_set (struct target *target, tid_t tid, struct target_memmod *mmod)
 
int target_memmod_unset (struct target *target, tid_t tid, struct target_memmod *mmod)
 
int target_memmod_set_tmp (struct target *target, tid_t tid, struct target_memmod *mmod, unsigned char *code, unsigned long code_len)
 
int target_memmod_release (struct target *target, tid_t tid, struct target_memmod *mmod)
 
int target_memmod_free (struct target *target, tid_t tid, struct target_memmod *mmod, int force)
 
struct probepointtarget_lookup_probepoint (struct target *target, struct target_thread *tthread, ADDR addr)
 
int target_insert_probepoint (struct target *target, struct target_thread *tthread, struct probepoint *probepoint)
 
int target_remove_probepoint (struct target *target, struct target_thread *tthread, struct probepoint *probepoint)
 
target_status_t target_get_status (struct target *target)
 
void target_set_status (struct target *target, target_status_t status)
 
int target_obj_flags_propagate (struct target *target, obj_flags_t orf, obj_flags_t nandf)
 
REFCNT target_free (struct target *target, int force)
 
struct target_threadtarget_lookup_thread (struct target *target, tid_t tid)
 
struct target_threadtarget_create_thread (struct target *target, tid_t tid, void *tstate, void *tpstate)
 
void target_reuse_thread_as_global (struct target *target, struct target_thread *thread)
 
void target_detach_thread (struct target *target, struct target_thread *tthread)
 
int target_thread_obj_flags_propagate (struct target_thread *tthread, obj_flags_t orf, obj_flags_t nandf)
 
REFCNT target_thread_free (struct target_thread *tthread, int force)
 
int target_invalidate_thread (struct target *target, struct target_thread *tthread)
 
int target_invalidate_all_threads (struct target *target)
 
void target_thread_set_status (struct target_thread *tthread, thread_status_t status)
 
void target_tid_set_status (struct target *target, tid_t tid, thread_status_t status)
 
struct addrspaceaddrspace_create (struct target *target, char *name, ADDR tag)
 
struct memregionaddrspace_find_region (struct addrspace *space, char *name)
 
struct memregionaddrspace_match_region_name (struct addrspace *space, region_type_t rtype, char *name)
 
struct memregionaddrspace_match_region_start (struct addrspace *space, region_type_t rtype, ADDR start)
 
int addrspace_find_range_real (struct addrspace *space, ADDR addr, struct memregion **region_saveptr, struct memrange **range_saveptr)
 
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)
 
REFCNT addrspace_free (struct addrspace *space, int force)
 
void addrspace_dump (struct addrspace *space, struct dump_info *ud)
 
struct memregionmemregion_create (struct addrspace *space, region_type_t type, char *name)
 
int memregion_contains_real (struct memregion *region, ADDR addr)
 
struct memrangememregion_find_range_real (struct memregion *region, ADDR real_addr)
 
struct memrangememregion_find_range_obj (struct memregion *region, ADDR obj_addr)
 
ADDR memregion_relocate (struct memregion *region, ADDR obj_addr, struct memrange **range_saveptr)
 
ADDR memregion_unrelocate (struct memregion *region, ADDR real_addr, struct memrange **range_saveptr)
 
struct memrangememregion_match_range (struct memregion *region, ADDR start)
 
void memregion_dump (struct memregion *region, struct dump_info *ud)
 
int memregion_detach_range (struct memregion *region, struct memrange *range)
 
void memregion_obj_flags_propagate (struct memregion *region, obj_flags_t orf, obj_flags_t nandf)
 
REFCNT memregion_free (struct memregion *region, int force)
 
struct memrangememrange_create (struct memregion *region, ADDR start, ADDR end, OFFSET offset, unsigned int prot_flags)
 
int memrange_contains_real (struct memrange *range, ADDR real_addr)
 
int memrange_contains_obj (struct memrange *range, ADDR obj_addr)
 
ADDR memrange_unrelocate (struct memrange *range, ADDR real)
 
ADDR memrange_relocate (struct memrange *range, ADDR obj)
 
struct targetmemrange_target (struct memrange *range)
 
struct addrspacememrange_space (struct memrange *range)
 
void memrange_dump (struct memrange *range, struct dump_info *ud)
 
void memrange_obj_flags_propagate (struct memrange *range, obj_flags_t orf, obj_flags_t nandf)
 
REFCNT memrange_free (struct memrange *range, int force)
 
int target_gkv_insert (struct target *target, char *key, void *value, target_gkv_dtor_t dtor)
 
void * target_gkv_lookup (struct target *target, char *key)
 
void * target_gkv_steal (struct target *target, char *key)
 
void target_gkv_remove (struct target *target, char *key)
 
void target_gkv_destroy (struct target *target)
 
int target_thread_gkv_insert (struct target *target, tid_t tid, char *key, void *value, target_thread_gkv_dtor_t dtor)
 
void * target_thread_gkv_lookup (struct target *target, tid_t tid, char *key)
 
void * target_thread_gkv_steal (struct target *target, tid_t tid, char *key)
 
void target_thread_gkv_remove (struct target *target, tid_t tid, char *key)
 
void target_thread_gkv_destroy (struct target *target, struct target_thread *tthread)
 
int target_attach_probe (struct target *target, struct target_thread *thread, struct probe *probe)
 
int target_detach_probe (struct target *target, struct probe *probe)
 
int target_attach_action (struct target *target, struct action *action)
 
int target_detach_action (struct target *target, struct action *action)
 
struct bsymbolbsymbol_create (struct lsymbol *lsymbol, struct memregion *region)
 
REFCNT bsymbol_free (struct bsymbol *bsymbol, int force)
 
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)
 
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_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_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 target_nv_filtertarget_nv_filter_parse (char *expr)
 
void target_nv_filter_free (struct target_nv_filter *pf)
 
int target_thread_filter_check (struct target *target, tid_t tid, struct target_nv_filter *tf)
 
struct valuevalue_create_raw (struct target *target, struct target_thread *thread, struct memrange *range, int len)
 
struct valuevalue_create_type (struct target_thread *thread, struct memrange *range, struct symbol *type)
 
struct valuevalue_create (struct target_thread *thread, struct memrange *range, struct lsymbol *lsymbol, struct symbol *type)
 
struct valuevalue_create_noalloc (struct target_thread *thread, struct memrange *range, struct lsymbol *lsymbol, struct symbol *type)
 
void value_set_strlen (struct value *value, int len)
 
int value_set_addr (struct value *value, ADDR addr)
 
int value_set_mmap (struct value *value, ADDR addr, struct memcache_mmap_entry *mme, char *offset_ptr)
 
int value_set_reg (struct value *value, REG reg)
 
int value_set_child (struct value *value, struct value *parent_value, ADDR addr)
 
void value_set_const (struct value *value)
 
void symbol_rvalue_print (FILE *stream, struct symbol *symbol, void *buf, int bufsiz, load_flags_t flags, struct target *target)
 

Variables

struct location_ops target_location_ops
 

Macro Definition Documentation

#define ERRORDUMPBSYMBOL (   s)
Value:
verrorc("bsymbol(lsymbol(%s,%s,%"PRIxSMOFFSET";chainlen=%d)," \
"region=(%s(space=%s:0x%"PRIxADDR")))", \
(s)->lsymbol->symbol->ref, \
array_list_len((s)->lsymbol->chain), \
(s)->region ? (s)->region->name : NULL, \
(s)->region ? (s)->region->space->name : NULL, \
(s)->region ? (s)->region->space->tag : 0);
struct symbol * symbol
Definition: dwdebug.h:1010
#define verrorc(format,...)
Definition: log.h:32
symbol_type_t type
Definition: dwdebug_priv.h:833
#define PRIxSMOFFSET
Definition: common.h:102
#define PRIxADDR
Definition: common.h:67
char * SYMBOL_TYPE(int n)
Definition: debug.c:5662
char * symbol_get_name(struct symbol *symbol)
Definition: debug.c:2587
struct array_list * chain
Definition: dwdebug.h:1016

Definition at line 57 of file target.h.

#define ERRORDUMPBSYMBOL_NL (   s)
Value:
verrorc("\n");
#define verrorc(format,...)
Definition: log.h:32
#define ERRORDUMPBSYMBOL(s)
Definition: target.h:57

Definition at line 68 of file target.h.

#define LOGDUMPBSYMBOL (   dl,
  lt,
 
)
Value:
vdebugc((dl),(lt), \
"bsymbol(lsymbol(%s,%s,%"PRIxSMOFFSET";chainlen=%d)," \
"region=(%s(space=%s:0x%"PRIxADDR")))", \
(s)->lsymbol->symbol->ref, \
array_list_len((s)->lsymbol->chain), \
(s)->region ? (s)->region->name : NULL, \
(s)->region ? (s)->region->space->name : NULL, \
(s)->region ? (s)->region->space->tag : 0);
struct symbol * symbol
Definition: dwdebug.h:1010
symbol_type_t type
Definition: dwdebug_priv.h:833
#define PRIxSMOFFSET
Definition: common.h:102
#define vdebugc(devel, areas, flags, format,...)
Definition: log.h:303
#define PRIxADDR
Definition: common.h:67
char * SYMBOL_TYPE(int n)
Definition: debug.c:5662
char * symbol_get_name(struct symbol *symbol)
Definition: debug.c:2587
struct array_list * chain
Definition: dwdebug.h:1016

Definition at line 41 of file target.h.

#define LOGDUMPBSYMBOL_NL (   dl,
  lt,
 
)
Value:
LOGDUMPBSYMBOL((dl),(lt),(s)); \
vdebugc((dl),(lt),"\n");
#define vdebugc(devel, areas, flags, format,...)
Definition: log.h:303
#define LOGDUMPBSYMBOL(dl, lt, s)
Definition: target.h:41

Definition at line 53 of file target.h.

#define MEMMOD_STATE_BITS   2

Definition at line 376 of file target.h.

#define MEMMOD_TYPE_BITS   2

Definition at line 346 of file target.h.

#define SAFE_PERSONALITY_OP (   op,
  outvar,
  defoutval,
  target,
  ... 
)
Value:
do { \
"target(%s): personality_ops->" #op "\n", \
target->name); \
outvar = target->personality_ops->op(target, ## __VA_ARGS__); \
} \
else \
outvar = defoutval; \
} while (0);
struct target_personality_ops * personality_ops
Definition: target_api.h:2585
#define vdebug(devel, areas, flags, format,...)
Definition: log.h:302
Definition: log.h:70
char * name
Definition: target_api.h:2521
Definition: log.h:162

Definition at line 783 of file target.h.

#define SAFE_PERSONALITY_OP_WARN (   op,
  outvar,
  expoutval,
  target,
  ... 
)
Value:
do { \
"target(%s): personality_ops->" #op "\n", \
target->name); \
outvar = target->personality_ops->op(target, ## __VA_ARGS__); \
if (outvar != expoutval) { \
"target(%s): personality_ops->" #op " failed!\n", \
target->name); \
return outvar; \
} \
} \
else \
outvar = expoutval; \
} while (0);
#define vwarnopt(level, area, flags, format,...)
Definition: log.h:37
struct target_personality_ops * personality_ops
Definition: target_api.h:2585
#define vdebug(devel, areas, flags, format,...)
Definition: log.h:302
Definition: log.h:70
char * name
Definition: target_api.h:2521
Definition: log.h:162

Disassembly helpers. Target/Personality API wrappers.

Definition at line 748 of file target.h.

#define SAFE_PERSONALITY_OP_WARN_NORET (   op,
  outvar,
  expoutval,
  target,
  ... 
)
Value:
do { \
"target(%s): personality_ops->" #op "\n", \
target->name); \
outvar = target->personality_ops->op(target, ## __VA_ARGS__); \
if (outvar != expoutval) { \
"target(%s): personality_ops->" #op " failed!\n", \
target->name); \
} \
} \
else \
outvar = expoutval; \
} while (0);
#define vwarnopt(level, area, flags, format,...)
Definition: log.h:37
struct target_personality_ops * personality_ops
Definition: target_api.h:2585
#define vdebug(devel, areas, flags, format,...)
Definition: log.h:302
Definition: log.h:70
char * name
Definition: target_api.h:2521
Definition: log.h:162

Definition at line 766 of file target.h.

#define SAFE_TARGET_ONLY_OP (   op,
  outvar,
  expoutval,
  target,
  ... 
)
Value:
do { \
if (target->ops && target->ops->op) { \
"target(%s): ops->" #op "\n", \
target->name); \
outvar = target->ops->op(target, ## __VA_ARGS__); \
if (outvar != expoutval) { \
"target(%s): ops->" #op " failed!\n", \
target->name); \
return outvar; \
} \
} \
else \
outvar = expoutval; \
} while (0);
#define vwarnopt(level, area, flags, format,...)
Definition: log.h:37
#define vdebug(devel, areas, flags, format,...)
Definition: log.h:302
Definition: log.h:70
char * name
Definition: target_api.h:2521
struct target_ops * ops
Definition: target_api.h:2548
Definition: log.h:162

Definition at line 853 of file target.h.

#define SAFE_TARGET_OP (   op,
  outvar,
  expoutval,
  target,
  ... 
)
Value:
do { \
if (target->ops && target->ops->op) { \
"target(%s): ops->" #op "\n", \
target->name); \
outvar = target->ops->op(target, ## __VA_ARGS__); \
if (outvar != expoutval) { \
"target(%s): ops->" #op " failed!\n", \
target->name); \
return outvar; \
} \
} \
"target(%s): personality_ops->" #op "\n", \
target->name); \
outvar = target->personality_ops->op(target, ## __VA_ARGS__); \
if (outvar != expoutval) { \
"target(%s): personality_ops->" #op " failed!\n", \
target->name); \
return outvar; \
} \
} \
else \
outvar = expoutval; \
} while (0);
#define vwarnopt(level, area, flags, format,...)
Definition: log.h:37
struct target_personality_ops * personality_ops
Definition: target_api.h:2585
#define vdebug(devel, areas, flags, format,...)
Definition: log.h:302
Definition: log.h:70
char * name
Definition: target_api.h:2521
struct target_ops * ops
Definition: target_api.h:2548
Definition: log.h:162

Definition at line 795 of file target.h.

#define SAFE_TARGET_OP_WARN_NORET (   op,
  outvar,
  expoutval,
  target,
  ... 
)
Value:
do { \
if (target->ops && target->ops->op) { \
"target(%s): ops->" #op "\n", \
target->name); \
outvar = target->ops->op(target, ## __VA_ARGS__); \
if (outvar != expoutval) { \
"target(%s): ops->" #op " failed!\n", \
target->name); \
} \
} \
"target(%s): personality_ops->" #op "\n", \
target->name); \
outvar = target->personality_ops->op(target, ## __VA_ARGS__); \
if (outvar != expoutval) { \
"target(%s): personality_ops->" #op " failed!\n", \
target->name); \
} \
} \
else \
outvar = expoutval; \
} while (0);
#define vwarnopt(level, area, flags, format,...)
Definition: log.h:37
struct target_personality_ops * personality_ops
Definition: target_api.h:2585
#define vdebug(devel, areas, flags, format,...)
Definition: log.h:302
Definition: log.h:70
char * name
Definition: target_api.h:2521
struct target_ops * ops
Definition: target_api.h:2548
Definition: log.h:162

Definition at line 825 of file target.h.

Typedef Documentation

typedef void(* target_gkv_dtor_t)(struct target *target, char *key, void *value)

Per-target and per-thread runtime key/value store. These always copy the key and free it on remove so that the user doesn't have to worry. Thus, the dtors MUST NOT free the key – it is for info purposes only.

Definition at line 549 of file target.h.

typedef 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)

Definition at line 162 of file target.h.

typedef int(* target_regcache_regval_handler_t)(struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg, REGVAL regval, void *priv)

Definition at line 157 of file target.h.

typedef void(* target_thread_gkv_dtor_t)(struct target *target, tid_t tid, char *key, void *value)

Definition at line 550 of file target.h.

Enumeration Type Documentation

Target breakpoints.

Enumerator
BP_NONE 
BP_SW 
BP_HW 
BP_PROBE 

Definition at line 274 of file target.h.

Enumerator
MMS_ORIG 
MMS_SUBST 
MMS_TMP 

Definition at line 371 of file target.h.

Target memmods.

Enumerator
MMT_NONE 
MMT_BP 
MMT_DATA 
MMT_CODE 

Definition at line 340 of file target.h.

Function Documentation

unsigned char* __target_load_addr_real ( struct target target,
struct memrange range,
ADDR  addr,
load_flags_t  flags,
unsigned char *  buf,
int  bufsiz 
)

Definition at line 3801 of file target.c.

int _target_change_sw_breakpoint ( struct target target,
tid_t  tid,
struct target_memmod mmod,
unsigned char *  code,
unsigned long  code_len 
)

Definition at line 1794 of file target_api.c.

int _target_disable_sw_breakpoint ( struct target target,
tid_t  tid,
struct target_memmod mmod 
)

Definition at line 1781 of file target_api.c.

int _target_enable_sw_breakpoint ( struct target target,
tid_t  tid,
struct target_memmod mmod 
)

Definition at line 1768 of file target_api.c.

struct target_memmod* _target_insert_sw_breakpoint ( struct target target,
tid_t  tid,
ADDR  addr,
int  is_phys,
int  nowrite 
)

Definition at line 1676 of file target_api.c.

int _target_remove_sw_breakpoint ( struct target target,
tid_t  tid,
struct target_memmod mmod 
)

Definition at line 1738 of file target_api.c.

int _target_unchange_sw_breakpoint ( struct target target,
tid_t  tid,
struct target_memmod mmod 
)

Definition at line 1809 of file target_api.c.

struct addrspace* addrspace_create ( struct target target,
char *  name,
ADDR  tag 
)

Address spaces.

Definition at line 41 of file memory.c.

int addrspace_detach_region ( struct addrspace space,
struct memregion region 
)

Definition at line 89 of file memory.c.

void addrspace_dump ( struct addrspace space,
struct dump_info ud 
)
int addrspace_find_range_real ( struct addrspace space,
ADDR  addr,
struct memregion **  region_saveptr,
struct memrange **  range_saveptr 
)

Definition at line 141 of file memory.c.

struct memregion* addrspace_find_region ( struct addrspace space,
char *  name 
)

Definition at line 69 of file memory.c.

REFCNT addrspace_free ( struct addrspace space,
int  force 
)

Definition at line 175 of file memory.c.

struct memregion* addrspace_match_region_name ( struct addrspace space,
region_type_t  rtype,
char *  name 
)

Definition at line 111 of file memory.c.

struct memregion* addrspace_match_region_start ( struct addrspace space,
region_type_t  rtype,
ADDR  start 
)

Definition at line 126 of file memory.c.

void addrspace_obj_flags_propagate ( struct addrspace addrspace,
obj_flags_t  orf,
obj_flags_t  nandf 
)

Definition at line 162 of file memory.c.

struct bsymbol* bsymbol_create ( struct lsymbol lsymbol,
struct memregion region 
)

Bound symbols.

Definition at line 48 of file symbol.c.

REFCNT bsymbol_free ( struct bsymbol bsymbol,
int  force 
)

Definition at line 96 of file symbol.c.

int memrange_contains_obj ( struct memrange range,
ADDR  obj_addr 
)

Definition at line 587 of file memory.c.

int memrange_contains_real ( struct memrange range,
ADDR  real_addr 
)

Definition at line 583 of file memory.c.

struct memrange* memrange_create ( struct memregion region,
ADDR  start,
ADDR  end,
OFFSET  offset,
unsigned int  prot_flags 
)

Definition at line 538 of file memory.c.

void memrange_dump ( struct memrange range,
struct dump_info ud 
)

Definition at line 591 of file memory.c.

REFCNT memrange_free ( struct memrange range,
int  force 
)

Definition at line 612 of file memory.c.

void memrange_obj_flags_propagate ( struct memrange range,
obj_flags_t  orf,
obj_flags_t  nandf 
)

Definition at line 606 of file memory.c.

ADDR memrange_relocate ( struct memrange range,
ADDR  obj 
)

Definition at line 602 of file memory.c.

struct addrspace* memrange_space ( struct memrange range)

Definition at line 574 of file memory.c.

struct target* memrange_target ( struct memrange range)

Definition at line 578 of file memory.c.

ADDR memrange_unrelocate ( struct memrange range,
ADDR  real 
)

Definition at line 598 of file memory.c.

int memregion_contains_real ( struct memregion region,
ADDR  addr 
)

Definition at line 327 of file memory.c.

struct memregion* memregion_create ( struct addrspace space,
region_type_t  type,
char *  name 
)

Memory region regions and ranges.

Definition at line 242 of file memory.c.

int memregion_detach_range ( struct memregion region,
struct memrange range 
)

Definition at line 293 of file memory.c.

void memregion_dump ( struct memregion region,
struct dump_info ud 
)

Definition at line 428 of file memory.c.

struct memrange* memregion_find_range_obj ( struct memregion region,
ADDR  obj_addr 
)

Definition at line 357 of file memory.c.

struct memrange* memregion_find_range_real ( struct memregion region,
ADDR  real_addr 
)

Definition at line 339 of file memory.c.

REFCNT memregion_free ( struct memregion region,
int  force 
)

Definition at line 445 of file memory.c.

struct memrange* memregion_match_range ( struct memregion region,
ADDR  start 
)

Definition at line 315 of file memory.c.

void memregion_obj_flags_propagate ( struct memregion region,
obj_flags_t  orf,
obj_flags_t  nandf 
)

Definition at line 433 of file memory.c.

ADDR memregion_relocate ( struct memregion region,
ADDR  obj_addr,
struct memrange **  range_saveptr 
)

Definition at line 375 of file memory.c.

ADDR memregion_unrelocate ( struct memregion region,
ADDR  real_addr,
struct memrange **  range_saveptr 
)

Definition at line 402 of file memory.c.

void symbol_rvalue_print ( FILE *  stream,
struct symbol symbol,
void *  buf,
int  bufsiz,
load_flags_t  flags,
struct target target 
)

Definition at line 352 of file symbol.c.

int target_associate_debugfile ( struct target target,
struct memregion region,
struct debugfile debugfile 
)

Definition at line 1993 of file target.c.

int target_attach_action ( struct target target,
struct action action 
)

Definition at line 4734 of file target.c.

void target_attach_mmap_entry ( struct target target,
struct mmap_entry *  mme 
)
int target_attach_overlay_thread ( struct target base,
struct target overlay,
tid_t  newtid 
)

Definition at line 4530 of file target.c.

int target_attach_probe ( struct target target,
struct target_thread thread,
struct probe probe 
)

Probes and actions.

Definition at line 4711 of file target.c.

int target_attach_space ( struct target target,
struct addrspace space 
)

Definition at line 4588 of file target.c.

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 
)

Definition at line 2433 of file target.c.

struct target* target_create ( char *  type,
struct target_spec spec 
)

Definition at line 1875 of file target.c.

struct target_thread* target_create_thread ( struct target target,
tid_t  tid,
void *  tstate,
void *  tpstate 
)

Definition at line 4063 of file target.c.

struct target_decoder_binding* target_decoder_binding_create ( struct target_decoder_lib lib,
struct target target 
)

Definition at line 6313 of file target.c.

void target_decoder_binding_free ( struct target_decoder_binding tdb)

Definition at line 6331 of file target.c.

int target_decoder_lib_bind ( struct target target,
char *  decoder_lib,
char *  decoder_lib_lib 
)

Definition at line 6206 of file target.c.

int target_decoder_lib_load ( char *  filename)

Target decoder stuff.

Decoder stuff.

Definition at line 6169 of file target.c.

int target_decoder_lib_register ( struct target_decoder_lib lib)

Definition at line 6195 of file target.c.

int target_detach_action ( struct target target,
struct action action 
)

Definition at line 4743 of file target.c.

void target_detach_overlay ( struct target base,
tid_t  overlay 
)

Definition at line 4509 of file target.c.

int target_detach_overlay_thread ( struct target base,
struct target overlay,
tid_t  tid 
)

Definition at line 4558 of file target.c.

int target_detach_probe ( struct target target,
struct probe probe 
)

Definition at line 4723 of file target.c.

int target_detach_space ( struct target target,
struct addrspace space 
)

Definition at line 4610 of file target.c.

void target_detach_thread ( struct target target,
struct target_thread tthread 
)

Definition at line 4115 of file target.c.

REFCNT target_free ( struct target target,
int  force 
)

Frees a target. Nobody should call this directly; the refcnt system calls it. Internal library users should call RHOLD/RPUT instead.

Definition at line 1636 of file target.c.

unsigned char* target_generic_fd_read ( int  fd,
ADDR  addr,
unsigned long  length,
unsigned char *  buf 
)

Definition at line 31 of file target_generic.c.

unsigned long target_generic_fd_write ( int  fd,
ADDR  addr,
unsigned long  length,
unsigned char *  buf 
)

Definition at line 125 of file target_generic.c.

struct target_ops* target_get_ops ( target_type_t  target_type)

Target functions.

Definition at line 1858 of file target.c.

target_status_t target_get_status ( struct target target)

Targets.

Definition at line 4029 of file target.c.

void target_gkv_destroy ( struct target target)

Definition at line 1472 of file target.c.

int target_gkv_insert ( struct target target,
char *  key,
void *  value,
target_gkv_dtor_t  dtor 
)

Definition at line 1407 of file target.c.

void* target_gkv_lookup ( struct target target,
char *  key 
)

Definition at line 1425 of file target.c.

void target_gkv_remove ( struct target target,
char *  key 
)

Definition at line 1454 of file target.c.

void* target_gkv_steal ( struct target target,
char *  key 
)

Definition at line 1436 of file target.c.

int target_insert_probepoint ( struct target target,
struct target_thread tthread,
struct probepoint probepoint 
)

Definition at line 4661 of file target.c.

int target_invalidate_all_threads ( struct target target)

Definition at line 4468 of file target.c.

int target_invalidate_thread ( struct target target,
struct target_thread tthread 
)

Definition at line 4408 of file target.c.

int target_load_reg ( struct target target,
struct target_thread tthread,
REG  reg,
REGVAL  regval 
)
struct debugfile* target_lookup_debugfile ( struct target target,
ADDR  addr 
)

Definition at line 2020 of file target.c.

struct mmap_entry * target_lookup_mmap_entry ( struct target target,
ADDR  base_addr 
)
struct target* target_lookup_overlay ( struct target target,
tid_t  tid 
)

Overlays.

Definition at line 4497 of file target.c.

struct probepoint* target_lookup_probepoint ( struct target target,
struct target_thread tthread,
ADDR  addr 
)

Probe linkage.

Definition at line 4636 of file target.c.

struct target_thread* target_lookup_thread ( struct target target,
tid_t  tid 
)

Threads.

Definition at line 4023 of file target.c.

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 
)

Definition at line 2418 of file target.c.

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 
)

Definition at line 2452 of file target.c.

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 
)

Definition at line 4768 of file target.c.

int target_memmod_free ( struct target target,
tid_t  tid,
struct target_memmod mmod,
int  force 
)

Definition at line 4970 of file target.c.

unsigned long target_memmod_length ( struct target target,
struct target_memmod mmod 
)

Definition at line 4752 of file target.c.

struct target_memmod* target_memmod_lookup ( struct target target,
tid_t  tid,
ADDR  addr,
int  is_phys 
)

Definition at line 4897 of file target.c.

int target_memmod_release ( struct target target,
tid_t  tid,
struct target_memmod mmod 
)

Definition at line 4933 of file target.c.

int target_memmod_set ( struct target target,
tid_t  tid,
struct target_memmod mmod 
)

Definition at line 5021 of file target.c.

int target_memmod_set_tmp ( struct target target,
tid_t  tid,
struct target_memmod mmod,
unsigned char *  code,
unsigned long  code_len 
)

Definition at line 5179 of file target.c.

int target_memmod_set_writeable ( struct target target,
struct target_memmod mmod,
int  writeable 
)

Definition at line 4884 of file target.c.

int target_memmod_unset ( struct target target,
tid_t  tid,
struct target_memmod mmod 
)

Definition at line 5102 of file target.c.

void target_nv_filter_free ( struct target_nv_filter pf)

Definition at line 34 of file target_nv_filter.c.

struct target_nv_filter* target_nv_filter_parse ( char *  expr)

Definition at line 48 of file target_nv_filter.c.

int target_obj_flags_propagate ( struct target target,
obj_flags_t  orf,
obj_flags_t  nandf 
)

Propagates object tracking flags to a target. Nobody should call this directly; the OBJ*() macros in object.h call it.

Definition at line 1620 of file target_api.c.

int target_personality_attach ( struct target target,
char *  personality,
char *  personality_lib 
)

Definition at line 6062 of file target.c.

int target_personality_register ( char *  personality,
target_personality_t  pt,
struct target_personality_ops ptops,
void *  pops 
)

Definition at line 6040 of file target.c.

int target_regcache_copy_all ( struct target_thread sthread,
thread_ctxt_t  stidctxt,
struct target_thread dthread,
thread_ctxt_t  dtidctxt 
)

Definition at line 6770 of file target.c.

int target_regcache_copy_all_zero ( struct target_thread sthread,
thread_ctxt_t  stidctxt,
struct target_thread dthread,
thread_ctxt_t  dtidctxt 
)

Definition at line 6798 of file target.c.

int target_regcache_copy_dirty_to ( struct target_thread sthread,
thread_ctxt_t  stidctxt,
struct regcache dregcache 
)

Definition at line 6840 of file target.c.

int target_regcache_copy_from ( struct target_thread dthread,
thread_ctxt_t  dtidctxt,
struct regcache sregcache 
)

Definition at line 6818 of file target.c.

GHashTable* target_regcache_copy_registers ( struct target target,
tid_t  tid 
)

Definition at line 6862 of file target.c.

GHashTable* target_regcache_copy_registers_tidctxt ( struct target target,
tid_t  tid,
thread_ctxt_t  tidctxt 
)

Definition at line 6867 of file target.c.

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 
)

Definition at line 6488 of file target.c.

struct regcache* target_regcache_get ( struct target target,
struct target_thread tthread,
thread_ctxt_t  tctxt 
)

Definition at line 6674 of file target.c.

int target_regcache_init_done ( struct target target,
tid_t  tid,
thread_ctxt_t  tctxt 
)

Definition at line 6470 of file target.c.

int target_regcache_init_reg_tidctxt ( struct target target,
struct target_thread tthread,
thread_ctxt_t  tctxt,
REG  reg,
REGVAL  regval 
)

Register regcache helpers.

Definition at line 6449 of file target.c.

int target_regcache_invalidate ( struct target target,
struct target_thread tthread,
thread_ctxt_t  tctxt 
)

Definition at line 6752 of file target.c.

int target_regcache_isdirty ( struct target target,
struct target_thread tthread,
thread_ctxt_t  tctxt 
)

Definition at line 6626 of file target.c.

int target_regcache_isdirty_reg ( struct target target,
struct target_thread tthread,
thread_ctxt_t  tctxt,
REG  reg 
)

Definition at line 6642 of file target.c.

int target_regcache_isdirty_reg_range ( struct target target,
struct target_thread tthread,
thread_ctxt_t  tctxt,
REG  start,
REG  end 
)

Definition at line 6658 of file target.c.

int target_regcache_mark_flushed ( struct target target,
struct target_thread tthread,
thread_ctxt_t  tctxt 
)

Definition at line 6734 of file target.c.

REGVAL target_regcache_readreg ( struct target target,
tid_t  tid,
REG  reg 
)

Definition at line 6528 of file target.c.

int target_regcache_readreg_ifdirty ( struct target target,
struct target_thread tthread,
thread_ctxt_t  tctxt,
REG  reg,
REGVAL regval 
)

Definition at line 6610 of file target.c.

REGVAL target_regcache_readreg_tidctxt ( struct target target,
tid_t  tid,
thread_ctxt_t  tidctxt,
REG  reg 
)

Definition at line 6885 of file target.c.

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 
)

Definition at line 6687 of file target.c.

int target_regcache_writereg ( struct target target,
tid_t  tid,
REG  reg,
REGVAL  value 
)

Definition at line 6569 of file target.c.

int target_regcache_writereg_tidctxt ( struct target target,
tid_t  tid,
thread_ctxt_t  tidctxt,
REG  reg,
REGVAL  value 
)

Definition at line 6907 of file target.c.

int target_regcache_zero ( struct target target,
struct target_thread tthread,
thread_ctxt_t  tctxt 
)

Definition at line 6717 of file target.c.

void target_release_mmap_entry ( struct target target,
struct mmap_entry *  mme 
)
int target_remove_probepoint ( struct target target,
struct target_thread tthread,
struct probepoint probepoint 
)

Definition at line 4687 of file target.c.

void target_reuse_thread_as_global ( struct target target,
struct target_thread thread 
)

Definition at line 4105 of file target.c.

void target_set_status ( struct target target,
target_status_t  status 
)

Definition at line 4035 of file target.c.

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 
)

Location resolution functions.

Definition at line 2403 of file target.c.

int target_thread_filter_check ( struct target target,
tid_t  tid,
struct target_nv_filter tf 
)

Definition at line 4295 of file target.c.

REFCNT target_thread_free ( struct target_thread tthread,
int  force 
)

Definition at line 4168 of file target.c.

void target_thread_gkv_destroy ( struct target target,
struct target_thread tthread 
)

Definition at line 1606 of file target.c.

int target_thread_gkv_insert ( struct target target,
tid_t  tid,
char *  key,
void *  value,
target_thread_gkv_dtor_t  dtor 
)

Definition at line 1507 of file target.c.

void* target_thread_gkv_lookup ( struct target target,
tid_t  tid,
char *  key 
)

Definition at line 1535 of file target.c.

void target_thread_gkv_remove ( struct target target,
tid_t  tid,
char *  key 
)

Definition at line 1580 of file target.c.

void* target_thread_gkv_steal ( struct target target,
tid_t  tid,
char *  key 
)

Definition at line 1554 of file target.c.

int target_thread_obj_flags_propagate ( struct target_thread tthread,
obj_flags_t  orf,
obj_flags_t  nandf 
)

Definition at line 4159 of file target.c.

void target_thread_set_status ( struct target_thread tthread,
thread_status_t  status 
)

Definition at line 4041 of file target.c.

void target_tid_set_status ( struct target target,
tid_t  tid,
thread_status_t  status 
)

Definition at line 4049 of file target.c.

struct value* value_create ( struct target_thread thread,
struct memrange range,
struct lsymbol lsymbol,
struct symbol type 
)

Definition at line 138 of file value.c.

struct value* value_create_noalloc ( struct target_thread thread,
struct memrange range,
struct lsymbol lsymbol,
struct symbol type 
)

Definition at line 153 of file value.c.

struct value* value_create_raw ( struct target target,
struct target_thread thread,
struct memrange range,
int  len 
)

Value loading functions.

Definition at line 77 of file value.c.

struct value* value_create_type ( struct target_thread thread,
struct memrange range,
struct symbol type 
)

Definition at line 102 of file value.c.

int value_set_addr ( struct value value,
ADDR  addr 
)

Definition at line 28 of file value.c.

int value_set_child ( struct value value,
struct value parent_value,
ADDR  addr 
)

Definition at line 53 of file value.c.

void value_set_const ( struct value value)

Definition at line 73 of file value.c.

int value_set_mmap ( struct value value,
ADDR  addr,
struct memcache_mmap_entry mme,
char *  offset_ptr 
)

Definition at line 35 of file value.c.

int value_set_reg ( struct value value,
REG  reg 
)

Definition at line 45 of file value.c.

void value_set_strlen ( struct value value,
int  len 
)

Definition at line 68 of file value.c.

Variable Documentation

struct location_ops target_location_ops

Location resolution.

Definition at line 310 of file location.c.