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
Macros | Functions | Variables
nullpage_util.c File Reference
#include <stdio.h>
#include <errno.h>
#include <argp.h>
#include "log.h"
#include "arch.h"
#include "arch_x86.h"
#include "arch_x86_64.h"
#include "probe_api.h"
#include "probe.h"
#include "target.h"
#include "target_api.h"
#include "nullpage.h"
Include dependency graph for nullpage_util.c:

Go to the source code of this file.

Macros

#define NP_ARGP_TTCTX   30000
 
#define NP_ARGP_TTDETAIL   30001
 
#define NP_PROT_READ   0x1
 
#define NP_PROT_WRITE   0x2
 
#define NP_PROT_EXEC   0x4
 
#define NP_MAP_FIXED   0x10
 

Functions

error_t np_argp_parse_opt (int key, char *arg, struct argp_state *state)
 
const char * probe_gettype_np (struct probe *probe)
 
void * probe_summarize_np (struct probe *probe)
 
int probe_fini_np (struct probe *probe)
 
result_t np_mmap_handler (struct probe *probe, tid_t tid, void *data, struct probe *trigger, struct probe *base)
 
result_t np_mprotect_handler (struct probe *probe, tid_t tid, void *data, struct probe *trigger, struct probe *base)
 
result_t np_pgfault_handler (struct probe *probe, tid_t tid, void *data, struct probe *trigger, struct probe *base)
 
struct probeprobe_np (struct target *target, struct np_config *npc, probe_handler_t pre_handler, probe_handler_t post_handler, void *handler_data)
 

Variables

struct argp_option np_argp_opts []
 
struct argp np_argp
 

Macro Definition Documentation

#define NP_ARGP_TTCTX   30000

Definition at line 39 of file nullpage_util.c.

#define NP_ARGP_TTDETAIL   30001

Definition at line 40 of file nullpage_util.c.

#define NP_MAP_FIXED   0x10

Definition at line 162 of file nullpage_util.c.

#define NP_PROT_EXEC   0x4

Definition at line 160 of file nullpage_util.c.

#define NP_PROT_READ   0x1

Handlers for the subordinate probes that serve the metaprobe.

Definition at line 158 of file nullpage_util.c.

#define NP_PROT_WRITE   0x2

Definition at line 159 of file nullpage_util.c.

Function Documentation

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

Argp parsing stuff.

Definition at line 52 of file nullpage_util.c.

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

Definition at line 164 of file nullpage_util.c.

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

Definition at line 213 of file nullpage_util.c.

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

Definition at line 264 of file nullpage_util.c.

int probe_fini_np ( struct probe probe)

Definition at line 126 of file nullpage_util.c.

const char* probe_gettype_np ( struct probe probe)

Probe type stuff.

Definition at line 118 of file nullpage_util.c.

struct probe* probe_np ( struct target target,
struct np_config npc,
probe_handler_t  pre_handler,
probe_handler_t  post_handler,
void *  handler_data 
)

Metaprobe instantiation: create a null-page r/w/x usage "probe".

Definition at line 335 of file nullpage_util.c.

void* probe_summarize_np ( struct probe probe)

Definition at line 122 of file nullpage_util.c.

Variable Documentation

struct argp np_argp
Initial value:
= {
np_argp_opts,np_argp_parse_opt,NULL,NULL,NULL,NULL,NULL,
}
struct argp_option np_argp_opts[]
Definition: nullpage_util.c:42
error_t np_argp_parse_opt(int key, char *arg, struct argp_state *state)
Definition: nullpage_util.c:52

Definition at line 48 of file nullpage_util.c.

struct argp_option np_argp_opts[]
Initial value:
= {
{ "np-mode",'N',"[mprotect[,mmap[,pgfault]]]",0,"Set the mode for the NULL page usage detector. mprotect is probably the cheapest option, because it is called less frequently than mmap, and must always be called to change protections for an mmap'd page (?). The pgfault style will be most expensive. To achieve certain, good coverage, choose all three!",0 },
{ "ttctx",NP_ARGP_TTCTX,"none|self|hier|all (default self)",0,"Which threads to display when an event happens.",0 },
{ "ttdetail",NP_ARGP_TTDETAIL,"-2|-1|0|1|2 (default 0)",0,"How much info to print for each thread that is printed.",0 },
{ 0,0,0,0,0,0 },
}
#define NP_ARGP_TTDETAIL
Definition: nullpage_util.c:40
#define NP_ARGP_TTCTX
Definition: nullpage_util.c:39

Definition at line 42 of file nullpage_util.c.