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
spf.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <inttypes.h>
#include <signal.h>
#include <argp.h>
#include "log.h"
#include "glib_wrapper.h"
#include "dwdebug.h"
#include "target_api.h"
#include "target.h"
#include "target_os.h"
#include "probe_api.h"
#include "probe.h"
#include "alist.h"
#include "list.h"
Include dependency graph for spf.c:

Go to the source code of this file.

Data Structures

struct  spf_action
 
struct  spf_filter
 
struct  spf_config
 
struct  overlay_spec
 
struct  spf_argp_state
 

Macros

#define LF_U_CFG   1 << 1
 
#define LF_U_PROBE   1 << 2
 
#define WHEN_PRE   0
 
#define WHEN_POST   1
 
#define __TARGET_OVERLAY   0x200000
 
#define SPF_CONFIGFILE_FATAL   0x200001
 
#define SPF_OS_SYSCALL_PROBES   0x200002
 

Enumerations

enum  spf_action_type_t {
  SPF_ACTION_PRINT = 1, SPF_ACTION_ABORT = 2, SPF_ACTION_REPORT = 3, SPF_ACTION_EXIT = 4,
  SPF_ACTION_ENABLE = 5, SPF_ACTION_DISABLE = 6, SPF_ACTION_REMOVE = 7, SPF_ACTION_BT = 8,
  SPF_ACTION_SIGNAL = 9
}
 

Functions

struct spf_configload_config_file (char *file)
 
int apply_config_file (struct spf_config *config)
 
void reload_config_file (void)
 
void spf_action_free (struct spf_action *spfa)
 
void spf_filter_free (struct spf_filter *spff)
 
void spf_config_free (struct spf_config *config)
 
void cleanup_probes ()
 
void sigh_cleanup_probes (int signo, siginfo_t *siginfo, void *x)
 
void print_thread_context (FILE *stream, struct target *target, tid_t tid, int ttctx, int ttdetail, int bt, int overlay_levels, char *overlay_debuginfo_prefix, char *sep, char *kvsep, char *tprefix, char *tsep)
 
void spf_backtrace (struct target *t, tid_t ctid, char *tiddesc, int overlay_levels, char *overlay_debuginfo_prefix)
 
int spf_signal (struct target *t, tid_t ctid, char *tiddesc, char *sigdesc)
 
result_t handler (int when, struct probe *probe, tid_t tid, void *data, struct probe *trigger, struct probe *base)
 
result_t pre_handler (struct probe *probe, tid_t tid, void *data, struct probe *trigger, struct probe *base)
 
result_t post_handler (struct probe *probe, tid_t tid, void *data, struct probe *trigger, struct probe *base)
 
result_t null_handler (struct probe *probe, tid_t tid, void *data, struct probe *trigger, struct probe *base)
 
error_t spf_argp_parse_opt (int key, char *arg, struct argp_state *state)
 
int main (int argc, char **argv)
 
char * _get_next_non_enc_esc (char *s, int c)
 

Variables

GList * targets
 
struct spf_configconfig = NULL
 
struct spf_argp_state opts
 
GHashTable * sprobes = NULL
 
GHashTable * fprobes = NULL
 
int needtodie = 0
 
int needtodie_exitcode = 0
 
int result_counter = 0
 
sigset_t ignored
 
sigset_t interrupt
 
sigset_t exitset
 
struct argp_option spf_argp_opts []
 
struct argp spf_argp
 

Macro Definition Documentation

#define __TARGET_OVERLAY   0x200000

Definition at line 924 of file spf.c.

#define LF_U_CFG   1 << 1

Definition at line 42 of file spf.c.

#define LF_U_PROBE   1 << 2

Definition at line 43 of file spf.c.

#define SPF_CONFIGFILE_FATAL   0x200001

Definition at line 925 of file spf.c.

#define SPF_OS_SYSCALL_PROBES   0x200002

Definition at line 926 of file spf.c.

#define WHEN_POST   1

Definition at line 110 of file spf.c.

#define WHEN_PRE   0

Definition at line 109 of file spf.c.

Enumeration Type Documentation

Enumerator
SPF_ACTION_PRINT 
SPF_ACTION_ABORT 
SPF_ACTION_REPORT 
SPF_ACTION_EXIT 
SPF_ACTION_ENABLE 
SPF_ACTION_DISABLE 
SPF_ACTION_REMOVE 
SPF_ACTION_BT 
SPF_ACTION_SIGNAL 

Definition at line 48 of file spf.c.

Function Documentation

