Stackdb
Stackdb is a stackable, multi-target and -level source debugger and memory forensics library.
|
#include "config.h"
#include <errno.h>
#include <assert.h>
#include <ctype.h>
#include <unistd.h>
#include <getopt.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <libgen.h>
#include <endian.h>
#include <gelf.h>
#include <elf.h>
#include <libelf.h>
#include <argp.h>
#include "common.h"
#include "glib_wrapper.h"
#include "object.h"
#include "arch.h"
#include "arch_x86.h"
#include "arch_x86_64.h"
#include "evloop.h"
#include "binfile.h"
#include "dwdebug.h"
#include "dwdebug_priv.h"
#include "target_api.h"
#include "target.h"
#include "target_event.h"
#include "target_arch_x86.h"
#include "target_os.h"
#include "probe_api.h"
#include <xenctrl.h>
#include <xs.h>
#include "target_xen_vm.h"
#include "target_xen_vm_vmp.h"
Go to the source code of this file.
Macros | |
#define | UNIX_PATH_MAX (size_t)sizeof(((struct sockaddr_un *) 0)->sun_path) |
#define | RF "x" |
#define | DRF "lx" |
#define | XC_IF_INVALID (-1) |
#define | XV_ARGP_USE_XENACCESS 0x550001 |
#define | XV_ARGP_USE_LIBVMI 0x550002 |
#define | XV_ARGP_CLEAR_MEM_CACHES 0x550003 |
#define | XV_ARGP_MEMCACHE_MMAP_SIZE 0x550004 |
#define | XV_ARGP_HIUE 0x550005 |
Functions | |
struct target * | xen_vm_instantiate (struct target_spec *spec, struct evloop *evloop) |
int | xen_vm_attach_overlay_thread (struct target *base, struct target *overlay, tid_t newtid) |
int | xen_vm_detach_overlay_thread (struct target *base, struct target *overlay, tid_t tid) |
int | xen_vm_attach_evloop (struct target *target, struct evloop *evloop) |
int | xen_vm_detach_evloop (struct target *target) |
int | xen_vm_disable_hw_breakpoints (struct target *target, tid_t tid) |
int | xen_vm_enable_hw_breakpoints (struct target *target, tid_t tid) |
int | xen_vm_disable_hw_breakpoint (struct target *target, tid_t tid, REG dreg) |
int | xen_vm_enable_hw_breakpoint (struct target *target, tid_t tid, REG dreg) |
int | xen_vm_notify_sw_breakpoint (struct target *target, ADDR addr, int notification) |
int | xen_vm_singlestep (struct target *target, tid_t tid, int isbp, struct target *overlay) |
int | xen_vm_singlestep_end (struct target *target, tid_t tid, struct target *overlay) |
uint64_t | xen_vm_get_tsc (struct target *target) |
uint64_t | xen_vm_get_time (struct target *target) |
uint64_t | xen_vm_get_counter (struct target *target) |
int | xen_vm_enable_feature (struct target *target, int feature, void *arg) |
int | xen_vm_disable_feature (struct target *target, int feature) |
int | xen_vm_instr_can_switch_context (struct target *target, ADDR addr) |
int | __xen_vm_vcpu_to_thread_regcache (struct target *target, struct vcpu_guest_context *context, struct target_thread *tthread, thread_ctxt_t tctxt) |
int | __xen_vm_thread_regcache_to_vcpu (struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, struct vcpu_guest_context *context) |
int | xen_vm_spec_to_argv (struct target_spec *spec, int *argc, char ***argv) |
error_t | xen_vm_argp_parse_opt (int key, char *arg, struct argp_state *state) |
struct xen_vm_spec * | xen_vm_build_spec (void) |
void | xen_vm_free_spec (struct xen_vm_spec *xspec) |
int | xen_vm_xc_attach (int *xc_handle, int *xce_handle) |
int | xen_vm_xc_detach (int *xc_handle, int *xce_handle) |
int | xen_vm_virq_attach (int xce_handle, XC_EVTCHN_PORT_T *dbg_port) |
int | xen_vm_virq_detach (int xce_handle, XC_EVTCHN_PORT_T *dbg_port) |
int | xen_vm_vmp_attach (char *path, int *cfd, char **cpath) |
int | xen_vm_vmp_detach (int *cfd, char **cpath) |
int | xen_vm_vmp_launch () |
int | xen_vm_virq_or_vmp_attach_or_launch (struct target *target) |
int | xen_vm_virq_or_vmp_detach (struct target *target) |
int | xen_vm_virq_or_vmp_get_fd (struct target *target) |
int | xen_vm_virq_or_vmp_read (struct target *target, int *vmid) |
int | xen_vm_evloop_handler (int readfd, int fdtype, void *state) |
unsigned char * | xen_vm_read_pid (struct target *target, tid_t tid, ADDR vaddr, unsigned long length, unsigned char *buf) |
unsigned long | xen_vm_write_pid (struct target *target, tid_t tid, ADDR vaddr, unsigned long length, unsigned char *buf) |
int | __xen_vm_thread_regcache_to_vcpu_64_reg_h (struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg, REGVAL regval, void *priv) |
int | __xen_vm_thread_regcache_to_vcpu_64_raw_h (struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg, void *rawval, int rawlen, void *priv) |
int | __xen_vm_thread_regcache_to_vcpu_32_reg_h (struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg, REGVAL regval, void *priv) |
int | __xen_vm_thread_regcache_to_vcpu_32_raw_h (struct target *target, struct target_thread *tthread, thread_ctxt_t tctxt, REG reg, void *rawval, int rawlen, void *priv) |
Variables | |
struct xen_vm_mem_ops | xen_vm_mem_ops_builtin |
int | xc_handle = -1 |
int | xce_handle_fd = -1 |
struct target_ops | xen_vm_ops |
struct argp_option | xen_vm_argp_opts [] |
struct argp | xen_vm_argp |
char * | xen_vm_argp_header = "Xen Backend Options" |
#define DRF "lx" |
Definition at line 229 of file target_xen_vm.c.
#define RF "x" |
Definition at line 228 of file target_xen_vm.c.
#define UNIX_PATH_MAX (size_t)sizeof(((struct sockaddr_un *) 0)->sun_path) |
Definition at line 33 of file target_xen_vm.c.
#define XC_IF_INVALID (-1) |
Definition at line 263 of file target_xen_vm.c.
#define XV_ARGP_CLEAR_MEM_CACHES 0x550003 |
Definition at line 358 of file target_xen_vm.c.
#define XV_ARGP_HIUE 0x550005 |
Definition at line 360 of file target_xen_vm.c.
#define XV_ARGP_MEMCACHE_MMAP_SIZE 0x550004 |
Definition at line 359 of file target_xen_vm.c.
#define XV_ARGP_USE_LIBVMI 0x550002 |
Definition at line 357 of file target_xen_vm.c.
#define XV_ARGP_USE_XENACCESS 0x550001 |
Definition at line 356 of file target_xen_vm.c.
int __xen_vm_thread_regcache_to_vcpu | ( | struct target * | target, |
struct target_thread * | tthread, | ||
thread_ctxt_t | tctxt, | ||
struct vcpu_guest_context * | context | ||
) |
Definition at line 5127 of file target_xen_vm.c.
int __xen_vm_thread_regcache_to_vcpu_32_raw_h | ( | struct target * | target, |
struct target_thread * | tthread, | ||
thread_ctxt_t | tctxt, | ||
REG | reg, | ||
void * | rawval, | ||
int | rawlen, | ||
void * | priv | ||
) |
Definition at line 5097 of file target_xen_vm.c.
int __xen_vm_thread_regcache_to_vcpu_32_reg_h | ( | struct target * | target, |
struct target_thread * | tthread, | ||
thread_ctxt_t | tctxt, | ||
REG | reg, | ||
REGVAL | regval, | ||
void * | priv | ||
) |
Definition at line 5066 of file target_xen_vm.c.
int __xen_vm_thread_regcache_to_vcpu_64_raw_h | ( | struct target * | target, |
struct target_thread * | tthread, | ||
thread_ctxt_t | tctxt, | ||
REG | reg, | ||
void * | rawval, | ||
int | rawlen, | ||
void * | priv | ||
) |
Definition at line 5036 of file target_xen_vm.c.
int __xen_vm_thread_regcache_to_vcpu_64_reg_h | ( | struct target * | target, |
struct target_thread * | tthread, | ||
thread_ctxt_t | tctxt, | ||
REG | reg, | ||
REGVAL | regval, | ||
void * | priv | ||
) |
Definition at line 5000 of file target_xen_vm.c.
int __xen_vm_vcpu_to_thread_regcache | ( | struct target * | target, |
struct vcpu_guest_context * | context, | ||
struct target_thread * | tthread, | ||
thread_ctxt_t | tctxt | ||
) |
Definition at line 4939 of file target_xen_vm.c.
error_t xen_vm_argp_parse_opt | ( | int | key, |
char * | arg, | ||
struct argp_state * | state | ||
) |
Definition at line 500 of file target_xen_vm.c.
Definition at line 4425 of file target_xen_vm.c.
Definition at line 2826 of file target_xen_vm.c.
struct xen_vm_spec* xen_vm_build_spec | ( | void | ) |
Definition at line 639 of file target_xen_vm.c.
int xen_vm_detach_evloop | ( | struct target * | target | ) |
Definition at line 4449 of file target_xen_vm.c.
Definition at line 2843 of file target_xen_vm.c.
int xen_vm_disable_feature | ( | struct target * | target, |
int | feature | ||
) |
Definition at line 5854 of file target_xen_vm.c.
Definition at line 5453 of file target_xen_vm.c.
Definition at line 5415 of file target_xen_vm.c.
int xen_vm_enable_feature | ( | struct target * | target, |
int | feature, | ||
void * | arg | ||
) |
Definition at line 5835 of file target_xen_vm.c.
Definition at line 5503 of file target_xen_vm.c.
Definition at line 5434 of file target_xen_vm.c.
int xen_vm_evloop_handler | ( | int | readfd, |
int | fdtype, | ||
void * | state | ||
) |
Definition at line 4391 of file target_xen_vm.c.
void xen_vm_free_spec | ( | struct xen_vm_spec * | xspec | ) |
Definition at line 649 of file target_xen_vm.c.
uint64_t xen_vm_get_counter | ( | struct target * | target | ) |
Definition at line 5803 of file target_xen_vm.c.
uint64_t xen_vm_get_time | ( | struct target * | target | ) |
Definition at line 5792 of file target_xen_vm.c.
uint64_t xen_vm_get_tsc | ( | struct target * | target | ) |
Definition at line 5761 of file target_xen_vm.c.
struct target * xen_vm_instantiate | ( | struct target_spec * | spec, |
struct evloop * | evloop | ||
) |
These are the only user-visible functions.
Definition at line 634 of file target_xen_vm.c.
Definition at line 5744 of file target_xen_vm.c.
Definition at line 5554 of file target_xen_vm.c.
unsigned char* xen_vm_read_pid | ( | struct target * | target, |
tid_t | tid, | ||
ADDR | vaddr, | ||
unsigned long | length, | ||
unsigned char * | buf | ||
) |
Definition at line 4793 of file target_xen_vm.c.
Definition at line 5588 of file target_xen_vm.c.
Definition at line 5682 of file target_xen_vm.c.
int xen_vm_spec_to_argv | ( | struct target_spec * | spec, |
int * | argc, | ||
char *** | argv | ||
) |
Definition at line 392 of file target_xen_vm.c.
int xen_vm_virq_attach | ( | int | xce_handle, |
XC_EVTCHN_PORT_T * | dbg_port | ||
) |
Definition at line 1932 of file target_xen_vm.c.
int xen_vm_virq_detach | ( | int | xce_handle, |
XC_EVTCHN_PORT_T * | dbg_port | ||
) |
Definition at line 1954 of file target_xen_vm.c.
int xen_vm_virq_or_vmp_attach_or_launch | ( | struct target * | target | ) |
Definition at line 2167 of file target_xen_vm.c.
int xen_vm_virq_or_vmp_detach | ( | struct target * | target | ) |
Definition at line 2213 of file target_xen_vm.c.
int xen_vm_virq_or_vmp_get_fd | ( | struct target * | target | ) |
Definition at line 2225 of file target_xen_vm.c.
int xen_vm_virq_or_vmp_read | ( | struct target * | target, |
int * | vmid | ||
) |
Definition at line 2237 of file target_xen_vm.c.
int xen_vm_vmp_attach | ( | char * | path, |
int * | cfd, | ||
char ** | cpath | ||
) |
Definition at line 1969 of file target_xen_vm.c.
int xen_vm_vmp_detach | ( | int * | cfd, |
char ** | cpath | ||
) |
Definition at line 2141 of file target_xen_vm.c.
int xen_vm_vmp_launch | ( | ) |
Definition at line 2155 of file target_xen_vm.c.
unsigned long xen_vm_write_pid | ( | struct target * | target, |
tid_t | tid, | ||
ADDR | vaddr, | ||
unsigned long | length, | ||
unsigned char * | buf | ||
) |
Definition at line 4813 of file target_xen_vm.c.
int xen_vm_xc_attach | ( | int * | xc_handle, |
int * | xce_handle | ||
) |
Definition at line 1880 of file target_xen_vm.c.
int xen_vm_xc_detach | ( | int * | xc_handle, |
int * | xce_handle | ||
) |
Definition at line 1913 of file target_xen_vm.c.
int xc_handle = -1 |
Definition at line 261 of file target_xen_vm.c.
int xce_handle_fd = -1 |
Definition at line 265 of file target_xen_vm.c.
struct argp xen_vm_argp |
Definition at line 625 of file target_xen_vm.c.
char* xen_vm_argp_header = "Xen Backend Options" |
Definition at line 628 of file target_xen_vm.c.
struct argp_option xen_vm_argp_opts[] |
Definition at line 362 of file target_xen_vm.c.
struct xen_vm_mem_ops xen_vm_mem_ops_builtin |
Definition at line 754 of file target_xen_vm_mem_builtin.c.
struct target_ops xen_vm_ops |
Definition at line 275 of file target_xen_vm.c.