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 | Functions | Variables
target.c File Reference
#include "config.h"
#include <errno.h>
#include <assert.h>
#include <glib.h>
#include <dlfcn.h>
#include <signal.h>
#include "glib_wrapper.h"
#include "arch.h"
#include "regcache.h"
#include "rfilter.h"
#include "binfile.h"
#include "dwdebug.h"
#include "dwdebug_priv.h"
#include "target_api.h"
#include "target.h"
#include "probe.h"
#include "target_linux_userproc.h"
#include "target_os_process.h"
#include "target_php.h"
#include "target_gdb.h"
Include dependency graph for target.c:

Go to the source code of this file.

Data Structures

struct  target_gkv_info
 
struct  target_thread_gkv_info
 
struct  code_cache_entry
 

Macros

#define TARGET_ARGP_BASE   0x333331
 
#define TARGET_ARGP_OVERLAY   0x333332
 
#define TARGET_ARGP_PERSONALITY   0x333333
 
#define TARGET_ARGP_PERSONALITY_LIB   0x333334
 
#define TARGET_ARGP_START_PAUSED   0x333335
 
#define __XEN_ARGP_TYPE
 
#define TARGET_ARGP_CORE_OPTS
 
#define CODE_CACHE_BUF_PAD   5
 
#define TARGET_UNW_CONSECUTIVE_IPADDR_LIMIT   8
 
#define __SWC   64
 
#define TARGET_REGCACHE_ALLOC(tctxt, errretval)
 
#define TARGET_REGCACHE_ALLOC_NT(tctxt, errretval)
 
#define TARGET_REGCACHE_GET(tctxt, errretval)
 

Functions

void os_linux_generic_register (void)
 
void os_linux_generic_decoder_lib_register (void)
 
void target_init (void)
 
void target_fini (void)
 
void target_default_cleanup ()
 
void target_default_sighandler (int signo, siginfo_t *siginfo, void *x)
 
int target_monitor_was_interrupted (siginfo_t *last_siginfo)
 
void target_monitor_clear_global_interrupt (void)
 
int target_install_default_sighandlers (void(*sighandler)(int signo, siginfo_t *siginfo, void *x))
 
int target_install_custom_sighandlers (sigset_t *ignored, sigset_t *interrupt, sigset_t *exit, void(*sighandler)(int signo, siginfo_t *siginfo, void *x))
 
int target_monitor_handling_exception (struct target *target)
 
void target_monitor_schedule_global_interrupt (void)
 
int target_monitor_schedule_interrupt (struct target *target)
 
struct targettarget_lookup_target_id (int id)
 
error_t target_argp_parse_opt (int key, char *arg, struct argp_state *state)
 
int target_spec_to_argv (struct target_spec *spec, char *arg0, int *argc, char ***argv)
 
struct target_spectarget_argp_target_spec (struct argp_state *state)
 
void * target_argp_driver_state (struct argp_state *state)
 
struct target_spectarget_argp_driver_parse_one (struct argp *driver_parser, void *driver_state, int argc, char **argv, target_type_t target_types, int filter_quoted)
 
int target_argp_driver_parse (struct argp *driver_parser, void *driver_state, int argc, char **argv, target_type_t target_types, int filter_quoted, struct target_spec **primary_target_spec, GList **base_target_specs, GList **overlay_target_specs)
 
void target_driver_argp_init_children (struct argp_state *state)
 
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)
 
REFCNT target_free (struct target *target, int force)
 
struct target_opstarget_get_ops (target_type_t target_type)
 
struct targettarget_create (char *type, struct target_spec *spec)
 
int target_finalize (struct target *target)
 
int target_associate_debugfile (struct target *target, struct memregion *region, struct debugfile *debugfile)
 
struct debugfiletarget_lookup_debugfile (struct target *target, ADDR addr)
 
struct scopetarget_lookup_addr (struct target *target, uint64_t addr)
 
struct bsymboltarget_lookup_sym_addr (struct target *target, ADDR addr)
 
int target_lookup_sym_addr_alt (struct target *target, ADDR addr, struct bsymbol **primary, struct bsymbol **alt)
 
struct bsymboltarget_lookup_sym (struct target *target, const char *name, const char *delim, char *srcfile, symbol_type_flag_t ftype)
 
struct bsymboltarget_lookup_sym_member (struct target *target, struct bsymbol *bsymbol, const char *name, const char *delim)
 
struct bsymboltarget_lookup_sym_line (struct target *target, char *filename, int line, SMOFFSET *offset, ADDR *addr)
 
int target_lookup_line_addr (struct target *target, char *srcfile, ADDR addr)
 
int target_lookup_filename_line_addr (struct target *target, ADDR addr, char **filename, int *line)
 
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_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)
 
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_bsymbol_resolve_base (struct target *target, struct target_location_ctxt *tlctxt, struct bsymbol *bsymbol, ADDR *o_addr, struct memrange **o_range)
 
struct valuetarget_load_type (struct target *target, struct symbol *type, ADDR addr, load_flags_t flags)
 
struct valuetarget_load_type_regval (struct target *target, struct symbol *type, tid_t tid, REG reg, REGVAL regval, load_flags_t flags)
 
struct valuetarget_load_type_reg (struct target *target, struct symbol *type, tid_t tid, REG reg, load_flags_t flags)
 
struct valuetarget_load_symbol_member (struct target *target, struct target_location_ctxt *tlctxt, struct bsymbol *bsymbol, const char *member, const char *delim, load_flags_t flags)
 
