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 |
#define | XV_ARGP_REPLAYDIR 0x550006 |
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_REPLAYDIR 0x550006 |
Definition at line 361 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 5163 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 5133 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 5102 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 5072 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 5036 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 4975 of file target_xen_vm.c.
error_t xen_vm_argp_parse_opt | ( | int | key, |
char * | arg, | ||
struct argp_state * | state | ||
) |
Definition at line 501 of file target_xen_vm.c.
Definition at line 4443 of file target_xen_vm.c.
Definition at line 2832 of file target_xen_vm.c.
struct xen_vm_spec* xen_vm_build_spec | ( | void | ) |
Definition at line 640 of file target_xen_vm.c.
int xen_vm_detach_evloop | ( | struct target * | target | ) |
Definition at line 4467 of file target_xen_vm.c.
Definition at line 2849 of file target_xen_vm.c.
int xen_vm_disable_feature | ( | struct target * | target, |
int | feature | ||
) |
Definition at line 5944 of file target_xen_vm.c.
Definition at line 5519 of file target_xen_vm.c.
Definition at line 5469 of file target_xen_vm.c.
int xen_vm_enable_feature | ( | struct target * | target, |
int | feature, | ||
void * | arg | ||
) |
Definition at line 5925 of file target_xen_vm.c.
Definition at line 5575 of file target_xen_vm.c.
Definition at line 5494 of file target_xen_vm.c.
int xen_vm_evloop_handler | ( | int | readfd, |
int | fdtype, | ||
void * | state | ||
) |
Definition at line 4409 of file target_xen_vm.c.
void xen_vm_free_spec | ( | struct xen_vm_spec * | xspec | ) |
Definition at line 650 of file target_xen_vm.c.
uint64_t xen_vm_get_counter | ( | struct target * | target | ) |
Definition at line 5893 of file target_xen_vm.c.
uint64_t xen_vm_get_time | ( | struct target * | target | ) |
Definition at line 5882 of file target_xen_vm.c.
uint64_t xen_vm_get_tsc | ( | struct target * | target | ) |
Definition at line 5851 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 635 of file target_xen_vm.c.
Definition at line 5834 of file target_xen_vm.c.
Definition at line 5632 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 4823 of file target_xen_vm.c.
Definition at line 5666 of file target_xen_vm.c.
Definition at line 5766 of file target_xen_vm.c.
int xen_vm_spec_to_argv | ( | struct target_spec * | spec, |
int * | argc, | ||
char *** | argv | ||
) |
Definition at line 393 of file target_xen_vm.c.
int xen_vm_virq_attach | ( | int | xce_handle, |
XC_EVTCHN_PORT_T * | dbg_port | ||
) |
Definition at line 1938 of file target_xen_vm.c.
int xen_vm_virq_detach | ( | int | xce_handle, |
XC_EVTCHN_PORT_T * | dbg_port | ||
) |
Definition at line 1960 of file target_xen_vm.c.
int xen_vm_virq_or_vmp_attach_or_launch | ( | struct target * | target | ) |
Definition at line 2173 of file target_xen_vm.c.
int xen_vm_virq_or_vmp_detach | ( | struct target * | target | ) |
Definition at line 2219 of file target_xen_vm.c.
int xen_vm_virq_or_vmp_get_fd | ( | struct target * | target | ) |
Definition at line 2231 of file target_xen_vm.c.
int xen_vm_virq_or_vmp_read | ( | struct target * | target, |
int * | vmid | ||
) |
Definition at line 2243 of file target_xen_vm.c.
int xen_vm_vmp_attach | ( | char * | path, |
int * | cfd, | ||
char ** | cpath | ||
) |
Definition at line 1975 of file target_xen_vm.c.
int xen_vm_vmp_detach | ( | int * | cfd, |
char ** | cpath | ||
) |
Definition at line 2147 of file target_xen_vm.c.
int xen_vm_vmp_launch | ( | ) |
Definition at line 2161 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 4843 of file target_xen_vm.c.
int xen_vm_xc_attach | ( | int * | xc_handle, |
int * | xce_handle | ||
) |
Definition at line 1886 of file target_xen_vm.c.
int xen_vm_xc_detach | ( | int * | xc_handle, |
int * | xce_handle | ||
) |
Definition at line 1919 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 626 of file target_xen_vm.c.
char* xen_vm_argp_header = "Xen Backend Options" |
Definition at line 629 of file target_xen_vm.c.
struct argp_option xen_vm_argp_opts[] |
Definition at line 363 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.