Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
trace_probe.c File Reference
#include "trace_probe.h"

Go to the source code of this file.

Data Structures

struct  symbol_cache
 
struct  bitfield_fetch_param
 

Macros

#define PRINT_TYPE_FUNC_NAME(type)   print_type_##type
 
#define PRINT_TYPE_FMT_NAME(type)   print_type_format_##type
 
#define DEFINE_BASIC_PRINT_TYPE_FUNC(type, fmt, cast)
 
#define FETCH_FUNC_NAME(method, type)   fetch_##method##_##type
 
#define DEFINE_BASIC_FETCH_FUNCS(method)
 
#define CHECK_FETCH_FUNCS(method, fn)
 
#define DEFINE_FETCH_reg(type)
 
#define fetch_reg_string   NULL
 
#define fetch_reg_string_size   NULL
 
#define DEFINE_FETCH_stack(type)
 
#define fetch_stack_string   NULL
 
#define fetch_stack_string_size   NULL
 
#define DEFINE_FETCH_retval(type)
 
#define fetch_retval_string   NULL
 
#define fetch_retval_string_size   NULL
 
#define DEFINE_FETCH_memory(type)
 
#define DEFINE_FETCH_symbol(type)
 
#define DEFINE_FETCH_deref(type)
 
#define DEFINE_FETCH_bitfield(type)
 
#define fetch_bitfield_string   NULL
 
#define fetch_bitfield_string_size   NULL
 
#define __DEFAULT_FETCH_TYPE(t)   u##t
 
#define _DEFAULT_FETCH_TYPE(t)   __DEFAULT_FETCH_TYPE(t)
 
#define DEFAULT_FETCH_TYPE   _DEFAULT_FETCH_TYPE(BITS_PER_LONG)
 
#define DEFAULT_FETCH_TYPE_STR   __stringify(DEFAULT_FETCH_TYPE)
 
#define ASSIGN_FETCH_FUNC(method, type)   [FETCH_MTD_##method] = FETCH_FUNC_NAME(method, type)
 
#define __ASSIGN_FETCH_TYPE(_name, ptype, ftype, _size, sign, _fmttype)
 
#define ASSIGN_FETCH_TYPE(ptype, ftype, sign)   __ASSIGN_FETCH_TYPE(#ptype, ptype, ftype, sizeof(ftype), sign, #ptype)
 
#define FETCH_TYPE_STRING   0
 
#define FETCH_TYPE_STRSIZE   1
 
#define PARAM_MAX_STACK   (THREAD_SIZE / sizeof(unsigned long))
 
#define BYTES_TO_BITS(nb)   ((BITS_PER_LONG * (nb)) / sizeof(long))
 
#define WRITE_BUFSIZE   4096
 

Typedefs

typedef u32 string
 
typedef u32 string_size
 

Functions

 DEFINE_FETCH_symbol (string)
 
 DEFINE_FETCH_deref (string)
 
int traceprobe_split_symbol_offset (char *symbol, unsigned long *offset)
 
int traceprobe_parse_probe_arg (char *arg, ssize_t *size, struct probe_arg *parg, bool is_return, bool is_kprobe)
 
int traceprobe_conflict_field_name (const char *name, struct probe_arg *args, int narg)
 
void traceprobe_update_arg (struct probe_arg *arg)
 
void traceprobe_free_probe_arg (struct probe_arg *arg)
 
int traceprobe_command (const char *buf, int(*createfn)(int, char **))
 
ssize_t traceprobe_probes_write (struct file *file, const char __user *buffer, size_t count, loff_t *ppos, int(*createfn)(int, char **))
 

Variables

const charreserved_field_names []
 

Macro Definition Documentation

