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 | Enumerations | Functions | Variables
target_os.h File Reference
#include <glib.h>
#include "target_api.h"
#include "target_process.h"
Include dependency graph for target_os.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  target_os_syscall
 
struct  target_os_syscall_state
 
struct  target_os_ops
 

Macros

#define THREAD_CTXT_KERNEL   0
 
#define THREAD_CTXT_USER   1
 
#define SAFE_TARGET_OS_OP(target, op, errval,...)
 
#define SAFE_TARGET_OS_OP_NORET(target, op, errval, outvar,...)
 

Enumerations

enum  target_os_type_t { TARGET_OS_TYPE_NONE = 0, TARGET_OS_TYPE_LINUX = 1 }
 

Functions

target_os_type_t target_os_type (struct target *target)
 
uint64_t target_os_version (struct target *target)
 
int target_os_version_cmp (struct target *target, uint64_t vers)
 
int target_os_thread_get_pgd_phys (struct target *target, tid_t tid, ADDR *pgdp)
 
int target_os_thread_is_user (struct target *target, tid_t tid)
 
tid_t target_os_thread_get_leader (struct target *target, tid_t tid)
 
int target_os_thread_singlestep (struct target *target, tid_t tid, int isbp, struct target *overlay, int force_emulate)
 
int target_os_thread_singlestep_end (struct target *target, tid_t tid, struct target *overlay, int force_emulate)
 
result_t target_os_emulate_bp_handler (struct target *target, tid_t tid, thread_ctxt_t tidctxt, struct target_memmod *mmod)
 
result_t target_os_emulate_ss_handler (struct target *target, tid_t tid, thread_ctxt_t tidctxt, struct target_memmod *mmod)
 
GHashTable * target_os_process_table_get (struct target *target)
 
struct target_processtarget_os_process_get (struct target *target, tid_t tid)
 
int target_os_signal_enqueue (struct target *target, tid_t tid, int signo, void *data)
 
const char * target_os_signal_to_name (struct target *target, int signo)
 
int target_os_signal_from_name (struct target *target, const char *name)
 
int target_os_syscall_table_load (struct target *target)
 
int target_os_syscall_table_unload (struct target *target)
 
GHashTable * target_os_syscall_table_get (struct target *target)
 
int target_os_syscall_table_get_max_num (struct target *target)
 
struct target_os_syscalltarget_os_syscall_lookup_name (struct target *target, char *name)
 
struct target_os_syscalltarget_os_syscall_lookup_num (struct target *target, int num)
 
struct target_os_syscalltarget_os_syscall_lookup_addr (struct target *target, ADDR addr)
 
int target_os_syscall_table_reload (struct target *target, int force)
 
int target_os_syscall_table_store (struct target *target)
 
struct probetarget_os_syscall_probe (struct target *target, tid_t tid, struct target_os_syscall *syscall, probe_handler_t pre_handler, probe_handler_t post_handler, void *handler_data)
 
struct probetarget_os_syscall_probe_all (struct target *target, tid_t tid, probe_handler_t pre_handler, probe_handler_t post_handler, void *handler_data)
 
struct target_os_syscall_statetarget_os_syscall_probe_last (struct target *target, tid_t tid)
 
void * target_os_syscall_probe_summarize (struct probe *probe)
 
void * target_os_syscall_probe_summarize_tid (struct probe *probe, tid_t tid)
 
int target_os_update_process_threads_generic (struct target_process *process, int no_event_send)
 
struct target_os_syscall_statetarget_os_syscall_record_entry (struct target *target, tid_t tid, struct target_os_syscall *syscall)
 
int target_os_syscall_record_argv (struct target *target, tid_t tid, struct array_list *regvals, struct array_list *argvals)
 
int target_os_syscall_record_return (struct target *target, tid_t tid, REGVAL retval)
 
int target_os_syscall_record_clear (struct target *target, tid_t tid)
 

Variables

struct probe_ops target_os_syscall_ret_probe_ops
 

Macro Definition Documentation

#define SAFE_TARGET_OS_OP (   target,
  op,
  errval,
  ... 
)
Value:
do { \
verror("target %s is not an OS!\n",target->name); \
errno = EINVAL; \
return (errval); \
} \
else if (!target->os_ops || !target->os_ops->op) { \
verror("target %s does not support OS operation '%s'!\n", \
target->name,#op); \
errno = ENOSYS; \
return (errval); \
} \
else { \
return target->os_ops->op(__VA_ARGS__); \
} \
} while (0);
target_personality_t personality
Definition: target_api.h:2515
struct target_os_ops * os_ops
Definition: target_api.h:2593
#define verror(format,...)
Definition: log.h:30
char * name
Definition: target_api.h:2521

Definition at line 66 of file target_os.h.

#define SAFE_TARGET_OS_OP_NORET (   target,
  op,
  errval,
  outvar,
  ... 
)
Value:
do { \
verror("target %s is not an OS!\n",target->name); \
errno = EINVAL; \
outvar = (errval); \
} \
else if (!target->os_ops || !target->os_ops->op) { \
verror("target %s does not support OS operation '%s'!\n", \
target->name,#op); \
errno = ENOSYS; \
outvar = (errval); \
} \
else { \
outvar = target->os_ops->op(__VA_ARGS__); \
} \
} while (0);
target_personality_t personality
Definition: target_api.h:2515
struct target_os_ops * os_ops
Definition: target_api.h:2593
#define verror(format,...)
Definition: log.h:30
char * name
Definition: target_api.h:2521

