diff options
author | David Smith <dsmith@redhat.com> | 2009-05-21 16:57:04 -0500 |
---|---|---|
committer | David Smith <dsmith@redhat.com> | 2009-05-21 16:57:04 -0500 |
commit | c8e9eb18d8d13d099a4a177fe53de507c1d9ce8b (patch) | |
tree | ab2388afb795ed1a7ead2fbbf8b9d1b368a8231f /tapset/context.stp | |
parent | dd9a3bcbef65bde65491d959e9458bc641924811 (diff) | |
parent | 3863e7999255deeaa7f8f4bba7df893773812537 (diff) | |
download | systemtap-steved-c8e9eb18d8d13d099a4a177fe53de507c1d9ce8b.tar.gz systemtap-steved-c8e9eb18d8d13d099a4a177fe53de507c1d9ce8b.tar.xz systemtap-steved-c8e9eb18d8d13d099a4a177fe53de507c1d9ce8b.zip |
Merge commit 'origin/master' into pr7043
Conflicts:
runtime/print.c
runtime/transport/transport.c
runtime/transport/transport_msgs.h
Diffstat (limited to 'tapset/context.stp')
-rw-r--r-- | tapset/context.stp | 120 |
1 files changed, 72 insertions, 48 deletions
diff --git a/tapset/context.stp b/tapset/context.stp index 7fd961c8..5d855f80 100644 --- a/tapset/context.stp +++ b/tapset/context.stp @@ -6,6 +6,21 @@ // redistribute it and/or modify it under the terms of the GNU General // Public License (GPL); either version 2, or (at your option) any // later version. +// <tapsetdescription> +// Context functions provide additional information about where an event occurred. These functions can +//provide information such as a backtrace to where the event occured and the current register values for the +//processor. +// </tapsetdescription> + +%{ +#include <asm/processor.h> + +#if defined(__powerpc64__) +#if !defined(task_pt_regs) +#define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.regs) +#endif +#endif +%} /** * sfunction print_regs - Print a register dump. @@ -17,37 +32,28 @@ function print_regs () %{ %} /** - * sfunction execname - Execname of current processes - * - * Return the name of the current process. + * sfunction execname - Returns the execname of a target process (or group of processes). */ function execname:string () %{ /* pure */ strlcpy (THIS->__retvalue, current->comm, MAXSTRINGLEN); %} /** - * sfunction pid - Process ID of current process - * - * - * Return the id of the current process. + * sfunction pid - Returns the ID of a target process. */ function pid:long () %{ /* pure */ THIS->__retvalue = current->tgid; %} /** - * sfunction tid - Thread ID of current process - * - * Return the id of the current thread. + * sfunction tid - Returns the thread ID of a target process. */ function tid:long () %{ /* pure */ THIS->__retvalue = current->pid; %} /** - * sfunction ppid - Parent Process ID of current process - * - * Return the id of the parent process. + * sfunction ppid - Returns the process ID of a target process's parent process. */ function ppid:long () %{ /* pure */ #if defined(STAPCONF_REAL_PARENT) @@ -58,9 +64,19 @@ function ppid:long () %{ /* pure */ %} /** - * sfunction pexecname - Execname of the parent process. - * - * Return the name of the parent process. + * sfunction sid - Returns the session ID of the current process. + * + * The session ID of a process is the process group ID of the session + * leader. Session ID is stored in the signal_struct since Kernel 2.6.0. + */ +function sid:long () %{ /* pure */ + struct signal_struct *ss = kread( &(current->signal) ); + THIS->__retvalue = kread ( &(ss->session) ); + CATCH_DEREF_FAULT(); +%} + +/** + * sfunction pexecname - Returns the execname of a target process's parent process. */ function pexecname:string () %{ /* pure */ #if defined(STAPCONF_REAL_PARENT) @@ -71,9 +87,7 @@ function pexecname:string () %{ /* pure */ %} /** - * sfunction gid - Group ID of current process - * - * Return the gid of the current process. + * sfunction gid - Returns the group ID of a target process. */ function gid:long () %{ /* pure */ #ifdef STAPCONF_TASK_UID @@ -84,9 +98,7 @@ function gid:long () %{ /* pure */ %} /** - * sfunction egid - Effective gid of the current process. - * - * Return the effective gid of the current process. + * sfunction egid - Returns the effective gid of a target process. */ function egid:long () %{ /* pure */ #ifdef STAPCONF_TASK_UID @@ -97,9 +109,7 @@ function egid:long () %{ /* pure */ %} /** - * sfunction uid -User ID of the current process. - * - * Return the uid of the current process. + * sfunction uid - Returns the user ID of a target process. */ function uid:long () %{ /* pure */ #ifdef STAPCONF_TASK_UID @@ -110,9 +120,7 @@ function uid:long () %{ /* pure */ %} /** - * sfunction euid - Effective User ID of the current process. - * - * Return the effective uid of the current process. + * sfunction euid - Return the effective uid of a target process. */ function euid:long () %{ /* pure */ #ifdef STAPCONF_TASK_UID @@ -128,26 +136,24 @@ function cpuid:long () %{ /* pure */ %} /** - * sfunction cpu - The current cpu number. - * - * Return the current cpu number. + * sfunction cpu - Returns the current cpu number. */ function cpu:long () %{ /* pure */ THIS->__retvalue = smp_processor_id(); %} /** - * sfunction pp - Current probe point - * - * Return the probe point associated with the currently running - * probe handler, including alias and wildcard expansion effects. + * sfunction pp - Return the probe point associated with the currently running probe handler, + * including alias and wildcard expansion effects + * Context: + * The current probe point. */ function pp:string () %{ /* pure */ strlcpy (THIS->__retvalue, CONTEXT->probe_point, MAXSTRINGLEN); %} /** - * sfunction registers_valid - Register information valid + * sfunction registers_valid - Determines validity of <command>register()</command> and <command>u_register()</command> in current context. * * Return 1 if register() and u_register() can be used * in the current context, or 0 otherwise. @@ -159,7 +165,7 @@ function registers_valid:long () %{ /* pure */ %} /** - * sfunction user_mode - User Mode + * sfunction user_mode - Determines if probe point occurs in user-mode. * * Return 1 if the probe point occurred in user-mode. */ @@ -176,7 +182,7 @@ function user_mode:long () %{ /* pure */ /* currently a user-mode address? */ %} /** - * sfunction is_return - Is return probe + * sfunction is_return - Determines if probe point is a return probe. * * Return 1 if the probe point is a return probe. * <emphasis>Deprecated.</emphasis> @@ -189,9 +195,7 @@ function is_return:long () %{ /* pure */ %} /** - * sfunction target - Target pid - * - * Return the pid of the target process. + * sfunction target - Return the process ID of the target process. */ function target:long () %{ /* pure */ THIS->__retvalue = _stp_target; @@ -220,18 +224,16 @@ function stp_pid:long () %{ /* pure */ %} /** - * sfunction stack_size - Size of kernel stack - * - * Return the size of the kernel stack. + * sfunction stack_size - Return the size of the kernel stack. */ function stack_size:long () %{ /* pure */ THIS->__retvalue = THREAD_SIZE; %} /** - * sfunction stack_used - Current amount of kernel stack used + * sfunction stack_used - Returns the amount of kernel stack used. * - * Return how many bytes are currently used in the kernel stack. + * Determines how many bytes are currently used in the kernel stack. */ function stack_used:long () %{ /* pure */ char a; @@ -239,12 +241,34 @@ function stack_used:long () %{ /* pure */ %} /** - * sfunction stack_unused - Amount of kernel stack currently available + * sfunction stack_unused - Returns the amount of kernel stack currently available. * - * Return how many bytes are currently available in the kernel stack. + * Determines how many bytes are currently available in the kernel stack. */ function stack_unused:long () %{ /* pure */ char a; THIS->__retvalue = (long)&a & (THREAD_SIZE-1); %} +/** + * sfunction uaddr - User space address of current running task. EXPERIMENTAL. + * + * Description: Returns the address in userspace that the current + * task was at when the probe occured. When the current running task + * isn't a user space thread, or the address cannot be found, zero + * is returned. Can be used to see where the current task is combined + * with usymname() or symdata(). Often the task will be in the VDSO + * where it entered the kernel. FIXME - need VDSO tracking support #10080. + */ +function uaddr:long () %{ /* pure */ + int64_t addr = 0; + if (current->mm) + { + struct pt_regs *uregs; + uregs = task_pt_regs(current); + if (uregs) + addr = (int64_t) REG_IP(uregs); + } + THIS->__retvalue = addr; +%} + |