struct valuetarget_load_value_member (struct target *target, struct target_location_ctxt *tlctxt, struct value *old_value, const char *member, const char *delim, load_flags_t flags)
 
struct valuetarget_load_symbol (struct target *target, struct target_location_ctxt *tlctxt, struct bsymbol *bsymbol, load_flags_t flags)
 
OFFSET target_offsetof_symbol (struct target *target, struct bsymbol *bsymbol, char *member, const char *delim)
 
ADDR target_addressof_symbol (struct target *target, struct target_location_ctxt *tlctxt, struct bsymbol *bsymbol, load_flags_t flags, struct memrange **o_range)
 
int target_store_value (struct target *target, struct value *value)
 
int target_find_memory_real (struct target *target, ADDR addr, struct addrspace **space_saveptr, struct memregion **region_saveptr, struct memrange **range_saveptr)
 
int target_contains_real (struct target *target, ADDR addr)
 
ADDR target_load_pointers (struct target *target, ADDR addr, int count, struct memrange **range_saveptr)
 
ADDR target_autoload_pointers (struct target *target, struct symbol *datatype, ADDR addr, load_flags_t flags, struct symbol **datatype_saveptr, struct memrange **range_saveptr)
 
struct valuetarget_load_addr_obj (struct target *target, struct memregion *region, ADDR obj_addr, load_flags_t flags, int len)
 
struct valuetarget_load_addr_real (struct target *target, ADDR addr, load_flags_t flags, int len)
 
unsigned char * target_load_raw_addr_real (struct target *target, ADDR addr, load_flags_t flags, unsigned char *buf, int bufsiz)
 
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_lookup_safe_disasm_range (struct target *target, ADDR addr, ADDR *start, ADDR *end, void **data)
 
int target_lookup_next_safe_disasm_range (struct target *target, ADDR addr, ADDR *start, ADDR *end, void **data)
 
unsigned char * target_load_code (struct target *target, ADDR start, unsigned int len, int nocache, int force_copy, int *caller_free)
 
struct target_threadtarget_lookup_thread (struct target *target, tid_t tid)
 
target_status_t target_get_status (struct target *target)
 
void target_set_status (struct target *target, target_status_t status)
 
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 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_thread_filter_check (struct target *target, tid_t tid, struct target_nv_filter *tf)
 
int target_invalidate_thread (struct target *target, struct target_thread *tthread)
 
int target_invalidate_all_threads (struct target *target)
 
target_status_t target_notify_overlay (struct target *overlay, target_exception_flags_t flags, tid_t tid, ADDR ipval, int *again)
 
struct targettarget_lookup_overlay (struct target *target, tid_t tid)
 
void target_detach_overlay (struct target *base, tid_t overlaytid)
 
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)
 
int target_attach_space (struct target *target, struct addrspace *space)
 
int target_detach_space (struct target *target, struct addrspace *space)
 
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)
 
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)
 
unsigned long target_memmod_length (struct target *target, struct target_memmod *mmod)
 
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)
 
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)
 
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)
 
struct target_location_ctxttarget_global_tlctxt (struct target *target)
 
struct target_location_ctxttarget_location_ctxt_create (struct target *target, tid_t tid, struct memregion *region)
 
struct target_location_ctxttarget_location_ctxt_create_from_bsymbol (struct target *target, tid_t tid, struct bsymbol *bsymbol)
 
void target_location_ctxt_retarget_bsymbol (struct target_location_ctxt *tlctxt, struct bsymbol *bsymbol)
 
void target_location_ctxt_free (struct target_location_ctxt *tlctxt)
 
struct target_location_ctxttarget_unwind (struct target *target, tid_t tid)
 
int target_location_ctxt_unwind (struct target_location_ctxt *tlctxt)
 
int target_unwind_snprintf (char *buf, int buflen, struct target *target, tid_t tid, target_unwind_style_t fstyle, char *frame_sep, char *ksep)
 
struct target_location_ctxt_frametarget_location_ctxt_get_frame (struct target_location_ctxt *tlctxt, int frame)
 
struct target_location_ctxt_frametarget_location_ctxt_current_frame (struct target_location_ctxt *tlctxt)
 
int target_location_ctxt_read_reg (struct target_location_ctxt *tlctxt, REG reg, REGVAL *o_regval)
 
struct target_location_ctxt_frametarget_location_ctxt_prev (struct target_location_ctxt *tlctxt)
 
int target_personality_load (char *filename)
 
int target_personality_register (char *personality, target_personality_t pt, struct target_personality_ops *ptops, void *pops)
 
int target_personality_attach (struct target *target, char *personality, char *personality_lib)
 
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)
 
int target_decoder_binding_add (struct target_decoder_binding *tdb, struct bsymbol *bsymbol, target_decoder_t dfn)
 
int target_decoder_lookup (struct target *target, struct value *value, target_decoder_t *decoder, void **decoder_data)
 
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)
 
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)
 
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)
 
GHashTable * target_regcache_copy_registers (struct target *target, tid_t tid)
 
GHashTable * target_regcache_copy_registers_tidctxt (struct target *target, tid_t tid, thread_ctxt_t tidctxt)
 
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)
 

Variables

struct argp_option target_argp_opts []
 
struct argp_option target_argp_opts_only_one []
 
struct argp linux_userproc_argp
 
char * linux_userproc_argp_header
 
char * TSTATUS_STRINGS []
 
char * THREAD_STATUS_STRINGS []
 