#define __ASSIGN_FETCH_TYPE (   _name,
  ptype,
  ftype,
  _size,
  sign,
  _fmttype 
)
Value:
{.name = _name, \
.size = _size, \
.is_signed = sign, \
.print = PRINT_TYPE_FUNC_NAME(ptype), \
.fmt = PRINT_TYPE_FMT_NAME(ptype), \
.fmttype = _fmttype, \
.fetch = { \
ASSIGN_FETCH_FUNC(reg, ftype), \
ASSIGN_FETCH_FUNC(stack, ftype), \
ASSIGN_FETCH_FUNC(retval, ftype), \
ASSIGN_FETCH_FUNC(memory, ftype), \
ASSIGN_FETCH_FUNC(symbol, ftype), \
ASSIGN_FETCH_FUNC(deref, ftype), \
ASSIGN_FETCH_FUNC(bitfield, ftype), \
} \
}

Definition at line 386 of file trace_probe.c.

#define __DEFAULT_FETCH_TYPE (   t)    u##t

Definition at line 378 of file trace_probe.c.

#define _DEFAULT_FETCH_TYPE (   t)    __DEFAULT_FETCH_TYPE(t)

Definition at line 379 of file trace_probe.c.

#define ASSIGN_FETCH_FUNC (   method,
  type 
)    [FETCH_MTD_##method] = FETCH_FUNC_NAME(method, type)

Definition at line 383 of file trace_probe.c.

#define ASSIGN_FETCH_TYPE (   ptype,
  ftype,
  sign 
)    __ASSIGN_FETCH_TYPE(#ptype, ptype, ftype, sizeof(ftype), sign, #ptype)

Definition at line 404 of file trace_probe.c.

#define BYTES_TO_BITS (   nb)    ((BITS_PER_LONG * (nb)) / sizeof(long))

Definition at line 646 of file trace_probe.c.

#define CHECK_FETCH_FUNCS (   method,
  fn 
)
Value:
(((FETCH_FUNC_NAME(method, u8) == fn) || \
(FETCH_FUNC_NAME(method, string) == fn) || \
&& (fn != NULL))

Definition at line 103 of file trace_probe.c.

#define DEFAULT_FETCH_TYPE   _DEFAULT_FETCH_TYPE(BITS_PER_LONG)

Definition at line 380 of file trace_probe.c.

#define DEFAULT_FETCH_TYPE_STR   __stringify(DEFAULT_FETCH_TYPE)

Definition at line 381 of file trace_probe.c.

#define DEFINE_BASIC_FETCH_FUNCS (   method)
Value:
DEFINE_FETCH_##method(u8) \
DEFINE_FETCH_##method(u16) \
DEFINE_FETCH_##method(u32) \
DEFINE_FETCH_##method(u64)

Definition at line 97 of file trace_probe.c.

#define DEFINE_BASIC_PRINT_TYPE_FUNC (   type,
  fmt,
  cast 
)
Value:
const char *name, \
void *data, void *ent)\
{ \
return trace_seq_printf(s, " %s=" fmt, name, (cast)*(type *)data);\
} \
static const char PRINT_TYPE_FMT_NAME(type)[] = fmt;

Definition at line 43 of file trace_probe.c.

#define DEFINE_FETCH_bitfield (   type)
Value:
void *data, void *dest) \
{ \
type buf = 0; \
call_fetch(&bprm->orig, regs, &buf); \
if (buf) { \
buf <<= bprm->hi_shift; \
buf >>= bprm->low_shift; \
} \
*(type *)dest = buf; \
}

Definition at line 331 of file trace_probe.c.

#define DEFINE_FETCH_deref (   type)
Value:
static __kprobes void FETCH_FUNC_NAME(deref, type)(struct pt_regs *regs,\
void *data, void *dest) \
{ \
struct deref_fetch_param *dprm = data; \
unsigned long addr; \
call_fetch(&dprm->orig, regs, &addr); \
if (addr) { \
addr += dprm->offset; \
fetch_memory_##type(regs, (void *)addr, dest); \
} else \
*(type *)dest = 0; \
}

Definition at line 290 of file trace_probe.c.

#define DEFINE_FETCH_memory (   type)
Value:
void *addr, void *dest) \
{ \
if (probe_kernel_address(addr, retval)) \
*(type *)dest = 0; \
else \
*(type *)dest = retval; \
}

Definition at line 148 of file trace_probe.c.

