|
void | os_linux_generic_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 target * | target_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_spec * | target_argp_target_spec (struct argp_state *state) |
|
void * | target_argp_driver_state (struct argp_state *state) |
|
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) |
|
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_ops * | target_get_ops (target_type_t target_type) |
|
struct target * | target_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 debugfile * | target_lookup_debugfile (struct target *target, ADDR addr) |
|
struct scope * | target_lookup_addr (struct target *target, uint64_t addr) |
|
struct bsymbol * | target_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 bsymbol * | target_lookup_sym (struct target *target, const char *name, const char *delim, char *srcfile, symbol_type_flag_t ftype) |
|
struct bsymbol * | target_lookup_sym_member (struct target *target, struct bsymbol *bsymbol, const char *name, const char *delim) |
|
struct bsymbol * | target_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 value * | target_load_type (struct target *target, struct symbol *type, ADDR addr, load_flags_t flags) |
|
struct value * | target_load_type_regval (struct target *target, struct symbol *type, tid_t tid, REG reg, REGVAL regval, load_flags_t flags) |
|
struct value * | target_load_type_reg (struct target *target, struct symbol *type, tid_t tid, REG reg, load_flags_t flags) |
|
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) |
|
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) |
|
struct value * | target_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 value * | target_load_addr_obj (struct target *target, struct memregion *region, ADDR obj_addr, load_flags_t flags, int len) |
|
struct value * | target_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_thread * | target_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_thread * | target_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 target * | target_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 probepoint * | target_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_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) |
|
void | target_memmod_set_writeable (struct target *target, struct target_memmod *mmod, int writeable) |
|
struct target_memmod * | target_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_ctxt * | target_global_tlctxt (struct target *target) |
|
struct target_location_ctxt * | target_location_ctxt_create (struct target *target, tid_t tid, struct memregion *region) |
|
struct target_location_ctxt * | target_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_ctxt * | target_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_frame * | target_location_ctxt_get_frame (struct target_location_ctxt *tlctxt, int frame) |
|
struct target_location_ctxt_frame * | target_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_frame * | target_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_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 regcache * | target_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) |
|
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 67 of file target.c.