char * POLL_STRINGS []
 
char * REGION_TYPE_STRINGS []
 

Macro Definition Documentation

#define __SWC   64
#define __XEN_ARGP_TYPE

Definition at line 371 of file target.c.

#define CODE_CACHE_BUF_PAD   5

Definition at line 3900 of file target.c.

#define TARGET_ARGP_BASE   0x333331

Definition at line 362 of file target.c.

#define TARGET_ARGP_CORE_OPTS
Value:
{ "debug",'d',"LEVEL",0,"Set/increase the debugging level.",-3 }, \
{ "log-flags",'l',"FLAG,FLAG,...",0,"Set the debugging flags",-3 }, \
{ "warn",'w',"LEVEL",0,"Set/increase the warning level.",-3 }, \
{ "target-type",'t',"TYPENAME",0, \
"Forcibly set the target type (ptrace" __XEN_ARGP_TYPE ",gdb,os-process,php).",-3 }, \
{ "personality",TARGET_ARGP_PERSONALITY,"PERSONALITY",0, \
"Forcibly set the target personality (linux,process,php).",-3 }, \
{ "personality-lib",TARGET_ARGP_PERSONALITY_LIB,"PERSONALITY_LIB_FILENAME",0, \
"Specify a shared library where the personality specified by --personality should be loaded from.",-3 }, \
{ "start-paused",TARGET_ARGP_START_PAUSED,0,0,"Leave target paused after launch.",-3 }, \
{ "stay-paused",'P',0,0,"Keep target paused at detach.",-3 }, \
{ "soft-breakpoints",'s',0,0,"Force software breakpoints.",-3 }, \
{ "debugfile-load-opts",'F',"LOAD-OPTS",0,"Add a set of debugfile load options.",-3 }, \
{ "breakpoint-mode",'L',"STRICT-LEVEL",0,"Set/increase the breakpoint mode level.",-3 }, \
{ "target-id",'i',"ID",0,"Specify a numeric ID for the target.",0 }, \
{ "in-file",'I',"FILE",0,"Deliver contents of FILE to target on stdin (if avail).",-4 }, \
{ "out-file",'O',"FILE",0,"Log stdout (if avail) to FILE.",-4 }, \
{ "err-file",'E',"FILE",0,"Log stderr (if avail) to FILE.",-4 }, \
{ "kill-on-close",'k',NULL,0,"Destroy target on close (SIGKILL).",-4 }, \
{ "debugfile-root-prefix",'R',"DIR",0, \
"Set an alternate root prefix for debuginfo and binfile resolution.",0 }, \
{ "active-probing",'a',"FLAG,FLAG,...",0, \
"A list of active probing flags to enable (disabled by default)" \
" (thread_entry thread_exit memory other)",0 }, \
{ "read-only",'r',0,0, \
"Never write to the target (disables breakpoints; can only read)",0 }
#define TARGET_ARGP_PERSONALITY_LIB
Definition: target.c:365
#define TARGET_ARGP_PERSONALITY
Definition: target.c:364
#define TARGET_ARGP_START_PAUSED
Definition: target.c:366
#define __XEN_ARGP_TYPE
Definition: target.c:371

Definition at line 374 of file target.c.

#define TARGET_ARGP_OVERLAY   0x333332

Definition at line 363 of file target.c.

#define TARGET_ARGP_PERSONALITY   0x333333

Definition at line 364 of file target.c.

#define TARGET_ARGP_PERSONALITY_LIB   0x333334

Definition at line 365 of file target.c.

#define TARGET_ARGP_START_PAUSED   0x333335

Definition at line 366 of file target.c.