char* _get_next_non_enc_esc ( char *  s,
int  c 
)

Definition at line 1450 of file spf.c.

int apply_config_file ( struct spf_config config)

Definition at line 1525 of file spf.c.

void cleanup_probes ( void  )

Definition at line 176 of file spf.c.

result_t handler ( int  when,
struct probe probe,
tid_t  tid,
void *  data,
struct probe trigger,
struct probe base 
)

Definition at line 561 of file spf.c.

struct spf_config * load_config_file ( char *  file)

Definition at line 1682 of file spf.c.

int main ( int  argc,
char **  argv 
)

Definition at line 988 of file spf.c.

result_t null_handler ( struct probe probe,
tid_t  tid,
void *  data,
struct probe trigger,
struct probe base 
)

Definition at line 918 of file spf.c.

result_t post_handler ( struct probe probe,
tid_t  tid,
void *  data,
struct probe trigger,
struct probe base 
)

Definition at line 908 of file spf.c.

result_t pre_handler ( struct probe probe,
tid_t  tid,
void *  data,
struct probe trigger,
struct probe base 
)

Definition at line 903 of file spf.c.

void print_thread_context ( FILE *  stream,
struct target target,
tid_t  tid,
int  ttctx,
int  ttdetail,
int  bt,
int  overlay_levels,
char *  overlay_debuginfo_prefix,
char *  sep,
char *  kvsep,
char *  tprefix,
char *  tsep 
)

Definition at line 219 of file spf.c.

void reload_config_file ( void  )

Definition at line 1487 of file spf.c.

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

Definition at line 213 of file spf.c.

void spf_action_free ( struct spf_action spfa)

Definition at line 1378 of file spf.c.

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

Definition at line 938 of file spf.c.

void spf_backtrace ( struct target t,
tid_t  ctid,
char *  tiddesc,
int  overlay_levels,
char *  overlay_debuginfo_prefix 
)

Definition at line 354 of file spf.c.

void spf_config_free ( struct spf_config config)

Definition at line 1425 of file spf.c.

void spf_filter_free ( struct spf_filter spff)

Definition at line 1403 of file spf.c.

int spf_signal ( struct target t,
tid_t  ctid,
char *  tiddesc,
char *  sigdesc 
)

Definition at line 485 of file spf.c.

Variable Documentation

struct spf_config* config = NULL

Definition at line 156 of file spf.c.

sigset_t exitset

Definition at line 211 of file spf.c.

GHashTable* fprobes = NULL

Definition at line 160 of file spf.c.

sigset_t ignored

Definition at line 211 of file spf.c.

sigset_t interrupt

Definition at line 211 of file spf.c.

int needtodie = 0

Definition at line 162 of file spf.c.

int needtodie_exitcode = 0

Definition at line 163 of file spf.c.

struct spf_argp_state opts

Definition at line 157 of file spf.c.

int result_counter = 0

Definition at line 165 of file spf.c.

struct argp spf_argp
Initial value:
= {
spf_argp_opts,spf_argp_parse_opt,NULL,NULL,NULL,NULL,NULL,
}
struct argp_option spf_argp_opts[]
Definition: spf.c:928
error_t spf_argp_parse_opt(int key, char *arg, struct argp_state *state)
Definition: spf.c:938

Definition at line 984 of file spf.c.

struct argp_option spf_argp_opts[]
Initial value:
= {
{ "overlay",__TARGET_OVERLAY,"[<target_id>:]<thread_name_or_id>:<spec_opts>",0,"Lookup name or id as an overlay target once the main target is instantiated, and try to open it. All dumptarget options then apply to the overlay.",0 },
{ "config-file",'C',"<FILE>",0,"An SPF config file.",0 },
{ "config-file-fatal",SPF_CONFIGFILE_FATAL,NULL,0,
"Make errors while applying runtime updates (via USR2) to the config file fatal.",0 },
{ "use-os-syscall-probes",SPF_OS_SYSCALL_PROBES,NULL,0,
"Try to use target_os_syscall probes if symbol is a syscall and target is an OS.",0 },
{ 0,0,0,0,0,0 },
}
#define __TARGET_OVERLAY
Definition: spf.c:924
#define SPF_CONFIGFILE_FATAL
Definition: spf.c:925
#define SPF_OS_SYSCALL_PROBES
Definition: spf.c:926

Definition at line 928 of file spf.c.

GHashTable* sprobes = NULL

Definition at line 159 of file spf.c.

GList* targets

Definition at line 155 of file spf.c.