From 0166f61e34a34ef1138e1de7a7068bf602741a0c Mon Sep 17 00:00:00 2001 From: William Cohen Date: Tue, 25 Nov 2008 11:03:28 -0500 Subject: Add context, timestamp, memory, and networking tapsets. --- tapset/context.stp | 351 ++++++++++++++++++++++------------------------------- 1 file changed, 144 insertions(+), 207 deletions(-) (limited to 'tapset/context.stp') diff --git a/tapset/context.stp b/tapset/context.stp index 3c87d1b8..7505c607 100644 --- a/tapset/context.stp +++ b/tapset/context.stp @@ -7,37 +7,22 @@ // Public License (GPL); either version 2, or (at your option) any // later version. -/// -/// Context Functions -/// -/// The context functions provide additional information about the where -/// the event occurred. -/// These functions can provide information such as a backtrace -/// where the event occured -/// and the current register values for the processor. -/// -/// -/// print_regs() -/// print_regs -/// -/// Print a register dump. -/// -/// +/** + * sfunction print_regs - Print a register dump. + */ function print_regs () %{ if (CONTEXT->regs) { _stp_print_regs (CONTEXT->regs); } %} -/// -/// print_backtrace() -/// print_backtrace -/// -/// Equivalent to print_stack(backtrace()), -/// except that deeper stack nesting may be supported. Return nothing. -/// -/// +/** + * sfunction print_backtrace - Print stack back trace + * + * Equivalent to print_stack(backtrace()), + * except that deeper stack nesting may be supported. Return nothing. + */ function print_backtrace () %{ if (CONTEXT->regs) { _stp_stack_print(CONTEXT->regs, 1, CONTEXT->pi, MAXTRACE); @@ -46,14 +31,12 @@ function print_backtrace () %{ } %} -/// -/// backtrace:string() -/// backtrace -/// -/// Return a string of hex addresses that are a backtrace of the -/// stack. It may be truncated due to maximum string length. -/// -/// +/** + * sfunction backtrace - Hex backtrace of current stack + * + * Return a string of hex addresses that are a backtrace of the + * stack. It may be truncated due to maximum string length. + */ function backtrace:string () %{ /* pure */ if (CONTEXT->regs) _stp_stack_snprint (THIS->__retvalue, MAXSTRINGLEN, CONTEXT->regs, 0, CONTEXT->pi, MAXTRACE); @@ -61,46 +44,39 @@ function backtrace:string () %{ /* pure */ strlcpy (THIS->__retvalue, "", MAXSTRINGLEN); %} -/// -/// execname:string() -/// execname -/// -/// Return the name of the current process. -/// -/// +/** + * sfunction execname - Execname of current processes + * + * Return the name of the current process. + */ function execname:string () %{ /* pure */ strlcpy (THIS->__retvalue, current->comm, MAXSTRINGLEN); %} -/// -/// pid:long () -/// pid -/// -/// Return the id of the current process. -/// -/// +/** + * sfunction pid - Process ID of current process + * + * + * Return the id of the current process. + */ function pid:long () %{ /* pure */ THIS->__retvalue = current->tgid; %} -/// -/// tid:long() -/// tid -/// -/// Return the id of the current thread. -/// -/// +/** + * sfunction tid - Thread ID of current process + * + * Return the id of the current thread. + */ function tid:long () %{ /* pure */ THIS->__retvalue = current->pid; %} -/// -/// ppid:long() -/// ppid -/// -/// Return the id of the parent process. -/// -/// +/** + * sfunction ppid - Parent Process ID of current process + * + * Return the id of the parent process. + */ function ppid:long () %{ /* pure */ #if defined(STAPCONF_REAL_PARENT) THIS->__retvalue = current->real_parent->tgid; @@ -109,13 +85,11 @@ function ppid:long () %{ /* pure */ #endif %} -/// -/// pexecname:string() -/// pexecname -/// -/// Return the name of the parent process. -/// -/// +/** + * sfunction pexecname - Execname of the parent process. + * + * Return the name of the parent process. + */ function pexecname:string () %{ /* pure */ #if defined(STAPCONF_REAL_PARENT) strlcpy (THIS->__retvalue, current->real_parent->comm, MAXSTRINGLEN); @@ -124,46 +98,38 @@ function pexecname:string () %{ /* pure */ #endif %} -/// -/// gid:long() -/// gid -/// -/// Return the gid of the current process. -/// -/// +/** + * sfunction gid - Group ID of current process + * + * Return the gid of the current process. + */ function gid:long () %{ /* pure */ THIS->__retvalue = current->gid; %} -/// -/// egid:long() -/// egid -/// -/// Return the effective gid of the current process. -/// -/// +/** + * sfunction egid - Effective gid of the current process. + * + * Return the effective gid of the current process. + */ function egid:long () %{ /* pure */ THIS->__retvalue = current->egid; %} -/// -/// uid:long() -/// uid -/// -/// Return the uid of the current process. -/// -/// +/** + * sfunction uid -User ID of the current process. + * + * Return the uid of the current process. + */ function uid:long () %{ /* pure */ THIS->__retvalue = current->uid; %} -/// -/// euid:long() -/// euid -/// -/// Return the effective uid of the current process. -/// -/// +/** + * sfunction euid - Effective User ID of the current process. + * + * Return the effective uid of the current process. + */ function euid:long () %{ /* pure */ THIS->__retvalue = current->euid; %} @@ -173,29 +139,26 @@ function cpuid:long () %{ /* pure */ THIS->__retvalue = smp_processor_id(); %} -/// -/// cpu:long() -/// cpu -/// -/// Return the current cpu number. -/// -/// +/** + * sfunction cpu - The current cpu number. + * + * Return the current cpu number. + */ function cpu:long () %{ /* pure */ THIS->__retvalue = smp_processor_id(); %} -/// -/// print_stack(stk:string) -/// print_stack -/// -/// Perform a symbolic lookup of the addresses in the given string, -/// which is assumed to be the result of a prior call to -/// . -/// Print one line per address, including the address, the -/// name of the function containing the address, and an estimate of -/// its position within that function. Return nothing. -/// -/// +/** + * sfunction print_stack - Print out stack from string + * @stk: String with list of hexidecimal addresses. (FIXME) + * + * Perform a symbolic lookup of the addresses in the given string, + * which is assumed to be the result of a prior call to + * backtrace(). + * Print one line per address, including the address, the + * name of the function containing the address, and an estimate of + * its position within that function. Return nothing. + */ function print_stack(stk:string) %{ char *ptr = THIS->stk; char *tok = strsep(&ptr, " "); @@ -207,25 +170,21 @@ function print_stack(stk:string) %{ } %} -/// -/// pp:string() -/// pp -/// -/// Return the probe point associated with the currently running -/// probe handler, including alias and wildcard expansion effects. -/// -/// +/** + * sfunction pp - Current probe point + * + * Return the probe point associated with the currently running + * probe handler, including alias and wildcard expansion effects. + */ function pp:string () %{ /* pure */ strlcpy (THIS->__retvalue, CONTEXT->probe_point, MAXSTRINGLEN); %} -/// -/// probefunc:string() -/// probefunc -/// -/// Return the probe point's function name, if known. -/// -/// +/** + * sfunction probefunc - Function probed + * + * Return the probe point's function name, if known. + */ function probefunc:string () %{ /* pure */ char *ptr, *start; @@ -257,13 +216,11 @@ function probefunc:string () %{ /* pure */ } %} -/// -/// probemod:string() -/// probemod -/// -/// Return the probe point's module name, if known. -/// -/// +/** + * sfunction probemod - Module probed + * + * Return the probe point's module name, if known. + */ function probemod:string () %{ /* pure */ char *ptr, *start; @@ -282,27 +239,23 @@ function probemod:string () %{ /* pure */ } %} -/// -/// registers_valid:long() -/// registers_valid -/// -/// Return 1 if register() and u_register() can be used -/// in the current context, or 0 otherwise. -/// For example, registers_valid() returns 0 -/// when called from a begin or end probe. -/// -/// +/** + * sfunction registers_valid - Register information valid + * + * Return 1 if register() and u_register() can be used + * in the current context, or 0 otherwise. + * For example, registers_valid() returns 0 + * when called from a begin or end probe. + */ function registers_valid:long () %{ /* pure */ THIS->__retvalue = (CONTEXT->regs != NULL); %} -/// -/// user_mode:long() -/// user_mode -/// -/// Return 1 if the probe point occurred in user-mode. -/// -/// +/** + * sfunction user_mode - User Mode + * + * Return 1 if the probe point occurred in user-mode. + */ function user_mode:long () %{ /* pure */ /* currently a user-mode address? */ if (CONTEXT->regs) { #if defined(__i386__) || defined(__x86_64__) @@ -315,14 +268,12 @@ function user_mode:long () %{ /* pure */ /* currently a user-mode address? */ } %} -/// -/// is_return:long() -/// is_return -/// -/// Return 1 if the probe point is a return probe. -/// Deprecated. -/// -/// +/** + * sfunction is_return - Is return probe + * + * Return 1 if the probe point is a return probe. + * Deprecated. + */ function is_return:long () %{ /* pure */ if (CONTEXT->pi) THIS->__retvalue = 1; @@ -330,13 +281,11 @@ function is_return:long () %{ /* pure */ THIS->__retvalue = 0; %} -/// -/// target:long() -/// target -/// -/// Return the pid of the target process. -/// -/// +/** + * sfunction target - Target pid + * + * Return the pid of the target process. + */ function target:long () %{ /* pure */ THIS->__retvalue = _stp_target; %} @@ -363,50 +312,41 @@ function stp_pid:long () %{ /* pure */ THIS->__retvalue = _stp_pid; %} -/// -/// stack_size:long() -/// stack_size -/// -/// Return the size of the kernel stack. -/// -/// +/** + * sfunction stack_size - Size of kernel stack + * + * Return the size of the kernel stack. + */ function stack_size:long () %{ /* pure */ THIS->__retvalue = THREAD_SIZE; %} -/// -/// stack_used:long () -/// stack_used -/// -/// Return how many bytes are currently used in the kernel stack. -/// -/// +/** + * sfunction stack_used - Current amount of kernel stack used + * + * Return how many bytes are currently used in the kernel stack. + */ function stack_used:long () %{ /* pure */ char a; THIS->__retvalue = THREAD_SIZE - ((long)&a & (THREAD_SIZE-1)); %} -/// -/// stack_unused:long() -/// stack_unused -/// -/// Return how many bytes are currently available in the kernel stack. -/// -/// +/** + * sfunction stack_unused - Amount of kernel stack currently available + * + * Return how many bytes are currently available in the kernel stack. + */ function stack_unused:long () %{ /* pure */ char a; THIS->__retvalue = (long)&a & (THREAD_SIZE-1); %} -/// -/// caller_addr:long() -/// caller_addr -/// -/// Return the address of the calling function. -/// Works only for return probes at this time. -/// -/// -/// +/** + * sfunction caller_addr - Return caller address + * + * Return the address of the calling function. + * Works only for return probes at this time. + */ function caller_addr:long () %{ /* pure */ if (CONTEXT->pi) THIS->__retvalue = (int64_t)(long)_stp_ret_addr_r(CONTEXT->pi); @@ -414,14 +354,12 @@ function caller_addr:long () %{ /* pure */ THIS->__retvalue = 0; %} -/// -/// caller:string() -/// caller -/// -/// Return the address and name of the calling function. -/// Works only for return probes at this time. -/// -/// +/** + * sfunction caller - Return name and address of calling function + * + * Return the address and name of the calling function. + * Works only for return probes at this time. + */ function caller:string() %{ /* pure */ if (CONTEXT->pi) _stp_symbol_snprint( THIS->__retvalue, MAXSTRINGLEN, @@ -430,4 +368,3 @@ function caller:string() %{ /* pure */ strlcpy(THIS->__retvalue,"unknown",MAXSTRINGLEN); %} -/// -- cgit