#define TARGET_REGCACHE_ALLOC (   tctxt,
  errretval 
)
Value:
do { \
if (tctxt > target->max_thread_ctxt) { \
verror("target %d only has max thread ctxt %d (%d specified)!\n", \
errno = EINVAL; \
return errretval; \
} \
tthread = target_load_thread(target,tid,0); \
if (!tthread) { \
verror("target %d could not load thread %d!\n",target->id,tid); \
errno = ESRCH; \
return (errretval); \
} \
if (!tthread->regcaches[tctxt]) { \
tthread->regcaches[tctxt] = regcache_create(target->arch); \
} \
regcache = tthread->regcaches[tctxt]; \
} while(0)
#define verror(format,...)
Definition: log.h:30
struct target_thread * target_load_thread(struct target *target, tid_t tid, int force)
Definition: target_api.c:1311
struct arch * arch
Definition: target_api.h:2603
int id
Definition: target_api.h:2514
struct regcache * regcache_create(struct arch *arch)
Definition: regcache.c:29
unsigned int max_thread_ctxt
Definition: target_api.h:2505

Register helpers, for the cases where the target is using our regcache support.

Definition at line 6393 of file target.c.

#define TARGET_REGCACHE_ALLOC_NT (   tctxt,
  errretval 
)
Value:
do { \
if (tctxt > target->max_thread_ctxt) { \
verror("target %d only has max thread ctxt %d (%d specified)!\n", \
errno = EINVAL; \
return errretval; \
} \
if (!tthread->regcaches[tctxt]) { \
tthread->regcaches[tctxt] = regcache_create(target->arch); \
} \
regcache = tthread->regcaches[tctxt]; \
} while(0)
#define verror(format,...)
Definition: log.h:30
struct arch * arch
Definition: target_api.h:2603
int id
Definition: target_api.h:2514
struct regcache * regcache_create(struct arch *arch)
Definition: regcache.c:29
unsigned int max_thread_ctxt
Definition: target_api.h:2505

Definition at line 6413 of file target.c.

#define TARGET_REGCACHE_GET (   tctxt,
  errretval 
)
Value:
do { \
if (tctxt > target->max_thread_ctxt) { \
verror("target %d only has max thread ctxt %d (%d specified)!\n", \
errno = EINVAL; \
return errretval; \
} \
tthread = target_load_thread(target,tid,0); \
if (!tthread) { \
verror("target %d could not load thread %d!\n",target->id,tid); \
errno = ESRCH; \
return (errretval); \
} \
if (!tthread->regcaches[tctxt]) { \
verror("target %d could not load thread %d!\n",target->id,tid); \
errno = EADDRNOTAVAIL; \
return (errretval); \
} \
regcache = tthread->regcaches[tctxt]; \
} while(0)
#define verror(format,...)
Definition: log.h:30
struct target_thread * target_load_thread(struct target *target, tid_t tid, int force)
Definition: target_api.c:1311
int id
Definition: target_api.h:2514
unsigned int max_thread_ctxt
Definition: target_api.h:2505

Definition at line 6427 of file target.c.

#define TARGET_UNW_CONSECUTIVE_IPADDR_LIMIT   8

Definition at line 5480 of file target.c.

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.

void os_linux_generic_decoder_lib_register ( void  )

Definition at line 593 of file target_os_linux_generic_decoders.c.

void os_linux_generic_register ( void  )

Globals.

Definition at line 9476 of file target_os_linux_generic.c.

ADDR target_addressof_symbol ( struct target target,
struct target_location_ctxt tlctxt,
struct bsymbol bsymbol,
load_flags_t  flags,
struct memrange **  range_saveptr 
)

Load functions. Everything that gets loaded is loaded as a value struct.

Each load function can handle a bsymbol that contains a nested symbol chain. Members may nest in either 1) functions, or 2) struct/unions. Obviously, once you are in a struct/union, the only members of those can be variables. Thus, all functions must come first in the chain. So, here are some examples of nested symbols that can be followed by these functions: function.subfunc.param1, function.local, function.localstructinst.x, structinst.x.y.z, structinst->x.y.z, structinst->x->y->z Now, since we support automatic pointer dereferencing, you don't have to worry about actually using -> or .; you just use . . If the final symbol is itself a pointer to something, if the AUTO_DEREF or AUTO_STRING load flags are set, the pointer will be dereferenced as much as possible before loading. Otherwise, it won't be. The AUTO_DEREF flags do not affect the behavior of intermediate pointer symbols in the chain; those are always autoloaded if possible. If you don't like this intermediate pointer autoloading behavior, don't use it!

Definition at line 3490 of file target.c.

int target_argp_driver_parse ( struct argp *  driver_parser,
void *  driver_state,
int  argc,
char **  argv,
target_type_t  target_types,
int  filter_quoted,
struct target_spec **  primary_target_spec,
GList **  base_target_specs,
GList **  overlay_target_specs 
)

Parses possibly multiple target specification objects by parsing command line arguments provided in the standard argc, argv pair. The caller should be a StackDB program who wants to build a target_spec object containing the details about one or more targets (and perhaps one or more stacks of overlay targets built atop them) to instantiate. This program may also require its own arguments, which it can retrieve and parse after any StackDB-relevant arguments have been extracted (see the User Guide section on standard StackDB arguments).

Parameters
driver_parserA fully-specified GNU argp parser struct (see http://www.gnu.org/software/libc/manual/html_node/Argp.html). May be NULL, if your program doesn't require any arguments.
driver_stateA pointer to an object that will be passed to your driver_parser when driver_parser->parser is invoked. May always be NULL; it's up to you.
argcA count of the arguments in argv; usually is main()'s first argument.
argvAn argument vector; usually is main()'s second argument.
target_typesA mask of allowed target types (drivers) that your program can be applied to.
filter_quotedIf set non-zero, the StackDB argp wrapper will catch any arguments after the "--" characters on the command line, and save them to be processed. The Ptrace driver will process any arguments after "--" and use them to launch a program that StackDB will attach to).
[out]primary_target_specThe primary target_spec. This should be a pointer to a target_spec * that is set to NULL; this function will allocate a target_spec * according to the argv parameter.
[out]base_target_specsA GList * of base target_specs. This should be a pointer to a GList * that is set to NULL. This function will allocate a GList * of target_spec * structs based on any –base '...' argv members. The primary target_spec object is not in this list!
[out]overlay_target_specsA GList * of overlay target_specs. This should be a pointer to a GList * that is set to NULL. This function will allocate a GList * of target_spec * structs based on any –overlay '...' argv members.
Returns
0 on success; non-zero on failure.

Definition at line 913 of file target.c.

struct target_spec* target_argp_driver_parse_one ( struct argp *  driver_parser,
void *  driver_state,
int  argc,
char **  argv,
target_type_t  target_types,
int  filter_quoted 
)

Returns a single target specification object by parsing command line arguments provided in the standard argc, argv pair. The caller should be a StackDB program who wants to build a target_spec object containing the details about a target (and perhaps its overlay targets) to instantiate. This program may also require its own arguments, which it can retrieve and parse after any StackDB-relevant arguments have been extracted (see the User Guide section on standard StackDB arguments).