#define DEFINE_FETCH_reg (   type)
Value:
static __kprobes void FETCH_FUNC_NAME(reg, type)(struct pt_regs *regs, \
void *offset, void *dest) \
{ \
(unsigned int)((unsigned long)offset)); \
}

Definition at line 113 of file trace_probe.c.

#define DEFINE_FETCH_retval (   type)
Value:
void *dummy, void *dest) \
{ \
*(type *)dest = (type)regs_return_value(regs); \
}

Definition at line 137 of file trace_probe.c.

#define DEFINE_FETCH_stack (   type)
Value:
void *offset, void *dest) \
{ \
(unsigned int)((unsigned long)offset)); \
}

Definition at line 125 of file trace_probe.c.

#define DEFINE_FETCH_symbol (   type)
Value:
void *data, void *dest) \
{ \
if (sc->addr) \
fetch_memory_##type(regs, (void *)sc->addr, dest); \
else \
*(type *)dest = 0; \
}

Definition at line 270 of file trace_probe.c.

#define fetch_bitfield_string   NULL

Definition at line 346 of file trace_probe.c.

#define fetch_bitfield_string_size   NULL

Definition at line 347 of file trace_probe.c.

#define FETCH_FUNC_NAME (   method,
  type 
)    fetch_##method##_##type

Definition at line 92 of file trace_probe.c.

#define fetch_reg_string   NULL

Definition at line 122 of file trace_probe.c.

#define fetch_reg_string_size   NULL

Definition at line 123 of file trace_probe.c.

#define fetch_retval_string   NULL

Definition at line 145 of file trace_probe.c.

#define fetch_retval_string_size   NULL

Definition at line 146 of file trace_probe.c.

#define fetch_stack_string   NULL

Definition at line 134 of file trace_probe.c.

#define fetch_stack_string_size   NULL

Definition at line 135 of file trace_probe.c.

#define FETCH_TYPE_STRING   0

Definition at line 407 of file trace_probe.c.

#define FETCH_TYPE_STRSIZE   1

Definition at line 408 of file trace_probe.c.

#define PARAM_MAX_STACK   (THREAD_SIZE / sizeof(unsigned long))

Definition at line 516 of file trace_probe.c.

#define PRINT_TYPE_FMT_NAME (   type)    print_type_format_##type

Definition at line 40 of file trace_probe.c.

#define PRINT_TYPE_FUNC_NAME (   type)    print_type_##type

Definition at line 39 of file trace_probe.c.

#define WRITE_BUFSIZE   4096

Definition at line 785 of file trace_probe.c.

Typedef Documentation

typedef u32 string

Definition at line 73 of file trace_probe.c.

typedef u32 string_size

Definition at line 74 of file trace_probe.c.

Function Documentation

DEFINE_FETCH_deref ( string  )

Definition at line 304 of file trace_probe.c.

DEFINE_FETCH_symbol ( string  )

Definition at line 281 of file trace_probe.c.

int traceprobe_command ( const char buf,
int(*)(int, char **)  createfn 
)

Definition at line 766 of file trace_probe.c.

int traceprobe_conflict_field_name ( const char name,
struct probe_arg args,
int  narg 
)

Definition at line 727 of file trace_probe.c.

void traceprobe_free_probe_arg ( struct probe_arg arg)

Definition at line 753 of file trace_probe.c.

int traceprobe_parse_probe_arg ( char arg,
ssize_t size,
struct probe_arg parg,
bool  is_return,
bool  is_kprobe 
)

Definition at line 685 of file trace_probe.c.

ssize_t traceprobe_probes_write ( struct file file,
const char __user buffer,
size_t  count,
loff_t *  ppos,
int(*)(int, char **)  createfn 
)

Definition at line 787 of file trace_probe.c.

int traceprobe_split_symbol_offset ( char symbol,
unsigned long offset 
)

Definition at line 494 of file trace_probe.c.

void traceprobe_update_arg ( struct probe_arg arg)

Definition at line 743 of file trace_probe.c.

Variable Documentation

const char* reserved_field_names[]
Initial value:
= {
"common_type",
"common_flags",
"common_preempt_count",
"common_pid",
"common_tgid",
}

Definition at line 27 of file trace_probe.c.