Definition at line 84 of file target_os.h.

#define THREAD_CTXT_KERNEL   0

Definition at line 32 of file target_os.h.

#define THREAD_CTXT_USER   1

Definition at line 33 of file target_os.h.

Enumeration Type Documentation

Enumerator
TARGET_OS_TYPE_NONE 
TARGET_OS_TYPE_LINUX 

Definition at line 27 of file target_os.h.

Function Documentation

result_t target_os_emulate_bp_handler ( struct target target,
tid_t  tid,
thread_ctxt_t  tidctxt,
struct target_memmod mmod 
)

Definition at line 85 of file target_os.c.

result_t target_os_emulate_ss_handler ( struct target target,
tid_t  tid,
thread_ctxt_t  tidctxt,
struct target_memmod mmod 
)

Definition at line 163 of file target_os.c.

struct target_process* target_os_process_get ( struct target target,
tid_t  tid 
)

Definition at line 392 of file target_os.c.

GHashTable* target_os_process_table_get ( struct target target)

Definition at line 388 of file target_os.c.

int target_os_signal_enqueue ( struct target target,
tid_t  tid,
int  signo,
void *  data 
)

Definition at line 399 of file target_os.c.

int target_os_signal_from_name ( struct target target,
const char *  name 
)

Definition at line 411 of file target_os.c.

const char* target_os_signal_to_name ( struct target target,
int  signo 
)

Definition at line 407 of file target_os.c.

struct target_os_syscall* target_os_syscall_lookup_addr ( struct target target,
ADDR  addr 
)

Definition at line 449 of file target_os.c.

struct target_os_syscall* target_os_syscall_lookup_name ( struct target target,
char *  name 
)

Definition at line 437 of file target_os.c.

struct target_os_syscall* target_os_syscall_lookup_num ( struct target target,
int  num 
)

Definition at line 443 of file target_os.c.

struct probe* target_os_syscall_probe ( struct target target,
tid_t  tid,
struct target_os_syscall syscall,
probe_handler_t  pre_handler,
probe_handler_t  post_handler,
void *  handler_data 
)

Definition at line 465 of file target_os.c.

struct probe* target_os_syscall_probe_all ( struct target target,
tid_t  tid,
probe_handler_t  pre_handler,
probe_handler_t  post_handler,
void *  handler_data 
)

Definition at line 474 of file target_os.c.

struct target_os_syscall_state* target_os_syscall_probe_last ( struct target target,
tid_t  tid 
)

Definition at line 531 of file target_os.c.

void* target_os_syscall_probe_summarize ( struct probe probe)

Definition at line 491 of file target_os.c.

void* target_os_syscall_probe_summarize_tid ( struct probe probe,
tid_t  tid 
)

Definition at line 495 of file target_os.c.

int target_os_syscall_record_argv ( struct target target,
tid_t  tid,
struct array_list regvals,
struct array_list argvals 
)

Definition at line 562 of file target_os.c.

int target_os_syscall_record_clear ( struct target target,
tid_t  tid 
)

Definition at line 537 of file target_os.c.

struct target_os_syscall_state* target_os_syscall_record_entry ( struct target target,
tid_t  tid,
struct target_os_syscall syscall 
)

Definition at line 543 of file target_os.c.

int target_os_syscall_record_return ( struct target target,
tid_t  tid,
REGVAL  retval 
)

Definition at line 580 of file target_os.c.

GHashTable* target_os_syscall_table_get ( struct target target)

Definition at line 425 of file target_os.c.

int target_os_syscall_table_get_max_num ( struct target target)

Definition at line 430 of file target_os.c.

int target_os_syscall_table_load ( struct target target)

Definition at line 415 of file target_os.c.

int target_os_syscall_table_reload ( struct target target,
int  force 
)

Definition at line 455 of file target_os.c.

int target_os_syscall_table_store ( struct target target)

Definition at line 460 of file target_os.c.

int target_os_syscall_table_unload ( struct target target)

Definition at line 420 of file target_os.c.

tid_t target_os_thread_get_leader ( struct target target,
tid_t  tid 
)

Definition at line 62 of file target_os.c.

int target_os_thread_get_pgd_phys ( struct target target,
tid_t  tid,
ADDR pgdp 
)

Definition at line 48 of file target_os.c.

int target_os_thread_is_user ( struct target target,
tid_t  tid 
)

Definition at line 55 of file target_os.c.

int target_os_thread_singlestep ( struct target target,
tid_t  tid,
int  isbp,
struct target overlay,
int  force_emulate 
)

Definition at line 73 of file target_os.c.

int target_os_thread_singlestep_end ( struct target target,
tid_t  tid,
struct target overlay,
int  force_emulate 
)

Definition at line 79 of file target_os.c.

target_os_type_t target_os_type ( struct target target)

Definition at line 33 of file target_os.c.

int target_os_update_process_threads_generic ( struct target_process process,
int  no_event_send 
)

Definition at line 211 of file target_os.c.

uint64_t target_os_version ( struct target target)

Definition at line 38 of file target_os.c.

int target_os_version_cmp ( struct target target,
uint64_t  vers 
)

Definition at line 43 of file target_os.c.

Variable Documentation

struct probe_ops target_os_syscall_ret_probe_ops

Definition at line 499 of file target_os.c.