Parameters
driver_parserA fully-specified GNU argp parser struct (see http://www.gnu.org/software/libc/manual/html_node/Argp.html). May be NULL, if your program doesn't require any arguments.
driver_stateA pointer to an object that will be passed to your driver_parser when driver_parser->parser is invoked. May always be NULL; it's up to you.
argcA count of the arguments in argv; usually is main()'s first argument.
argvAn argument vector; usually is main()'s second argument.
target_typesA mask of allowed target types (drivers) that your program can be applied to.
filter_quotedIf set non-zero, the StackDB argp wrapper will catch any arguments after the "--" characters on the command line, and save them to be processed. The Ptrace driver will process any arguments after "--" and use them to launch a program that StackDB will attach to).
Returns
A target_spec that can be passed to target_instantiate(). Do not free this struct; once passed to target_instantiate(), the returned target object owns it; and it cannot be passed to another call to target_instantiate().

Definition at line 802 of file target.c.

void* target_argp_driver_state ( struct argp_state *  state)

Definition at line 716 of file target.c.

error_t target_argp_parse_opt ( int  key,
char *  arg,
struct argp_state *  state 
)

Target argp parsing stuff. This loosely wraps argp. The idea is that target library users want to write target-backend-independent programs that use the library. So this function helps them automatically instantiate a target from standard options.

The reason we can't use exactly the argp style is because 1) child parsers cannot see arguments (and the Ptrace parser will eat quoted arguments (i.e., those following '–') if possible, so we want to make this work); 2) and because the top-level target argp parser will optionally only include the target backend argp children according to user choice (i.e., a program might only support ptrace, not xen) – and we have to keep track of that state.

For these reasons, it ends up making more sense to use the driver program's argp parser as the top-level parser, and glue on our target argp child parsers – but then to pass all parsers a struct target_driver_argp_parser_state as the input. Clients can retrieve their state via target_driver_argp_state().

Definition at line 1061 of file target.c.

struct target_spec* target_argp_target_spec ( struct argp_state *  state)

Definition at line 709 of file target.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.

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.

ADDR target_autoload_pointers ( struct target target,
struct symbol datatype,
ADDR  addr,
load_flags_t  flags,
struct symbol **  datatype_saveptr,
struct memrange **  range_saveptr 
)

Definition at line 3668 of file target.c.

int target_bsymbol_resolve_base ( struct target target,
struct target_location_ctxt tlctxt,
struct bsymbol bsymbol,
ADDR o_addr,
struct memrange **  o_range 
)

Definition at line 2618 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.

int target_contains_real ( struct target target,
ADDR  addr 
)

Address/memory range functions.

Definition at line 3602 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.

int target_decoder_binding_add ( struct target_decoder_binding tdb,
struct bsymbol bsymbol,
target_decoder_t  dfn 
)

Definition at line 6338 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)

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_decoder_lookup ( struct target target,
struct value value,
target_decoder_t decoder,
void **  decoder_data 
)

Definition at line 6350 of file target.c.

void target_default_cleanup ( void  )

A function that pauses, closes, and finalizes all targets the target library knows of. If any of the target objects was handling an exception, it schedules an interrupt for that target — and the user (the caller of target_monitor() or target_monitor_evloop() must call target_default_cleanup() if the returned target status is TSTATUS_INTERRUPTED. The user must also identify if the signal was a fatal signal, or a simple interruption; this is up to the user.

Definition at line 128 of file target.c.

void target_default_sighandler ( int  signo,
siginfo_t *  siginfo,
void *  x 
)

The default signal handler for the target library. Saves off the signal information into a global variable (accessible via target_monitor_was_interrupted()); calls the user sighandler if specified; pauses all target objects if the signal was supposed to result in an interrupt of the target_monitor_evloop() function (and pauses them safely by employing target_monitor_schedule_interrupt() on any target that is currently handling an exception); OR calls the target_default_cleanup() function if the signal is fatal.

Definition at line 174 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  overlaytid 
)

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.

void target_driver_argp_init_children ( struct argp_state *  state)

Definition at line 1057 of file target.c.

int target_finalize ( struct target target)

Finalizes a target. This means the library drops its internal reference to the target — and thus, the user did not call target_hold() after target_open(), this will also have the effect of freeing the target struct – because the target library will remove the target struct from its internal structs, and drop a ref. Unless some other caller had held a ref to it for some other reason, this will deallocate it. Thus – if you want to hold onto the struct for subsequent calls, hold onto it first!

NB: the library will never drop its ref to the target struct object unless the user calls target_finalize() – or target_fini(). It may detach (on your behalf) from an exiting target, but that does not perform the work of target_finalize() by itself – you still get to do that so you can handle the exiting/exited target.

Definition at line 1955 of file target.c.

int target_find_memory_real ( struct target target,
ADDR  addr,
struct addrspace **  space_saveptr,
struct memregion **  region_saveptr,
struct memrange **  range_saveptr 
)

Definition at line 3578 of file target.c.

void target_fini ( void  )

This function should be called by the StackDB user when the user is done using StackDB, or when their program is about to exit. It cleans up global StackDB state. One way to do this is to to schedule it to be called via atexit(3) — although note that will not work in the case where the program is terminated by signal delivery.

target_fini() can safely be called at any point in your program, except from within a probe or action handler! It will result in any active, open target objects being closed and freed. After calling this function, you cannot use any other StackDB library target_* functions until you call target_init() again.

Definition at line 91 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.

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.

struct target_location_ctxt* target_global_tlctxt ( struct target target)

Target location contexts (unwinding, symbol loading/address resolution).

