From bc06a632db6ac4634b95c98f3ff355c89d9e20db Mon Sep 17 00:00:00 2001 From: ddomingo Date: Mon, 16 Mar 2009 14:21:50 +1000 Subject: fixed format of non-grabbable comments (for Tapset Reference Guide), added tapsetdescription for man page generator (in development) --- tapset/context.stp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tapset/context.stp') diff --git a/tapset/context.stp b/tapset/context.stp index 7fd961c8..f4b0207a 100644 --- a/tapset/context.stp +++ b/tapset/context.stp @@ -6,7 +6,11 @@ // 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. - +// +// 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. +// /** * sfunction print_regs - Print a register dump. */ -- cgit From d518b0c2e446ff74096e5cd00b00f39220485909 Mon Sep 17 00:00:00 2001 From: ddomingo Date: Tue, 17 Mar 2009 13:42:34 +1000 Subject: minor edits --- tapset/context.stp | 70 +++++++++++++++++------------------------------------- 1 file changed, 22 insertions(+), 48 deletions(-) (limited to 'tapset/context.stp') diff --git a/tapset/context.stp b/tapset/context.stp index f4b0207a..66ca813f 100644 --- a/tapset/context.stp +++ b/tapset/context.stp @@ -21,37 +21,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) @@ -62,9 +53,7 @@ function ppid:long () %{ /* pure */ %} /** - * sfunction pexecname - Execname of the parent process. - * - * Return the name of the parent process. + * sfunction pexecname - Returns the execname of a target process's parent process. */ function pexecname:string () %{ /* pure */ #if defined(STAPCONF_REAL_PARENT) @@ -75,9 +64,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 @@ -88,9 +75,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 @@ -101,9 +86,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 @@ -114,9 +97,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 @@ -132,26 +113,23 @@ 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 register() and u_register() in current context. * * Return 1 if register() and u_register() can be used * in the current context, or 0 otherwise. @@ -163,7 +141,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. */ @@ -180,7 +158,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. * Deprecated. @@ -193,9 +171,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; @@ -224,18 +200,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; @@ -243,9 +217,9 @@ 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; -- cgit From 83b85c2b0be729352bae4ea204d814b377b32fcf Mon Sep 17 00:00:00 2001 From: ddomingo Date: Tue, 17 Mar 2009 15:13:23 +1000 Subject: minor edits --- tapset/context.stp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tapset/context.stp') diff --git a/tapset/context.stp b/tapset/context.stp index 66ca813f..9f4be0e6 100644 --- a/tapset/context.stp +++ b/tapset/context.stp @@ -120,7 +120,8 @@ function cpu:long () %{ /* pure */ %} /** - * sfunction pp - 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. */ @@ -217,7 +218,7 @@ function stack_used:long () %{ /* pure */ %} /** - * sfunction stack_unused - Returns the amount of kernel stack currently available + * sfunction stack_unused - Returns the amount of kernel stack currently available. * * Determines how many bytes are currently available in the kernel stack. */ -- cgit From 48cde708db9e1662047def94c2dfd7ffe28aa765 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 8 Apr 2009 10:59:27 +0200 Subject: Add uaddr() context tapset function. * tapset/context.stp (uaddr): New sfunction. * testsuite/buildok/uaddr.stp: New test. --- tapset/context.stp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'tapset/context.stp') diff --git a/tapset/context.stp b/tapset/context.stp index 9f4be0e6..36d68c8d 100644 --- a/tapset/context.stp +++ b/tapset/context.stp @@ -11,6 +11,11 @@ //provide information such as a backtrace to where the event occured and the current register values for the //processor. // + +%{ +#include +%} + /** * sfunction print_regs - Print a register dump. */ @@ -227,3 +232,23 @@ function stack_unused:long () %{ /* pure */ THIS->__retvalue = (long)&a & (THREAD_SIZE-1); %} +/** + * sfunction uaddr - User space address of current running task. + * + * 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. + */ +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; +%} + -- cgit From 4fecf7f1c9fd8ae54ff13677c710b75a10d8cc91 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 23 Apr 2009 16:06:21 +0200 Subject: Mark uaddr tapset function as EXPERIMENTAL. * tapset/context.stp (uaddr): Marked as experimental. Add FIXME for vdso tracking bug #10080. --- tapset/context.stp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tapset/context.stp') diff --git a/tapset/context.stp b/tapset/context.stp index 36d68c8d..6fad3740 100644 --- a/tapset/context.stp +++ b/tapset/context.stp @@ -233,12 +233,14 @@ function stack_unused:long () %{ /* pure */ %} /** - * sfunction uaddr - User space address of current running task. + * 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. + * 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; -- cgit From 3ba2eb82cafa938c1c3f7ef9d2da06912a49d8e0 Mon Sep 17 00:00:00 2001 From: David Smith Date: Thu, 30 Apr 2009 10:20:41 -0500 Subject: Fixed uaddr tapset function for ppc64 by adding task_pt_regs() definition. PR10117 fix. * tapset/context.stp: Added ppc64 task_pt_regs() definition if it dooesn't already exist. --- tapset/context.stp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tapset/context.stp') diff --git a/tapset/context.stp b/tapset/context.stp index 6fad3740..fcb60201 100644 --- a/tapset/context.stp +++ b/tapset/context.stp @@ -14,6 +14,12 @@ %{ #include + +#if defined(__powerpc64__) +#if !defined(task_pt_regs) +#define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.regs) +#endif +#endif %} /** -- cgit From e361ac2bdb6f1996e020a5612cec71762b556e25 Mon Sep 17 00:00:00 2001 From: Malte Nuhn Date: Fri, 8 May 2009 12:20:33 -0400 Subject: context tapset: sid() function to return task session leader pid --- tapset/context.stp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tapset/context.stp') diff --git a/tapset/context.stp b/tapset/context.stp index fcb60201..5d855f80 100644 --- a/tapset/context.stp +++ b/tapset/context.stp @@ -63,6 +63,18 @@ function ppid:long () %{ /* pure */ #endif %} +/** + * 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. */ -- cgit