We use a target_location_ctxt struct that wraps location_ctxt in dwdebug. Thus, you can lookup/load symbols in the current thread, or in an unwind context. You must supply a context, however – loading symbols is meaningless if you don't have a thread context and a memory context binding the symbol to an execution context.

A context keeps a notion of current frame, which it shares with its underlying location_ctxt (i.e., with the dwdebug library). This enables these two libraries to unwind cooperatively (dwdebug handles location resolution/computation and saved register resolution/computation; target caches restored registers and keeps a stack of frames and their metadata).

Definition at line 5299 of file target.c.

void target_init ( void  )

This file describes the publicly-accessible target API. The target library is really a library of debug routines that supports multiple backends. It is built atop the dwdebug library, which is a library for parsing DWARF debug information. It provides two backends: a Linux ptrace userspace backend, and a Xen virtual machine (assumes a Linux guest) backend. Both backends are x86-only at the moment. The linux ptrace backend supports 32/64-bit targets, but not 32-bit emulated atop 64-bit host. The Xen VM/Linux guest backend supports 32-bit Xen/guest; it has partial, nonfunctional support for 64-bit-ness. Right now, the backend code does not separate the logic for dealing with a target in an architecture-independent way – the arch stuff is jammed in with the target code. This should not be this way; eventually, hopefully, it will change into a target backend that supports different arch/machine ops. Also, there are probably some x86-isms that have leaked into the "generic" target and probe code :(.

The target library supports two modes of dealing with threads inside a target. Some targets provide control over executing threads (i.e., can the library pause random threads at will, or not); the Linux ptrace target of course supports this; the Xen VM target does not (it could mostly support "pausing" all non-current threads in a single CPU guest, BUT even this requires that the debug lib handle NMIs, asynch interrupts, and some synchronous exceptions – overloading the kernel's IDT – but right now we don't do this).

Targets that do not provide control over thread scheduling must still provide thread identification. This is important for shared (i.e., memory-based) breakpoints, which any thread could hit at any time – not just the thread the user is interested in. Our handling of such breakpoints must be context-aware, so that we maintain handling information on a per-thread basis.

So the library supports two kinds of targets: ones that provide thread control (ptrace), and ones that provide thread awareness (Xen).

The intent is that the target library provides a library above the dwdebug library, so you should never (or rarely) have to call into dwdebug to deal with symbol information. The reason for this attempted restriction is as follows. First, an in-memory representation of DWARF debug data that facilitates fast lookups is big. So, we want to share it between targets (or between all target library users) as much as possible (possible when targets use the same debuginfo, or a subset thereof). Second, memory locations are, naturally, virtual addresses in debuginfo. For the statically-linked core of an executable, there is no difference between virtual/physical; the core is mmap'd at the static addresses. But shared objects/libs may be mmap'd anywhere in the address space, so we have to translate. Rather than smacking the details of physical translation into the debuginfo data structures, for each target instance, we build this translation into the target library. This is perhaps annoying, but facilitates better sharing.

The target library is described via the API functions listed below. To build a new target backend, you must implement the target_ops operations; see the documentation for struct target_ops below.

For information on how to probe a target, see probe_api.h . This function must be called by StackDB user before using any library functions.

Definition at line 69 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_install_custom_sighandlers ( sigset_t *  ignored,
sigset_t *  interrupt,
sigset_t *  exit,
void(*)(int signo, siginfo_t *siginfo, void *x)  sighandler 
)

Install the library's default signal handler, but customize which signals it is set for!

Parameters
ignoredA pointer to a sigset_t (see man 3 sigset) of signals to be ignored.
interruptA pointer to a sigset_t of signals to cause target_monitor or target_monitor_evloop to be interrupted so that you can handle a signal synchronously with respect to target exception handling (i.e., safely!).
exitA pointer to a sigset_t of signals that will cause your program to be exit. Remember, if one of your targets is being handled when the handler is invoked, the library cannot free that target — and you must call target_default_cleanup() again yourself to finish the cleanup!
sighandlerA signal handler function in your program (see man sigaction) that will be called by the target library's default signal handler. This function is called immediately after the handler saves off the siginfo into a global variable for later retrieval by your program, to give you notice that the target library is about to handle a signal for you. Usually, the only thing that your handler should do is clean up any state that the default handler is unaware of (i.e., remove any probes you placed on targets). Note that when your handler is called, the default handler has not yet paused all targets — so if you are going to modify any targets, you must pause them first.
Returns
Returns nonzero on failure; 0 on success.

Definition at line 270 of file target.c.

int target_install_default_sighandlers ( void(*)(int signo, siginfo_t *siginfo, void *x)  sighandler)

Install some default signal handlers for the target library. It is very important to handle signals that would be fatal, because you must remove any probes placed on any targets — otherwise those programs will very likely crash when they hit the probes — because nothing is attached to them any longer.

This function installs the target_default_sighandler() on the following signals: SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGABRT, SIGFPE, SIGSEGV, SIGPIPE, SIGTERM, SIGBUS, SIGXCPU, and SIGXFSZ. It sets up SIGUSR1, SIGUSR2, and SIGALRM to be ignored. If you want to change those signal sets, see target_install_custom_sighandlers().

Parameters
sighandlerA signal handler function in your program (see man sigaction) that will be called by the target library's default signal handler. This function is called immediately after the handler saves off the siginfo into a global variable for later retrieval by your program, to give you notice that the target library is about to handle a signal for you. Usually, the only thing that your handler should do is clean up any state that the default handler is unaware of (i.e., remove any probes you placed on targets). Note that when your handler is called, the default handler has not yet paused all targets — so if you are going to modify any targets, you must pause them first.
Returns
Returns nonzero on failure; 0 on success.

Definition at line 240 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.

struct value* target_load_addr_obj ( struct target target,
struct memregion region,
ADDR  obj_addr,
load_flags_t  flags,
int  len 
)

Definition at line 3742 of file target.c.

struct value* target_load_addr_real ( struct target target,
ADDR  addr,
load_flags_t  flags,
int  len 
)

Definition at line 3758 of file target.c.

unsigned char* target_load_code ( struct target target,
ADDR  start,
unsigned int  len,
int  nocache,
int  force_copy,
int *  caller_free 
)

Definition at line 3909 of file target.c.

ADDR target_load_pointers ( struct target target,
ADDR  addr,
int  count,
struct memrange **  range_saveptr 
)

Definition at line 3617 of file target.c.

unsigned char* target_load_raw_addr_real ( struct target target,
ADDR  addr,
load_flags_t  flags,
unsigned char *  buf,
int  bufsiz 
)

Definition at line 3786 of file target.c.

struct value* target_load_symbol ( struct target target,
struct target_location_ctxt tlctxt,
struct bsymbol bsymbol,
load_flags_t  flags 
)

Definition at line 3270 of file target.c.

struct value* target_load_symbol_member ( struct target target,
struct target_location_ctxt tlctxt,
struct bsymbol bsymbol,
const char *  member,
const char *  delim,
load_flags_t  flags 
)

Definition at line 2920 of file target.c.

struct value* target_load_type ( struct target target,
struct symbol type,
ADDR  addr,
load_flags_t  flags 
)

Definition at line 2653 of file target.c.

struct value* target_load_type_reg ( struct target target,
struct symbol type,
tid_t  tid,
REG  reg,
load_flags_t  flags 
)

Definition at line 2910 of file target.c.

struct value* target_load_type_regval ( struct target target,
struct symbol type,
tid_t  tid,
REG  reg,
REGVAL  regval,
load_flags_t  flags 
)

Definition at line 2762 of file target.c.

struct value* target_load_value_member ( struct target target,
struct target_location_ctxt tlctxt,
struct value old_value,
const char *  member,
const char *  delim,
load_flags_t  flags 
)

Definition at line 2942 of file target.c.

struct target_location_ctxt* target_location_ctxt_create ( struct target target,
tid_t  tid,
struct memregion region 
)

Definition at line 5304 of file target.c.

struct target_location_ctxt* target_location_ctxt_create_from_bsymbol ( struct target target,
tid_t  tid,
struct bsymbol bsymbol 
)

Definition at line 5325 of file target.c.

struct target_location_ctxt_frame* target_location_ctxt_current_frame ( struct target_location_ctxt tlctxt)

Definition at line 5748 of file target.c.

void target_location_ctxt_free ( struct target_location_ctxt tlctxt)

Definition at line 5348 of file target.c.

struct target_location_ctxt_frame* target_location_ctxt_get_frame ( struct target_location_ctxt tlctxt,
int  frame 
)

Definition at line 5742 of file target.c.

struct target_location_ctxt_frame* target_location_ctxt_prev ( struct target_location_ctxt tlctxt)

Definition at line 5812 of file target.c.

int target_location_ctxt_read_reg ( struct target_location_ctxt tlctxt,
REG  reg,
REGVAL o_regval 
)

Definition at line 5756 of file target.c.

void target_location_ctxt_retarget_bsymbol ( struct target_location_ctxt tlctxt,
struct bsymbol bsymbol 
)

Definition at line 5343 of file target.c.

int target_location_ctxt_unwind ( struct target_location_ctxt tlctxt)

Definition at line 5417 of file target.c.

struct scope* target_lookup_addr ( struct target target,
uint64_t  addr 
)

Lookup functions.

Definition at line 2053 of file target.c.

struct debugfile* target_lookup_debugfile ( struct target target,
ADDR  addr 
)

Definition at line 2020 of file target.c.

int target_lookup_filename_line_addr ( struct target target,
ADDR  addr,
char **  filename,
int *  line 
)

Definition at line 2359 of file target.c.

int target_lookup_line_addr ( struct target target,
char *  srcfile,
ADDR  addr 
)

Definition at line 2320 of file target.c.

int target_lookup_next_safe_disasm_range ( struct target target,
ADDR  addr,
ADDR start,
ADDR end,
void **  data 
)

Definition at line 3860 of file target.c.

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.

int target_lookup_safe_disasm_range ( struct target target,
ADDR  addr,
ADDR start,
ADDR end,
void **  data 
)

Functions to deal with "widest range" lookup, text code loading and caching, and safe disassembly. We want to be sure we always start disassembly at a safe place in the text bytes we load – not wherever the library use requests (which might be in some weird place). Plus, we want to cache well-defined chunks of code to avoid fragmentation in the cache.

Definition at line 3825 of file target.c.

struct bsymbol* target_lookup_sym ( struct target target,
const char *  name,
const char *  delim,
char *  srcfile,
symbol_type_flag_t  ftype 
)

Definition at line 2199 of file target.c.

struct bsymbol* target_lookup_sym_addr ( struct target target,
ADDR  addr 
)

Definition at line 2093 of file target.c.

int target_lookup_sym_addr_alt ( struct target target,
ADDR  addr,
struct bsymbol **  primary,
struct bsymbol **  alt 
)

Definition at line 2135 of file target.c.

struct bsymbol* target_lookup_sym_line ( struct target target,
char *  filename,
int  line,
SMOFFSET offset,
ADDR addr 
)

Definition at line 2267 of file target.c.

struct bsymbol* target_lookup_sym_member ( struct target target,
struct bsymbol bsymbol,
const char *  name,
const char *  delim 
)

Definition at line 2248 of file target.c.

struct target* target_lookup_target_id ( int  id)

Definition at line 332 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_monitor_clear_global_interrupt ( void  )

Clears the global target_monitor interrupt flag.

Definition at line 235 of file target.c.

int target_monitor_handling_exception ( struct target target)

This function is useful only when using target_monitor() and employing your own custom signal handling. It may be useful to call it from your signal handler to see if the target you are monitoring is handling an exception. If it is handling an exception, it is unsafe to call any target_*() operations on it — for instance, you cannot attempt to remove a probe. In this case, the best thing to do is call target_monitor_schedule_interrupt(target), and wait for target_monitor() to return with a status of TSTATUS_INTERRUPTED. So, part of your signal handler might look like this:

if (target_monitor_handling_exception(t)) { needtodosomething = 1; target_monitor_schedule_interrupt(t); } else { target_pause(t); cleanup(); }

Returns
Returns 1 if the target object specified is in the middle of handling an exception; 0 if not.

Definition at line 317 of file target.c.

void target_monitor_schedule_global_interrupt ( void  )

Sets the global target_monitor_interrupt flag.

Definition at line 321 of file target.c.

int target_monitor_schedule_interrupt ( struct target target)

Schedules an an interrupt to happen after target_monitor() finishes handling the current exception, if any. See target_monitor_handling_exception().

Definition at line 325 of file target.c.

int target_monitor_was_interrupted ( siginfo_t *  last_siginfo)
Returns
Returns 1 (and sets last_siginfo to the siginfo of the last signal) if the last iteration of the monitor was interrupted; 0 otherwise.

Definition at line 226 of file target.c.

target_status_t target_notify_overlay ( struct target overlay,
target_exception_flags_t  flags,
tid_t  tid,
ADDR  ipval,
int *  again 
)

Definition at line 4491 of file target.c.

OFFSET target_offsetof_symbol ( struct target target,
struct bsymbol bsymbol,
char *  member,
const char *  delim 
)

Definition at line 3485 of file target.c.

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

Definition at line 6062 of file target.c.

int target_personality_load ( char *  filename)

Personality stuff.

Definition at line 6014 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.

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_spec_to_argv ( struct target_spec spec,
char *  arg0,
int *  argc,
char ***  argv 
)

Definition at line 416 of file target.c.

int target_store_value ( struct target target,
struct value value 
)

The single value store function.

Definition at line 3548 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 target_location_ctxt* target_unwind ( struct target target,
tid_t  tid 
)

Definition at line 5354 of file target.c.

int target_unwind_snprintf ( char *  buf,
int  buflen,
struct target target,
tid_t  tid,
target_unwind_style_t  fstyle,
char *  frame_sep,
char *  ksep 
)

Definition at line 5482 of file target.c.

Variable Documentation

struct argp linux_userproc_argp

Definition at line 485 of file target_linux_userproc.c.

char* linux_userproc_argp_header

Definition at line 488 of file target_linux_userproc.c.

char* POLL_STRINGS[]
Initial value:
= {
"NOTHING",
"ERROR",
"SUCCESS",
"UNKNOWN",
}

Definition at line 6964 of file target.c.

char* REGION_TYPE_STRINGS[]
Initial value:
= {
"unknown","heap","stack","vdso","vsyscall","anon","main","lib",
}

Definition at line 6971 of file target.c.

struct argp_option target_argp_opts[]
Initial value:
= {
{ "base",TARGET_ARGP_BASE,"TARGET_OPTIONS",0,
"Specify an entire base target in a single argument. Any standard target option other than --base and --overlay may be used.",-3 },
{ "overlay",TARGET_ARGP_OVERLAY,"OVERLAY_PREFIX:TARGET_OPTIONS",0,
"Specify an entire overlay target in a single argument. Your argument must be of the form [<base_target_id>:]<thread_name_or_id>:TARGET_OPTIONS",-3 },
{ 0,0,0,0,0,0 }
}
#define TARGET_ARGP_CORE_OPTS
Definition: target.c:374
#define TARGET_ARGP_OVERLAY
Definition: target.c:363
#define TARGET_ARGP_BASE
Definition: target.c:362

Definition at line 402 of file target.c.

struct argp_option target_argp_opts_only_one[]
Initial value:
= {
{ 0,0,0,0,0,0 }
}
#define TARGET_ARGP_CORE_OPTS
Definition: target.c:374

Definition at line 411 of file target.c.

char* THREAD_STATUS_STRINGS[]
Initial value:
= {
"UNKNOWN",
"RUNNING",
"PAUSED",
"ERROR",
"DONE",
"EXITING",
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
"DEAD",
"STOPPED",
"SLEEPING",
"ZOMBIE",
"BLOCKEDIO",
"PAGING",
"RETURNING_USER",
"RETURNING_KERNEL",
}

Definition at line 6945 of file target.c.

char* TSTATUS_STRINGS[]
Initial value:
= {
"UNKNOWN",
"RUNNING",
"PAUSED",
"ERROR",
"DONE",
"EXITING",
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
"DEAD",
"STOPPED",
}

Definition at line 6933 of file target.c.