From d2f4d7286629da6e9f1b844beefb141a4d3ef2c3 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 10 Dec 2008 20:39:45 +0100 Subject: PR6866: First pass at translating addresses to symbol names through vma. --- tapset/ChangeLog | 7 +++++++ tapset/context-symbols.stp | 8 ++++++++ tapset/context-unwind.stp | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) (limited to 'tapset') diff --git a/tapset/ChangeLog b/tapset/ChangeLog index 626ad67b..30634bcc 100644 --- a/tapset/ChangeLog +++ b/tapset/ChangeLog @@ -1,3 +1,10 @@ +2008-12-10 Mark Wielaard + + * context-symbols.stp: Define STP_NEED_TASK_FINDER_VMA. + (symbolname): New function. + * context-unwind.stp (caller): Pass current task to + _stp_symbol_snprint. + 2008-12-09 Frank Ch. Eigler PR 6961. diff --git a/tapset/context-symbols.stp b/tapset/context-symbols.stp index 79645f4f..fbb51767 100644 --- a/tapset/context-symbols.stp +++ b/tapset/context-symbols.stp @@ -11,6 +11,9 @@ #ifndef STP_NEED_SYMBOL_DATA #define STP_NEED_SYMBOL_DATA 1 #endif +#ifndef STP_NEED_TASK_FINDER_VMA +#define STP_NEED_TASK_FINDER_VMA 1 +#endif %} /** @@ -93,3 +96,8 @@ function probemod:string () %{ /* pure */ THIS->__retvalue[0] = '\0'; } %} + +function symbolname:string (addr:long) %{ /* pure */ + _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr, + current); +%} diff --git a/tapset/context-unwind.stp b/tapset/context-unwind.stp index 4c5ed34b..59d111ee 100644 --- a/tapset/context-unwind.stp +++ b/tapset/context-unwind.stp @@ -51,7 +51,8 @@ function backtrace:string () %{ /* pure */ function caller:string() %{ /* pure */ if (CONTEXT->pi) _stp_symbol_snprint( THIS->__retvalue, MAXSTRINGLEN, - (unsigned long)_stp_ret_addr_r(CONTEXT->pi)); + (unsigned long)_stp_ret_addr_r(CONTEXT->pi), + current); else strlcpy(THIS->__retvalue,"unknown",MAXSTRINGLEN); %} -- cgit From 3a5153c5590a89d6c0b70fc2c13554190b8c3be8 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 15 Dec 2008 18:04:36 +0100 Subject: context-symbols.stp (probefunc): Call _stp_symbol_snprint with current task. --- tapset/ChangeLog | 5 +++++ tapset/context-symbols.stp | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'tapset') diff --git a/tapset/ChangeLog b/tapset/ChangeLog index 30634bcc..d1d2064c 100644 --- a/tapset/ChangeLog +++ b/tapset/ChangeLog @@ -1,3 +1,8 @@ +2008-12-15 Mark Wielaard + + * context-symbols.stp (probefunc): Call _stp_symbol_snprint with + current task. + 2008-12-10 Mark Wielaard * context-symbols.stp: Define STP_NEED_TASK_FINDER_VMA. diff --git a/tapset/context-symbols.stp b/tapset/context-symbols.stp index fbb51767..bd9a93b9 100644 --- a/tapset/context-symbols.stp +++ b/tapset/context-symbols.stp @@ -11,9 +11,6 @@ #ifndef STP_NEED_SYMBOL_DATA #define STP_NEED_SYMBOL_DATA 1 #endif -#ifndef STP_NEED_TASK_FINDER_VMA -#define STP_NEED_TASK_FINDER_VMA 1 -#endif %} /** @@ -66,7 +63,7 @@ function probefunc:string () %{ /* pure */ #else ((unsigned long)REG_IP(CONTEXT->regs) >= (unsigned long)PAGE_OFFSET)) { #endif - _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, REG_IP(CONTEXT->regs)); + _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, REG_IP(CONTEXT->regs), current); if (THIS->__retvalue[0] == '.') /* powerpc symbol has a dot*/ strlcpy(THIS->__retvalue,THIS->__retvalue + 1,MAXSTRINGLEN); } else { -- cgit 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') 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 920c7355ae85ccfb2df3b93b3703619891598dc1 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-symbols.stp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tapset') diff --git a/tapset/context-symbols.stp b/tapset/context-symbols.stp index 46eab841..4a08ec60 100644 --- a/tapset/context-symbols.stp +++ b/tapset/context-symbols.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. +// %{ #ifndef STP_NEED_SYMBOL_DATA #define STP_NEED_SYMBOL_DATA 1 -- cgit From 37bb6cc0978855325f856bbd343d7dc253cf6851 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-unwind.stp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tapset') diff --git a/tapset/context-unwind.stp b/tapset/context-unwind.stp index a0836ed6..5c1253b8 100644 --- a/tapset/context-unwind.stp +++ b/tapset/context-unwind.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. +// %{ #ifndef STP_NEED_UNWIND_DATA #define STP_NEED_UNWIND_DATA 1 -- cgit From a67f272c3b053b26cb263f2eb661cb080c41575a Mon Sep 17 00:00:00 2001 From: ddomingo Date: Mon, 16 Mar 2009 14:21:51 +1000 Subject: fixed format of non-grabbable comments (for Tapset Reference Guide), added tapsetdescription for man page generator (in development) --- tapset/timestamp.stp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tapset') diff --git a/tapset/timestamp.stp b/tapset/timestamp.stp index ce8f7558..0b9d350a 100644 --- a/tapset/timestamp.stp +++ b/tapset/timestamp.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. - +// +// Each timestamp function returns a value to indicate when a function is executed. These +//returned values can then be used to indicate when an event occurred, provide an ordering for events, +//or compute the amount of time elapsed between two time stamps. +// /** * sfunction get_cycles - Processor cycle count. * -- cgit From dfef45032efa63eeb208af3f8a06b7ecf7f0d424 Mon Sep 17 00:00:00 2001 From: ddomingo Date: Mon, 16 Mar 2009 14:21:51 +1000 Subject: fixed format of non-grabbable comments (for Tapset Reference Guide), added tapsetdescription for man page generator (in development) --- tapset/memory.stp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tapset') diff --git a/tapset/memory.stp b/tapset/memory.stp index 961cca38..9dbe3fba 100644 --- a/tapset/memory.stp +++ b/tapset/memory.stp @@ -6,6 +6,9 @@ // 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. +// +// This family of probe points is used to probe memory-related events. +// %{ #include %} @@ -97,7 +100,7 @@ function addr_to_node:long(addr:long) %{ /* pure */ } %} -/* Return whether a page to be copied is a zero page. */ +// Return whether a page to be copied is a zero page. function _IS_ZERO_PAGE:long(from:long, vaddr:long) %{ /* pure */ THIS->__retvalue = (THIS->from == (long) ZERO_PAGE(THIS->vaddr)); %} -- cgit From 00db8e7c02006c1b68fb97b768cbb4a8e08d3a30 Mon Sep 17 00:00:00 2001 From: ddomingo Date: Mon, 16 Mar 2009 14:21:51 +1000 Subject: fixed format of non-grabbable comments (for Tapset Reference Guide), added tapsetdescription for man page generator (in development) --- tapset/ioscheduler.stp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'tapset') diff --git a/tapset/ioscheduler.stp b/tapset/ioscheduler.stp index d7a71aca..875ccea9 100644 --- a/tapset/ioscheduler.stp +++ b/tapset/ioscheduler.stp @@ -5,15 +5,17 @@ // 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. - +// +// This family of probe points is used to probe IO scheduler activities. +// %{ #include #include %} /** - * probe ioscheduler.elv_next_request - Retrieve request from request queue - * @elevator_name: The elevator name + * probe ioscheduler.elv_next_request - Fires when a request is retrieved from the request queue + * @elevator_name: The type of I/O elevator currently enabled */ probe ioscheduler.elv_next_request = kernel.function("elv_next_request") @@ -26,7 +28,7 @@ probe ioscheduler.elv_next_request } /** - * probe ioscheduler.elv_next_request.return - Return from retrieving a request + * probe ioscheduler.elv_next_request.return - Fires when a request retrieval issues a return signal * @req: Address of the request * @req_flags: Request flags * @disk_major: Disk major number of the request @@ -58,14 +60,14 @@ probe ioscheduler.elv_next_request.return } /** - * probe ioscheduler.elv_add_request - Add a request into request queue - * @elevator_name: The elevator name + * probe ioscheduler.elv_add_request -A request was added to the request queue + * @elevator_name: The type of I/O elevator currently enabled * @req: Address of the request * @req_flags: Request flags * @disk_major: Disk major number of the request * @disk_minor: Disk minor number of the request */ -/* when a request is added to the request queue */ +// when a request is added to the request queue probe ioscheduler.elv_add_request = kernel.function("__elv_add_request") { @@ -96,8 +98,8 @@ probe ioscheduler.elv_add_request } /** - * probe ioscheduler.elv_completed_request - Request is completed - * @elevator_name: The elevator name + * probe ioscheduler.elv_completed_request - Fires when a request is completed + * @elevator_name: The type of I/O elevator currently enabled * @req: Address of the request * @req_flags: Request flags * @disk_major: Disk major number of the request -- cgit From 2f440553d602cb3e2903803539216739b21b4c42 Mon Sep 17 00:00:00 2001 From: ddomingo Date: Mon, 16 Mar 2009 14:21:51 +1000 Subject: fixed format of non-grabbable comments (for Tapset Reference Guide), added tapsetdescription for man page generator (in development) --- tapset/scsi.stp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tapset') diff --git a/tapset/scsi.stp b/tapset/scsi.stp index 6d332e8b..8ff3dcca 100644 --- a/tapset/scsi.stp +++ b/tapset/scsi.stp @@ -5,7 +5,9 @@ // 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. - +// +// This family of probe points is used to probe SCSI activities. +// %{ #include #include @@ -21,7 +23,7 @@ * @disk_minor: The minor number of the disk (-1 if no information) * @device_state: The current state of the device. */ -/* FIXME describe the device_state */ +// FIXME describe the device_state probe scsi.ioentry = module("scsi_mod").function("scsi_prep_fn@drivers/scsi/scsi_lib.c")?, kernel.function("scsi_prep_fn@drivers/scsi/scsi_lib.c")? @@ -107,7 +109,7 @@ probe scsi.iodone * the device * @goodbytes: The bytes completed. */ -/* mid-layer processes the completed IO */ +// mid-layer processes the completed IO probe scsi.iocompleted = module("scsi_mod").function("scsi_io_completion@drivers/scsi/scsi_lib.c")?, kernel.function("scsi_io_completion@drivers/scsi/scsi_lib.c")? -- cgit From ca54881115073d5d1ebcc46d489cf51abf4ba4ac Mon Sep 17 00:00:00 2001 From: ddomingo Date: Mon, 16 Mar 2009 14:21:51 +1000 Subject: fixed format of non-grabbable comments (for Tapset Reference Guide), added tapsetdescription for man page generator (in development) --- tapset/networking.stp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tapset') diff --git a/tapset/networking.stp b/tapset/networking.stp index a147441a..f6d78536 100644 --- a/tapset/networking.stp +++ b/tapset/networking.stp @@ -5,7 +5,9 @@ // 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. - +// +// This family of probe points is used to probe the activities of the network device. +// /** * probe netdev.receive - Data recieved from network device. * @dev_name: The name of the device. e.g: eth0, ath1. @@ -49,7 +51,7 @@ /// /// /// -/* Main device receive routine, be called when packet arrives on network device */ +// Main device receive routine, be called when packet arrives on network device probe netdev.receive = kernel.function("netif_receive_skb") { @@ -67,7 +69,7 @@ probe netdev.receive * @truesize: The size of the the data to be transmitted. * */ -/* Queue a buffer for transmission to a network device */ +// Queue a buffer for transmission to a network device probe netdev.transmit = kernel.function("dev_queue_xmit") { -- cgit From 869a8e9b1bd528c8fe8b19ea502c1931fd28a7ef Mon Sep 17 00:00:00 2001 From: ddomingo Date: Mon, 16 Mar 2009 14:21:51 +1000 Subject: fixed format of non-grabbable comments (for Tapset Reference Guide), added tapsetdescription for man page generator (in development) --- tapset/tcp.stp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tapset') diff --git a/tapset/tcp.stp b/tapset/tcp.stp index 995d6abc..1375f115 100644 --- a/tapset/tcp.stp +++ b/tapset/tcp.stp @@ -7,7 +7,9 @@ // 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. - +// +// This family of probe points is used to probe events that occur in the TCP layer, +// %{ #include #include -- cgit From 3082f44232feada1111a850bfac5b2c182ced5de Mon Sep 17 00:00:00 2001 From: ddomingo Date: Mon, 16 Mar 2009 14:21:51 +1000 Subject: fixed format of non-grabbable comments (for Tapset Reference Guide), added tapsetdescription for man page generator (in development) --- tapset/udp.stp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tapset') diff --git a/tapset/udp.stp b/tapset/udp.stp index 707cf77d..f2b19a7f 100644 --- a/tapset/udp.stp +++ b/tapset/udp.stp @@ -5,7 +5,9 @@ // 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. - +// +// This family of probe points is used to probe events that occur in the UDP layer. +// %{ #include #include -- cgit From 3214f0aa1ca69297cfbffb4616c70c8118c20b5f Mon Sep 17 00:00:00 2001 From: ddomingo Date: Mon, 16 Mar 2009 14:21:52 +1000 Subject: fixed format of non-grabbable comments (for Tapset Reference Guide), added tapsetdescription for man page generator (in development) --- tapset/socket.stp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tapset') diff --git a/tapset/socket.stp b/tapset/socket.stp index 3271d4f7..93730f9f 100644 --- a/tapset/socket.stp +++ b/tapset/socket.stp @@ -5,7 +5,9 @@ // 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. - +// +// This family of probe points is used to probe socket activities. +// %{ #include #include -- cgit From b94a533da01cf4a66c7925f095659fb5732a23b3 Mon Sep 17 00:00:00 2001 From: ddomingo Date: Mon, 16 Mar 2009 14:21:52 +1000 Subject: fixed format of non-grabbable comments (for Tapset Reference Guide), added tapsetdescription for man page generator (in development) --- tapset/process.stp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tapset') diff --git a/tapset/process.stp b/tapset/process.stp index ca49aa67..e39f740a 100644 --- a/tapset/process.stp +++ b/tapset/process.stp @@ -5,7 +5,9 @@ // 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. - +// +// This family of probe points is used to probe process-related activities. +// function _IS_ERR:long(ptr:long) %{ /* pure */ THIS->__retvalue = IS_ERR((const void *)(long)THIS->ptr); -- cgit From bfa3d6708bb6ddcb27155ab3cc904b9c85a60e95 Mon Sep 17 00:00:00 2001 From: ddomingo Date: Mon, 16 Mar 2009 14:21:52 +1000 Subject: fixed format of non-grabbable comments (for Tapset Reference Guide), added tapsetdescription for man page generator (in development) --- tapset/signal.stp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'tapset') diff --git a/tapset/signal.stp b/tapset/signal.stp index 8fb6fe57..bde9160c 100644 --- a/tapset/signal.stp +++ b/tapset/signal.stp @@ -8,13 +8,15 @@ // Public License (GPL); either version 2, or (at your option) any // later version. // -// Note : Since there are so many signals sent to processes at any give -// point, it's better to filter the information according to the -// requirements. For example, filter only for a particular signal -// (if sig==2) or filter only for a particular process -// (if pid_name==stap). // - +// +// This family of probe points is used to probe signal activities. +// Since there are so many signals sent to processes at any give +// point, it's advisable to filter the information according to the +// requirements. For example, filter only for a particular signal +// (if sig==2) or filter only for a particular process +// (if pid_name==stap). +// /** * probe signal.send- Fires when a system call or kernel function sends a signal to a process. -- cgit From ecbe2ee5c2aef01d0c99256a5c9adbf2e8db16d0 Mon Sep 17 00:00:00 2001 From: ddomingo Date: Mon, 16 Mar 2009 15:32:54 +1000 Subject: minor edit --- tapset/signal.stp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tapset') diff --git a/tapset/signal.stp b/tapset/signal.stp index bde9160c..a2ebe145 100644 --- a/tapset/signal.stp +++ b/tapset/signal.stp @@ -11,11 +11,10 @@ // // // This family of probe points is used to probe signal activities. -// Since there are so many signals sent to processes at any give -// point, it's advisable to filter the information according to the +// Since there are so many signals sent to processes at any given +// point, it is advisable to filter the information according to the // requirements. For example, filter only for a particular signal -// (if sig==2) or filter only for a particular process -// (if pid_name==stap). +// (if sig==2) or for a particular process (if pid_name==stap). // /** -- cgit From 810f66c21bc8e4b1403ed57eeb4b9bfdea6ef5b9 Mon Sep 17 00:00:00 2001 From: ddomingo Date: Mon, 16 Mar 2009 16:01:28 +1000 Subject: minor edits to ensure uniformity in manpage generator --- tapset/signal.stp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tapset') diff --git a/tapset/signal.stp b/tapset/signal.stp index a2ebe145..265fd04e 100644 --- a/tapset/signal.stp +++ b/tapset/signal.stp @@ -130,24 +130,24 @@ probe _signal.send.part3 = kernel.function("send_sigqueue") * Possible __group_send_sig_info and * specific_send_sig_info return values are as follows; * - * 0 - The signal is sucessfully sent to a process, + * 0 -- The signal is sucessfully sent to a process, * which means that * <1> the signal was ignored by the receiving process, * <2> this is a non-RT signal and the system already has one queued, and * <3> the signal was successfully added to the sigqueue of the receiving process. * - * -EAGAIN - The sigqueue of the receiving process is + * -EAGAIN -- The sigqueue of the receiving process is * overflowing, the signal was RT, and the signal was sent by a user using something other * than kill() * * Possible send_group_sigqueue and * send_sigqueue return values are as follows; * - * 0 - The signal was either sucessfully added into the + * 0 -- The signal was either sucessfully added into the * sigqueue of the receiving process, or a SI_TIMER entry is already * queued (in which case, the overrun count will be simply incremented). * - * 1 - The signal was ignored by the receiving process. + * 1 -- The signal was ignored by the receiving process. * * * -1 - (send_sigqueue only) The task was marked -- cgit From 5d369d06fa39e4769fb3364ba29f588f3d995c24 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Mon, 16 Mar 2009 11:27:59 -0400 Subject: Edit signal.stp documentation comments. --- tapset/signal.stp | 174 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 105 insertions(+), 69 deletions(-) (limited to 'tapset') diff --git a/tapset/signal.stp b/tapset/signal.stp index 265fd04e..711ee70f 100644 --- a/tapset/signal.stp +++ b/tapset/signal.stp @@ -18,7 +18,7 @@ // /** - * probe signal.send- Fires when a system call or kernel function sends a signal to a process. + * probe signal.send - Signal being sent to a process * Arguments: * @sig: The number of the signal * @sig_name: A string representation of the signal @@ -28,7 +28,8 @@ * @task: A task handle to the signal recipient * @sinfo: The address of siginfo struct * @shared: Indicates whether the signal is shared by the thread group - * @send2queue- Indicates whether the signal is sent to an existing sigqueue + * @send2queue: Indicates whether the signal is sent to an existing + * sigqueue * @name: The name of the function used to send out the signal * * Context: @@ -115,14 +116,14 @@ probe _signal.send.part3 = kernel.function("send_sigqueue") } /** - * probe signal.send.return - Fires when a signal sent to a process returns. + * probe signal.send.return - Signal being sent to a process completed * @retstr: The return value to either __group_send_sig_info, - * specific_send_sig_info, or send_sigqueue. - * Refer to the Description of this probe for more information about the return - * values of each function call. + * specific_send_sig_info, + * or send_sigqueue * @shared: Indicates whether the sent signal is shared by the thread group. - * @send2queue: Indicates whether the sent signal was sent to an existing sigqueue - * @name: The name of the function used to send out the signal. + * @send2queue: Indicates whether the sent signal was sent to an + * existing sigqueue + * @name: The name of the function used to send out the signal * * Context: * The signal's sender. (correct?) @@ -233,7 +234,7 @@ probe _signal.send.part3.return = kernel.function("send_sigqueue").return } /** - * probe signal.checkperm - Fires when a permission check is performed on a sent signal + * probe signal.checkperm - Check being performed on a sent signal * @sig: The number of the signal * @sig_name: A string representation of the signal * @sig_pid: The PID of the process receiving the signal @@ -241,7 +242,8 @@ probe _signal.send.part3.return = kernel.function("send_sigqueue").return * @si_code: Indicates the signal type * @task: A task handle to the signal recipient * @sinfo: The address of the siginfo structure - * @name: Name of the probe point; default value is signal.checkperm + * @name: Name of the probe point; default value is + * signal.checkperm */ probe signal.checkperm = kernel.function("check_kill_permission") { @@ -262,6 +264,12 @@ probe signal.checkperm = kernel.function("check_kill_permission") si_code="SI_USER or SI_TIMER or SI_ASYNCIO" } +/** + * probe signal.checkperm.return - Check performed on a sent signal completed + * @name: Name of the probe point; default value is + * signal.checkperm + * @retstr: Return value as a string + */ probe signal.checkperm.return = kernel.function("check_kill_permission").return { name = "signal.checkperm" @@ -270,15 +278,15 @@ probe signal.checkperm.return = kernel.function("check_kill_permission").return /** - * probe signal.wakeup - Wakes up a sleeping process, making it ready for new active signals - * @sig_pid: The PID of the process you wish to wake - * @pid_name: Name of the process you wish to wake - * @resume: Indicates whether to wake up a task in a STOPPED or - * TRACED state + * probe signal.wakeup - Sleeping process being wakened for signal + * @sig_pid: The PID of the process to wake + * @pid_name: Name of the process to wake + * @resume: Indicates whether to wake up a task in a + * STOPPED or TRACED state * @state_mask: A string representation indicating the mask - * of task states you wish to wake. Possible values are TASK_INTERRUPTIBLE, - * TASK_STOPPED, TASK_TRACED, - * and TASK_INTERRUPTIBLE. + * of task states to wake. Possible values are + * TASK_INTERRUPTIBLE, TASK_STOPPED, + * TASK_TRACED, and TASK_INTERRUPTIBLE. */ probe signal.wakeup = kernel.function("signal_wake_up") { @@ -294,8 +302,7 @@ probe signal.wakeup = kernel.function("signal_wake_up") /** - * probe signal.check_ignored - Fires when a system call or kernel function checks whether a - * signal was ignored or not + * probe signal.check_ignored - Checking to see signal is ignored * @sig_pid: The PID of the process receiving the signal * @pid_name: Name of the process receiving the signal * @sig: The number of the signal @@ -309,6 +316,12 @@ probe signal.check_ignored = kernel.function("sig_ignored") sig_name = _signal_name($sig) } +/** + * probe signal.check_ignored.return - Check to see signal is ignored completed + * @name: Name of the probe point; default value is + * signal.checkperm + * @retstr: Return value as a string + */ probe signal.check_ignored.return = kernel.function("sig_ignored").return ? { name = "sig_ignored" @@ -334,8 +347,7 @@ probe signal.handle_stop = kernel.function("handle_stop_signal") /** - * probe signal.force_segv - Fires when a system call, kernel function, or process sent a - * SIGSEGV as a result of problems it encountered while handling a received signal + * probe signal.force_segv - Forcing send of SIGSEGV * @sig_pid: The PID of the process receiving the signal * @pid_name: Name of the process receiving the signal * @sig: The number of the signal @@ -361,6 +373,12 @@ probe _signal.force_segv.part2 = kernel.function("force_sigsegv_info") ? sig_name = _signal_name($sig) } +/** + * probe signal.force_segv.return - Forcing send of SIGSEGV complete + * @name: Name of the probe point; default value is + * force_sigsegv + * @retstr: Return value as a string + */ probe signal.force_segv.return = kernel.function("force_sigsegv").return, kernel.function("force_sigsegv_info").return ? @@ -371,9 +389,8 @@ probe signal.force_segv.return = /** - * probe signal.syskill - Fires when the kernel function sys_kill - * sends a kill signal to a process - * @pid: The PID of the process receiving the kill signal + * probe signal.syskill - Sending kill signal to a process + * @pid: The PID of the process receiving the signal * @sig: The specific signal sent to the process */ probe signal.syskill = syscall.kill @@ -381,33 +398,43 @@ probe signal.syskill = syscall.kill sig_name = _signal_name($sig) } +/** + * probe signal.syskill.return - Sending kill signal completed + */ probe signal.syskill.return = syscall.kill.return { } + /** - * probe signal.sys_tkill - Fires when tkill sends a kill signal - * to a process that is part of a thread group + * probe signal.sys_tkill - Sending a kill signal to a thread * @pid: The PID of the process receiving the kill signal * @sig: The specific signal sent to the process + * @sig_name: The specific signal sent to the process + * * The tkill call is analogous to kill(2), * except that it also allows a process within a specific thread group to - * be targetted. Such processes are targetted through their unique thread IDs (TID). + * be targetted. Such processes are targetted through their unique + * thread IDs (TID). */ probe signal.systkill = syscall.tkill { sig_name = _signal_name($sig) } +/** + * probe signal.systkill.return - Sending kill signal to a thread completed + */ probe signal.systkill.return = syscall.tkill.return { } /** - * probe signal.sys_tgkill - Fires when the kernel function tgkill - * sends a kill signal to a specific thread group + * probe signal.sys_tgkill - Sending kill signal to a thread group * @pid: The PID of the thread receiving the kill signal * @tgid: The thread group ID of the thread receiving the kill signal * @sig: The specific kill signal sent to the process + * @sig_name: A string representation of the signal + * * The tgkill call is similar to tkill, * except that it also allows the caller to specify the thread group ID of * the thread to be signalled. This protects against TID reuse. @@ -417,12 +444,15 @@ probe signal.systgkill = syscall.tgkill sig_name = _signal_name($sig) } +/** + * probe signal.sys_tgkill.return - Sending kill signal to a thread group completed + */ probe signal.systgkill.return = syscall.tgkill.return { } /** - * probe signal.send_sig_queue - Fires when a signal is queued to a process + * probe signal.send_sig_queue - Queuing a signal to a process * @sig: The queued signal * @sig_name: A string representation of the signal * @sig_pid: The PID of the process to which the signal is queued @@ -440,6 +470,10 @@ probe signal.send_sig_queue = sigqueue_addr = $q } +/** + * probe signal.send_sig_queue.return - Queuing a signal to a process completed + * @retstr: Return value as a string + */ probe signal.send_sig_queue.return = kernel.function("send_sigqueue").return, kernel.function("send_group_sigqueue").return ? @@ -449,25 +483,25 @@ probe signal.send_sig_queue.return = /** - * probe signal.pending - Fires when the SIGPENDING system call is used; - * this normally occurs when the do_sigpending kernel function is executed - * @sigset_add: The address of the user-space signal set (sigset_t) - * @sigset_size: The size of the user-space signal set. - * - * Synopsis: - * long do_sigpending(void __user *set, unsigned long sigsetsize) + * probe signal.pending - Examining pending signal + * @sigset_add: The address of the user-space signal set + * (sigset_t) + * @sigset_size: The size of the user-space signal set * * This probe is used to examine a set of signals pending for delivery - * to a specific thread. + * to a specific thread. This normally occurs when the + * do_sigpending kernel function is executed. */ -// long do_sigpending(void __user *set, unsigned long sigsetsize) - probe signal.pending = kernel.function("do_sigpending") { sigset_add=$set sigset_size=$sigsetsize } +/** + * probe signal.pending.return - Examination of pending signal completed + * @retstr: Return value as a string + */ probe signal.pending.return = kernel.function("do_sigpending").return { retstr = returnstr(1) @@ -475,22 +509,17 @@ probe signal.pending.return = kernel.function("do_sigpending").return /** - * probe signal.handle - Fires when the signal handler is invoked + * probe signal.handle - Signal handler being invoked * @sig: The signal number that invoked the signal handler * @sinfo: The address of the siginfo table - * @sig_code: The si_code value of the siginfo signal - * @ka_addr: The address of the k_sigaction table associated with the signal + * @sig_code: The si_code value of the + * siginfo signal + * @ka_addr: The address of the k_sigaction table + * associated with the signal * @oldset_addr: The address of the bitmask array of blocked signals * @regs: The address of the kernel-mode stack area * @sig_mode: Indicates whether the signal was a user-mode or kernel-mode signal - * - * Synopsis: - * static int handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, - * sigset_t *oldset, struct pt_regs * regs) */ -//static int handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, -// sigset_t *oldset, struct pt_regs * regs) - probe signal.handle = kernel.function("handle_signal") { sig = $sig @@ -509,6 +538,10 @@ probe signal.handle = kernel.function("handle_signal") sig_mode = "Kernel Mode Signal" } +/** + * probe signal.handle.return - Signal handler invocation completed + * @retstr: Return value as a string + */ probe signal.handle.return = kernel.function("handle_signal").return ? { retstr = returnstr(1) @@ -516,11 +549,12 @@ probe signal.handle.return = kernel.function("handle_signal").return ? /** - * probe signal.do_action - Initiates a trace when a thread is about to examine - * and change a signal action + * probe signal.do_action - Examining or changing a signal action * @sig: The signal to be examined/changed - * @sigact_addr: The address of the new sigaction struct associated with the signal - * @oldsigact_addr: The address of the old sigaction struct associated with the signal + * @sigact_addr: The address of the new sigaction + * struct associated with the signal + * @oldsigact_addr: The address of the old sigaction + * struct associated with the signal * @sa_handler: The new handler of the signal * @sa_mask: The new mask of the signal */ @@ -536,6 +570,10 @@ probe signal.do_action = kernel.function("do_sigaction") } } +/** + * probe signal.do_action.return - Examining or changing a signal action completed + * @retstr: Return value as a string + */ probe signal.do_action.return = kernel.function("do_sigaction").return { retstr = returnstr(1) @@ -555,16 +593,17 @@ function __get_action_mask:long(act:long) %{ /* pure */ /** - * probe signal.procmask - Initiates a trace when a thread is about to examine and change blocked signals + * probe signal.procmask - Examining or changing blocked signals * @how: Indicates how to change the blocked signals; possible values are * SIG_BLOCK=0 (for blocking signals), * SIG_UNBLOCK=1 (for unblocking signals), and * SIG_SETMASK=2 for setting the signal mask. - * @sigset_addr: The address of the signal set (sigset_t) to be implemented - * @oldsigset_addr: The old address of the signal set (sigset_t) - * @sigset: The actual value to be set for sigset_t (correct?) - * Synopsis: - * int sigprocmask(int how, sigset_t *set, sigset_t *oldset) + * @sigset_addr: The address of the signal set (sigset_t) + * to be implemented + * @oldsigset_addr: The old address of the signal set + * (sigset_t) + * @sigset: The actual value to be set for sigset_t + * (correct?) */ probe signal.procmask = kernel.function("sigprocmask") { @@ -592,16 +631,13 @@ probe signal.procmask.return = kernel.function("sigprocmask").return /** - * probe signal.flush - Fires when all pending signals for a task are flushed + * probe signal.flush - Flusing all pending signals for a task * @task: The task handler of the process performing the flush - * @sig_pid: The PID of the process associated with the task performing the flush - * @pid_name: The name of the process associated with the task performing the flush - * - * Synopsis: - * void flush_signals(struct task_struct *t) + * @sig_pid: The PID of the process associated with the task + * performing the flush + * @pid_name: The name of the process associated with the task + * performing the flush */ -//void flush_signals(struct task_struct *t) - probe signal.flush = kernel.function("flush_signals") { task = $t -- cgit From bdca08879745471fdb86991a8e7276900aaaf066 Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Mon, 16 Mar 2009 18:21:41 -0400 Subject: Add pid-based data lookup function. Two functions pid2task and pid2execname. --- tapset/task.stp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tapset') diff --git a/tapset/task.stp b/tapset/task.stp index 07337156..f1a10b0a 100644 --- a/tapset/task.stp +++ b/tapset/task.stp @@ -63,6 +63,30 @@ function task_pid:long (task:long) } +// Return the task of the given process id +function pid2task:long (pid:long) %{ /* pure */ + struct task_struct *t = NULL; + pid_t t_pid = (pid_t)(long)THIS->pid; + rcu_read_lock(); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) + t = find_task_by_vpid (t_pid); +#else + t = find_task_by_pid (t_pid); +#endif + rcu_read_unlock(); + THIS->__retvalue = (long)t; + CATCH_DEREF_FAULT(); +%} + +// Return the name of the given process id +function pid2execname:string (pid:long) { + tsk = pid2task(pid) + if (tsk) + return task_execname(tsk) + return "" +} + + // Return the thread id of the given task function task_tid:long (task:long) { -- 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') 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 ca9c813990b17f9a5d01e3f39350bcced9dc7260 Mon Sep 17 00:00:00 2001 From: ddomingo Date: Tue, 17 Mar 2009 13:48:08 +1000 Subject: further cleanup for formatting --- tapset/udp.stp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'tapset') diff --git a/tapset/udp.stp b/tapset/udp.stp index f2b19a7f..2255074a 100644 --- a/tapset/udp.stp +++ b/tapset/udp.stp @@ -17,12 +17,12 @@ /** * probe udp.sendmsg - Fires whenever a process sends a UDP message - * @name: Name of this probe - * @sock: Network socket - * @size: Number of bytes to send + * @name: The name of this probe + * @sock: Network socket used by the process + * @size: Number of bytes sent by the process * * Context: - * The process which sends a udp message + * The process which sent a UDP message */ probe udp.sendmsg = kernel.function("udp_sendmsg") { name = "udp.sendmsg" @@ -32,11 +32,11 @@ probe udp.sendmsg = kernel.function("udp_sendmsg") { /** * probe udp.sendmsg.return - Fires whenever an attempt to send a UDP message is completed - * @name: Name of this probe - * @size: Number of bytes sent + * @name: The name of this probe + * @size: Number of bytes sent by the process * * Context: - * The process which sends a udp message + * The process which sent a UDP message */ probe udp.sendmsg.return = kernel.function("udp_sendmsg").return { name = "udp.sendmsg" @@ -45,12 +45,12 @@ probe udp.sendmsg.return = kernel.function("udp_sendmsg").return { /** * probe udp.recvmsg - Fires whenever a UDP message is received - * @name: Name of this probe - * @sock: Network socket - * @size: Number of bytes received + * @name: The name of this probe + * @sock: Network socket used by the process + * @size: Number of bytes received by the process * * Context: - * The process which receives a udp message + * The process which received a UDP message */ probe udp.recvmsg = kernel.function("udp_recvmsg") { name = "udp.recvmsg" @@ -59,12 +59,12 @@ probe udp.recvmsg = kernel.function("udp_recvmsg") { } /** - * probe udp.recvmsg.return - An attempt to receive a UDP message received has been completed - * @name: Name of this probe - * @size: Number of bytes received + * probe udp.recvmsg.return - Fires whenever an attempt to receive a UDP message received is completed + * @name: The name of this probe + * @size: Number of bytes received by the process * * Context: - * The process which receives a udp message + * The process which received a UDP message */ probe udp.recvmsg.return = kernel.function("udp_recvmsg").return { name = "udp.recvmsg" @@ -72,13 +72,13 @@ probe udp.recvmsg.return = kernel.function("udp_recvmsg").return { } /** - * probe udp.disconnect - A process requests for UPD to be UDP disconnected - * @name: Name of this probe - * @sock: Network socket + * probe udp.disconnect - Fires when a process requests for a UDP disconnection + * @name: The name of this probe + * @sock: Network socket used by the process * @flags: Flags (e.g. FIN, etc) * * Context: - * The process which disconnects UDP + * The process which requests a UDP disconnection */ probe udp.disconnect = kernel.function("udp_disconnect") { name = "udp.disconnect" @@ -88,11 +88,11 @@ probe udp.disconnect = kernel.function("udp_disconnect") { /** * probe udp.disconnect.return - UDP has been disconnected successfully - * @name: Name of this probe + * @name: The name of this probe * @ret: Error code (0: no error) * * Context: - * The process which disconnects udp + * The process which requested a UDP disconnection */ probe udp.disconnect.return = kernel.function("udp_disconnect").return { name = "udp.disconnect" -- cgit From 929a278ec01bc14630d247788352a2aaab372ddd Mon Sep 17 00:00:00 2001 From: ddomingo Date: Tue, 17 Mar 2009 13:56:21 +1000 Subject: further cleanup for formatting --- tapset/scsi.stp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tapset') diff --git a/tapset/scsi.stp b/tapset/scsi.stp index 8ff3dcca..1c52355a 100644 --- a/tapset/scsi.stp +++ b/tapset/scsi.stp @@ -47,8 +47,8 @@ probe scsi.ioentry * @dev_id: The scsi device id * @device_state: The current state of the device. * @data_direction: The data_direction specifies whether this command is from/to - * the device. 0 (DMA_BIDIRECTIONAL), 1 (DMA_TO_DEVICE), - * 2 (DMA_FROM_DEVICE), 3 (DMA_NONE) + * the device. 0 (DMA_BIDIRECTIONAL), 1 (DMA_TO_DEVICE), + * 2 (DMA_FROM_DEVICE), 3 (DMA_NONE) * @request_buffer: The request buffer address * @req_bufflen: The request buffer length */ @@ -81,7 +81,7 @@ probe scsi.iodispatching * @dev_id: The scsi device id * @device_state: The current state of the device * @data_direction: The data_direction specifies whether this command is - * from/to the device. + * from/to the device. */ probe scsi.iodone = module("scsi_mod").function("scsi_done@drivers/scsi/scsi.c")?, @@ -106,7 +106,7 @@ probe scsi.iodone * @dev_id: The scsi device id * @device_state: The current state of the device * @data_direction: The data_direction specifies whether this command is from/to - * the device + * the device * @goodbytes: The bytes completed. */ // mid-layer processes the completed IO -- 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-symbols.stp | 11 ++++------- tapset/context-unwind.stp | 10 +++++----- tapset/context.stp | 5 +++-- tapset/ioscheduler.stp | 2 +- tapset/memory.stp | 8 ++++---- tapset/scsi.stp | 5 +++-- 6 files changed, 20 insertions(+), 21 deletions(-) (limited to 'tapset') diff --git a/tapset/context-symbols.stp b/tapset/context-symbols.stp index 4a08ec60..babaa3ef 100644 --- a/tapset/context-symbols.stp +++ b/tapset/context-symbols.stp @@ -22,8 +22,9 @@ * @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 + * 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. @@ -40,9 +41,7 @@ function print_stack(stk:string) %{ %} /** - * sfunction probefunc - Function probed - * - * Return the probe point's function name, if known. + * sfunction probefunc - Return the probe point's function name, if known. */ function probefunc:string () %{ /* pure */ char *ptr, *start; @@ -76,9 +75,7 @@ function probefunc:string () %{ /* pure */ %} /** - * sfunction probemod - Module probed - * - * Return the probe point's module name, if known. + * sfunction probemod - Return the probe point's module name, if known. */ function probemod:string () %{ /* pure */ char *ptr, *start; diff --git a/tapset/context-unwind.stp b/tapset/context-unwind.stp index 5c1253b8..90d4e0f4 100644 --- a/tapset/context-unwind.stp +++ b/tapset/context-unwind.stp @@ -23,7 +23,7 @@ /** * sfunction print_backtrace - Print stack back trace * - * Equivalent to print_stack(backtrace()), + * Equivalent to print_stack(backtrace()), * except that deeper stack nesting may be supported. Return nothing. */ function print_backtrace () %{ @@ -37,8 +37,8 @@ function print_backtrace () %{ /** * 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. + * Return a string of hex addresses that are a backtrace of the + * stack. Output may be truncated as per maximum string length. */ function backtrace:string () %{ /* pure */ if (CONTEXT->regs) @@ -50,7 +50,7 @@ function backtrace:string () %{ /* pure */ /** * sfunction caller - Return name and address of calling function * - * Return the address and name of the calling function. + * Return the address and name of the calling function. * Works only for return probes at this time. */ function caller:string() %{ /* pure */ @@ -64,7 +64,7 @@ function caller:string() %{ /* pure */ /** * sfunction caller_addr - Return caller address * - * Return the address of the calling function. + * Return the address of the calling function. * Works only for return probes at this time. */ function caller_addr:long () %{ /* pure */ 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. */ diff --git a/tapset/ioscheduler.stp b/tapset/ioscheduler.stp index 875ccea9..a79ae752 100644 --- a/tapset/ioscheduler.stp +++ b/tapset/ioscheduler.stp @@ -60,7 +60,7 @@ probe ioscheduler.elv_next_request.return } /** - * probe ioscheduler.elv_add_request -A request was added to the request queue + * probe ioscheduler.elv_add_request - A request was added to the request queue * @elevator_name: The type of I/O elevator currently enabled * @req: Address of the request * @req_flags: Request flags diff --git a/tapset/memory.stp b/tapset/memory.stp index 9dbe3fba..83875aa4 100644 --- a/tapset/memory.stp +++ b/tapset/memory.stp @@ -56,7 +56,7 @@ function vm_fault_contains:long (value:long, test:long) /** * probe vm.pagefault - Records that a page fault occurred. * @address: The address of the faulting memory access; i.e. the address that caused the page fault. - * @write_access: Indicates whether this was a write or read access; 1 indicates a write, + * @write_access: Indicates whether this was a write or read access; 1 indicates a write, * while 0 indicates a read. * * Context: The process which triggered the fault @@ -113,8 +113,8 @@ function _IS_ZERO_PAGE:long(from:long, vaddr:long) %{ /* pure */ * Context: * The context is the process attempting the write. * - * Fires when a process attempts to write to a shared page. - * If a copy is necessary, this will be followed by a + * Fires when a process attempts to write to a shared page. + * If a copy is necessary, this will be followed by a * vm.write_shared_copy. */ probe vm.write_shared = kernel.function("do_wp_page") { @@ -122,7 +122,7 @@ probe vm.write_shared = kernel.function("do_wp_page") { } /** - * probe vm.write_shared_copy- Page copy for shared page write. + * probe vm.write_shared_copy - Page copy for shared page write. * @address: The address of the shared write. * @zero: Boolean indicating whether it is a zero page * (can do a clear instead of a copy). diff --git a/tapset/scsi.stp b/tapset/scsi.stp index 1c52355a..f8859be2 100644 --- a/tapset/scsi.stp +++ b/tapset/scsi.stp @@ -46,8 +46,8 @@ probe scsi.ioentry * @lun: The lun number * @dev_id: The scsi device id * @device_state: The current state of the device. - * @data_direction: The data_direction specifies whether this command is from/to - * the device. 0 (DMA_BIDIRECTIONAL), 1 (DMA_TO_DEVICE), + * @data_direction: The data_direction specifies whether this command is from/to the device. + * 0 (DMA_BIDIRECTIONAL), 1 (DMA_TO_DEVICE), * 2 (DMA_FROM_DEVICE), 3 (DMA_NONE) * @request_buffer: The request buffer address * @req_bufflen: The request buffer length @@ -142,3 +142,4 @@ function get_devstate_from_req:long(var:long) sdev = @cast(var, "request_queue", "kernel:scsi_mod")->queuedata return @cast(sdev, "scsi_device", "kernel:scsi_mod")->sdev_state } +g \ No newline at end of file -- cgit From d8ad52f9739264779d2efc7dad8b7e2cfe785868 Mon Sep 17 00:00:00 2001 From: ddomingo Date: Tue, 17 Mar 2009 15:14:30 +1000 Subject: minor edits --- tapset/context-symbols.stp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tapset') diff --git a/tapset/context-symbols.stp b/tapset/context-symbols.stp index babaa3ef..a3aae408 100644 --- a/tapset/context-symbols.stp +++ b/tapset/context-symbols.stp @@ -18,7 +18,7 @@ %} // weirdness with print_stack, argument appears in build as undescribed /** - * sfunction print_stack - Print out stack from string + * 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, -- cgit From 4e7c048f5184ffcb06bc64d8be6e859156c8af97 Mon Sep 17 00:00:00 2001 From: ddomingo Date: Tue, 17 Mar 2009 15:28:43 +1000 Subject: minor edits --- tapset/socket.stp | 70 +++++++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 38 deletions(-) (limited to 'tapset') diff --git a/tapset/socket.stp b/tapset/socket.stp index 93730f9f..0f01b8d4 100644 --- a/tapset/socket.stp +++ b/tapset/socket.stp @@ -67,8 +67,8 @@ probe socket.receive = socket.recvmsg.return, ### FUNCTION SPECIFIC SEND/RECEIVE PROBES ### -/* - * probe socket.sendmsg - Message being sent on socket +/** + * probe socket.sendmsg - Message is currently being sent on a socket. * @name: Name of this probe * @size: Message size in bytes * @protocol: Protocol value @@ -95,7 +95,7 @@ probe socket.sendmsg = kernel.function ("sock_sendmsg") } /** - * probe socket.sendmsg.return - Return from Message being sent on socket + * probe socket.sendmsg.return - Return from socket.sendmsg. * @name: Name of this probe * @size: Size of message sent (in bytes) or error code if success = 0 * @protocol: Protocol value @@ -151,7 +151,7 @@ probe socket.recvmsg = kernel.function ("sock_recvmsg") type = $sock->type } -/* +/** * probe socket.recvmsg.return - Return from Message being received on socket * @name: Name of this probe * @size: Size of message received (in bytes) or error code if success = 0 @@ -198,14 +198,14 @@ probe socket.recvmsg.return = kernel.function ("sock_recvmsg").return * Fires at the beginning of sending a message on a socket * via the sock_aio_write() function */ -/* - * 2.6.9~2.6.15: - * static ssize_t sock_aio_write(struct kiocb *iocb, const char __user *ubuf, size_t size, loff_t pos); - * 2.6.16~2.6.18: - * static ssize_t sock_aio_write(struct kiocb *iocb, const char __user *ubuf, size_t count, loff_t pos); - * 2.6.19~2.6.26: - * static ssize_t sock_aio_write(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos); - */ +// +// 2.6.9~2.6.15: +// static ssize_t sock_aio_write(struct kiocb *iocb, const char __user *ubuf, size_t size, loff_t pos); +// 2.6.16~2.6.18: +// static ssize_t sock_aio_write(struct kiocb *iocb, const char __user *ubuf, size_t count, loff_t pos); +// 2.6.19~2.6.26: +// static ssize_t sock_aio_write(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos); + probe socket.aio_write = kernel.function ("sock_aio_write") { name = "socket.aio_write" @@ -272,14 +272,14 @@ probe socket.aio_write.return = kernel.function ("sock_aio_write").return * Fires at the beginning of receiving a message on a socket * via the sock_aio_read() function */ -/* - * 2.6.9~2.6.15: - * static ssize_t sock_aio_read(struct kiocb *iocb, char __user *ubuf, size_t size, loff_t pos); - * 2.6.16~2.6.18: - * static ssize_t sock_aio_read(struct kiocb *iocb, char __user *ubuf, size_t count, loff_t pos); - * 2.6.19~2.6.26: - * static ssize_t sock_aio_read(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos); - */ +// +// 2.6.9~2.6.15: +// static ssize_t sock_aio_read(struct kiocb *iocb, char __user *ubuf, size_t size, loff_t pos); +// 2.6.16~2.6.18: +// static ssize_t sock_aio_read(struct kiocb *iocb, char __user *ubuf, size_t count, loff_t pos); +// 2.6.19~2.6.26: +// static ssize_t sock_aio_read(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos); + probe socket.aio_read = kernel.function ("sock_aio_read") { name = "socket.aio_read" @@ -543,18 +543,16 @@ probe socket.close.return = kernel.function ("sock_release").return ####### PROTOCOL HELPER FUNCTIONS ######## -/* - * sock_prot_num2str - * Given a protocol number, return a string representation. +/** + * sfunction sock_prot_num2str - Given a protocol number, return a string representation. */ function sock_prot_num2str:string (proto:long) { return (proto in _prot_num2str ? _prot_num2str[proto] : "UNDEF") } -/* - * sock_prot_str2num - * Given a protocol name (string), return the corresponding protocol number. +/** + * sfunction sock_prot_str2num - Given a protocol name (string), return the corresponding protocol number. */ function sock_prot_str2num:long (proto:string) { @@ -563,18 +561,16 @@ function sock_prot_str2num:long (proto:string) ######### PROTOCOL FAMILY HELPER FUNCTIONS ########### -/* - * sock_fam_num2str - * Given a protocol family number, return a string representation. +/** + * sfunction sock_fam_num2str - Given a protocol family number, return a string representation. */ function sock_fam_num2str:string (family:long) { return (family in _fam_num2str ? _fam_num2str[family] : "UNDEF") } -/* - * sock_fam_str2num - * Given a protocol family name (string), return the corresponding +/** + * sfunction sock_fam_str2num - Given a protocol family name (string), return the corresponding * protocol family number. */ function sock_fam_str2num:long (family:string) @@ -584,18 +580,16 @@ function sock_fam_str2num:long (family:string) ######### SOCKET STATE HELPER FUNCTIONS ########## -/* - * sock_state_num2str - * Given a socket state number, return a string representation. +/** + * sfunction sock_state_num2str - Given a socket state number, return a string representation. */ function sock_state_num2str:string (state:long) { return (state in _state_num2str ? _state_num2str[state] : "UNDEF") } -/* - * sock_state_str2num - * Given a socket state string, return the corresponding state number. +/** + * sfunction sock_state_str2num - Given a socket state string, return the corresponding state number. */ function sock_state_str2num:long (state:string) { -- cgit From dcb8ea7a7d1461bef3ea56ebf65d07e8ff998a00 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 17 Mar 2009 12:50:43 +0100 Subject: Remove trailing 'g' from scsi.stp file. * tapset/scsi.stp: Remove 'g' at end of file. --- tapset/scsi.stp | 1 - 1 file changed, 1 deletion(-) (limited to 'tapset') diff --git a/tapset/scsi.stp b/tapset/scsi.stp index f8859be2..e1457739 100644 --- a/tapset/scsi.stp +++ b/tapset/scsi.stp @@ -142,4 +142,3 @@ function get_devstate_from_req:long(var:long) sdev = @cast(var, "request_queue", "kernel:scsi_mod")->queuedata return @cast(sdev, "scsi_device", "kernel:scsi_mod")->sdev_state } -g \ No newline at end of file -- cgit From 8391565d6f48a6fea6f5ea29dcc8790125039278 Mon Sep 17 00:00:00 2001 From: ddomingo Date: Wed, 18 Mar 2009 15:29:19 +1000 Subject: minor edits --- tapset/signal.stp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'tapset') diff --git a/tapset/signal.stp b/tapset/signal.stp index 711ee70f..e8470a9c 100644 --- a/tapset/signal.stp +++ b/tapset/signal.stp @@ -31,7 +31,7 @@ * @send2queue: Indicates whether the signal is sent to an existing * sigqueue * @name: The name of the function used to send out the signal - * + * * Context: * The signal's sender. * @@ -124,10 +124,10 @@ probe _signal.send.part3 = kernel.function("send_sigqueue") * @send2queue: Indicates whether the sent signal was sent to an * existing sigqueue * @name: The name of the function used to send out the signal - * + * * Context: * The signal's sender. (correct?) - * + * * Possible __group_send_sig_info and * specific_send_sig_info return values are as follows; * @@ -139,19 +139,18 @@ probe _signal.send.part3 = kernel.function("send_sigqueue") * * -EAGAIN -- The sigqueue of the receiving process is * overflowing, the signal was RT, and the signal was sent by a user using something other - * than kill() - * + * than kill(). + * * Possible send_group_sigqueue and * send_sigqueue return values are as follows; - * + * * 0 -- The signal was either sucessfully added into the * sigqueue of the receiving process, or a SI_TIMER entry is already * queued (in which case, the overrun count will be simply incremented). * * 1 -- The signal was ignored by the receiving process. * - * - * -1 - (send_sigqueue only) The task was marked + * -1 -- (send_sigqueue only) The task was marked * exiting, allowing * posix_timer_event to redirect it to the group * leader. * -- cgit From 0cf9ea606eb7677a1241595f7568dd4a6c243ef2 Mon Sep 17 00:00:00 2001 From: Mahesh J Salgaonkar Date: Fri, 20 Mar 2009 11:04:47 +0530 Subject: Removed #if defined. Format '%llx' works fine for all Arch --- tapset/aux_syscalls.stp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'tapset') diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp index d2e43903..87ea4e04 100644 --- a/tapset/aux_syscalls.stp +++ b/tapset/aux_syscalls.stp @@ -322,17 +322,10 @@ function _struct_sockaddr_u:string(uaddr:long, len:long) } else if ((sa->sa_family == AF_PACKET)&&(len == sizeof(struct sockaddr_ll))) { - /* FIXME. This needs tested */ struct sockaddr_ll *sll = (struct sockaddr_ll *)buf; -#if defined(__powerpc__) || defined(__ia64__) || defined(__s390x__) - snprintf(str, strlen, "{AF_PACKET, proto=%d, ind=%d, hatype=%d, pkttype=%d, halen=%d, addr=0x%lx}", - (int)sll->sll_protocol, sll->sll_ifindex, (int)sll->sll_hatype, (int)sll->sll_pkttype, - (int)sll->sll_halen, *(uint64_t *)sll->sll_addr); -#else snprintf(str, strlen, "{AF_PACKET, proto=%d, ind=%d, hatype=%d, pkttype=%d, halen=%d, addr=0x%llx}", (int)sll->sll_protocol, sll->sll_ifindex, (int)sll->sll_hatype, (int)sll->sll_pkttype, (int)sll->sll_halen, *(uint64_t *)sll->sll_addr); -#endif } else { -- cgit From 52064a4bd37f8d81e1f488fe9d32fe6ccee63bd7 Mon Sep 17 00:00:00 2001 From: Breno Leitao Date: Fri, 20 Mar 2009 11:40:04 -0400 Subject: Added functions to grab IP source and destination from a socket, and functions to grab TCP source and destination port from a socket. Also, used this function inside some TCP probe functions, as recvmsg, to provide a richer set of fields. --- tapset/ip.stp | 32 ++++++++++++++++++++++++++++++++ tapset/tcp.stp | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 tapset/ip.stp (limited to 'tapset') diff --git a/tapset/ip.stp b/tapset/ip.stp new file mode 100644 index 00000000..1e2e263c --- /dev/null +++ b/tapset/ip.stp @@ -0,0 +1,32 @@ +// IP tapset +// Copyright (C) 2009, IBM Inc. +// Author : Breno Leitao +// +// This file is free software. You can redistribute it and/or modify it under +// the terms of the GNU General Public License (GPL), version 2. +// +// Based on previous work done by Arnaldo Carvalho de Melo + +/** + * sfunction ip_ntop - returns a string representation from an integer IP number + * @addr: the ip represented as an integer + */ +function ip_ntop:string (addr:long) +%{ + __be32 ip; + + ip = THIS->addr; + snprintf(THIS->__retvalue, MAXSTRINGLEN, NIPQUAD_FMT, NIPQUAD(ip)); +%} + +/* return the source IP address for a given sock */ +function __ip_sock_saddr:long (sock:long) +{ + return @cast(sock, "inet_sock")->saddr +} + +/* return the destination IP address for a given sock */ +function __ip_sock_daddr:long (sock:long) +{ + return @cast(sock, "inet_sock")->daddr +} diff --git a/tapset/tcp.stp b/tapset/tcp.stp index 1375f115..bb96b0cb 100644 --- a/tapset/tcp.stp +++ b/tapset/tcp.stp @@ -73,6 +73,16 @@ function tcp_ts_get_info_state:long(sock:long) CATCH_DEREF_FAULT(); %} +/* return the TCP destination port for a given sock */ +function __tcp_sock_dport:long (sock:long){ + return @cast(sock, "inet_sock")->dport +} + +/* return the TCP source port for a given sock */ +function __tcp_sock_sport:long (sock:long){ + return @cast(sock, "inet_sock")->sport +} + global sockstate[13], sockstate_init_p function tcp_sockstate_str:string (state:long) { if (! sockstate_init_p) { @@ -182,6 +192,10 @@ probe tcp.sendmsg.return = kernel.function("tcp_sendmsg").return { * @name: Name of this probe * @sock: Network socket * @size: Number of bytes to be received + * @saddr: A string representing the source IP address + * @daddr: A string representing the destination IP address + * @sport: TCP source port + * @dport: TCP destination port * Context: * The process which receives a tcp message */ @@ -189,12 +203,20 @@ probe tcp.recvmsg = kernel.function("tcp_recvmsg") { name = "tcp.recvmsg" sock = $sk size = $len + saddr = ip_ntop(__ip_sock_saddr($sk)) + daddr = ip_ntop(__ip_sock_daddr($sk)) + sport = __tcp_sock_sport($sk) + dport = __tcp_sock_dport($sk) } /** * probe tcp.recvmsg.return - Receiving TCP message complete * @name: Name of this probe * @size: Number of bytes received or error code if an error occurred. + * @saddr: A string representing the source IP address + * @daddr: A string representing the destination IP address + * @sport: TCP source port + * @dport: TCP destination port * * Context: * The process which receives a tcp message @@ -202,6 +224,10 @@ probe tcp.recvmsg = kernel.function("tcp_recvmsg") { probe tcp.recvmsg.return = kernel.function("tcp_recvmsg").return { name = "tcp.recvmsg" size = $return + saddr = ip_ntop(__ip_sock_saddr($sk)) + daddr = ip_ntop(__ip_sock_daddr($sk)) + sport = __tcp_sock_sport($sk) + dport = __tcp_sock_dport($sk) } /** @@ -209,6 +235,10 @@ probe tcp.recvmsg.return = kernel.function("tcp_recvmsg").return { * @name: Name of this probe * @sock: Network socket * @flags: TCP flags (e.g. FIN, etc) + * @saddr: A string representing the source IP address + * @daddr: A string representing the destination IP address + * @sport: TCP source port + * @dport: TCP destination port * * Context: * The process which disconnects tcp @@ -217,6 +247,10 @@ probe tcp.disconnect = kernel.function("tcp_disconnect") { name = "tcp.disconnect" sock = $sk flags = $flags + saddr = ip_ntop(__ip_sock_saddr($sk)) + daddr = ip_ntop(__ip_sock_daddr($sk)) + sport = __tcp_sock_sport($sk) + dport = __tcp_sock_dport($sk) } /** -- cgit From 121e57ae36e2030093f72723b1fb74dc0507ddab Mon Sep 17 00:00:00 2001 From: William Cohen Date: Wed, 25 Mar 2009 18:26:01 -0400 Subject: Make aux_tapset.stp "long long" size agnostic so ia64 works. --- tapset/aux_syscalls.stp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tapset') diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp index 87ea4e04..009b0532 100644 --- a/tapset/aux_syscalls.stp +++ b/tapset/aux_syscalls.stp @@ -325,7 +325,8 @@ function _struct_sockaddr_u:string(uaddr:long, len:long) struct sockaddr_ll *sll = (struct sockaddr_ll *)buf; snprintf(str, strlen, "{AF_PACKET, proto=%d, ind=%d, hatype=%d, pkttype=%d, halen=%d, addr=0x%llx}", (int)sll->sll_protocol, sll->sll_ifindex, (int)sll->sll_hatype, (int)sll->sll_pkttype, - (int)sll->sll_halen, *(uint64_t *)sll->sll_addr); + (int)sll->sll_halen, + (long long)(*(uint64_t *)sll->sll_addr)); } else { -- cgit From 5cad2d3b056059758d44b4dd56abe37ca9c841a6 Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Mon, 30 Mar 2009 17:23:42 -0400 Subject: PR9998: adapt tapset/i686/registers.stp to latest kernel * buildrun.cxx (compile_pass): Add autoconf-x86-gs.c. * tapset/i686/registers.stp (_stp_register_regs): Update offsets. (test_x86_gs): Auxiliary function. * runtime/autoconf-x86-gs.c : New file. * testsuite/systemtap.base/x86_gs.exp : New test case. * testsuite/systemtap.base/x86_gs.stp : Ditto. --- tapset/i686/registers.stp | 50 ++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 18 deletions(-) (limited to 'tapset') diff --git a/tapset/i686/registers.stp b/tapset/i686/registers.stp index a6e5694e..997376dc 100644 --- a/tapset/i686/registers.stp +++ b/tapset/i686/registers.stp @@ -1,25 +1,39 @@ global _reg_offsets, _stp_regs_registered, _sp_offset, _ss_offset +function test_x86_gs:long() %{ /* pure */ +#ifdef STAPCONF_X86_GS + THIS->__retvalue = 1; +#else + THIS->__retvalue = 0; +#endif +%} + function _stp_register_regs() { + /* Same order as pt_regs */ - _reg_offsets["ebx"] = 0 _reg_offsets["bx"] = 0 - _reg_offsets["ecx"] = 4 _reg_offsets["cx"] = 4 - _reg_offsets["edx"] = 8 _reg_offsets["dx"] = 8 - _reg_offsets["esi"] = 12 _reg_offsets["si"] = 12 - _reg_offsets["edi"] = 16 _reg_offsets["di"] = 16 - _reg_offsets["ebp"] = 20 _reg_offsets["bp"] = 20 - _reg_offsets["eax"] = 24 _reg_offsets["ax"] = 24 - _reg_offsets["xds"] = 28 _reg_offsets["ds"] = 28 - _reg_offsets["xes"] = 32 _reg_offsets["es"] = 32 - _reg_offsets["xfs"] = 36 _reg_offsets["fs"] = 36 - _reg_offsets["orig_eax"] = 40 _reg_offsets["orig_ax"] = 40 - _reg_offsets["eip"] = 44 _reg_offsets["ip"] = 44 - _reg_offsets["xcs"] = 48 _reg_offsets["cs"] = 48 - _reg_offsets["eflags"] = 52 _reg_offsets["flags"] = 52 - _reg_offsets["esp"] = 56 _reg_offsets["sp"] = 56 - _reg_offsets["xss"] = 60 _reg_offsets["ss"] = 60 - _sp_offset = 56 - _ss_offset = 60 + _reg_offsets["ebx"] = 0 _reg_offsets["bx"] = 0 + _reg_offsets["ecx"] = 4 _reg_offsets["cx"] = 4 + _reg_offsets["edx"] = 8 _reg_offsets["dx"] = 8 + _reg_offsets["esi"] = 12 _reg_offsets["si"] = 12 + _reg_offsets["edi"] = 16 _reg_offsets["di"] = 16 + _reg_offsets["ebp"] = 20 _reg_offsets["bp"] = 20 + _reg_offsets["eax"] = 24 _reg_offsets["ax"] = 24 + _reg_offsets["xds"] = 28 _reg_offsets["ds"] = 28 + _reg_offsets["xes"] = 32 _reg_offsets["es"] = 32 + _reg_offsets["xfs"] = 36 _reg_offsets["fs"] = 36 + gs_incr = 0 +if (test_x86_gs()) { + gs_incr = 4 + _reg_offsets["xgs"] = 40 _reg_offsets["gs"] = 40 +} + _reg_offsets["orig_eax"] = 40 + gs_incr _reg_offsets["orig_ax"] = 40 + gs_incr + _reg_offsets["eip"] = 44 + gs_incr _reg_offsets["ip"] = 44 + gs_incr + _reg_offsets["xcs"] = 48 + gs_incr _reg_offsets["cs"] = 48 + gs_incr + _reg_offsets["eflags"] = 52 + gs_incr _reg_offsets["flags"] = 52 + gs_incr + _reg_offsets["esp"] = 56 + gs_incr _reg_offsets["sp"] = 56 + gs_incr + _reg_offsets["xss"] = 60 + gs_incr _reg_offsets["ss"] = 60 + gs_incr + _sp_offset = 56 + gs_incr + _ss_offset = 60 + gs_incr _stp_regs_registered = 1 } -- cgit From dc246f3c5fb0d9fdc4388e00d8ddf5d1b53a3fc8 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 31 Mar 2009 16:34:41 +0200 Subject: Add missing socket function argument descriptions. * tapsets/socket.stp: Add descriptions for proto, family and state. --- tapset/socket.stp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tapset') diff --git a/tapset/socket.stp b/tapset/socket.stp index 0f01b8d4..de778d7c 100644 --- a/tapset/socket.stp +++ b/tapset/socket.stp @@ -545,6 +545,7 @@ probe socket.close.return = kernel.function ("sock_release").return /** * sfunction sock_prot_num2str - Given a protocol number, return a string representation. + * @proto: The protocol number. */ function sock_prot_num2str:string (proto:long) { @@ -553,6 +554,7 @@ function sock_prot_num2str:string (proto:long) /** * sfunction sock_prot_str2num - Given a protocol name (string), return the corresponding protocol number. + * @proto: The protocol name. */ function sock_prot_str2num:long (proto:string) { @@ -563,6 +565,7 @@ function sock_prot_str2num:long (proto:string) /** * sfunction sock_fam_num2str - Given a protocol family number, return a string representation. + * @family: The family number. */ function sock_fam_num2str:string (family:long) { @@ -572,6 +575,7 @@ function sock_fam_num2str:string (family:long) /** * sfunction sock_fam_str2num - Given a protocol family name (string), return the corresponding * protocol family number. + * @family: The family name. */ function sock_fam_str2num:long (family:string) { @@ -582,6 +586,7 @@ function sock_fam_str2num:long (family:string) /** * sfunction sock_state_num2str - Given a socket state number, return a string representation. + * @state: The state number. */ function sock_state_num2str:string (state:long) { @@ -590,6 +595,7 @@ function sock_state_num2str:string (state:long) /** * sfunction sock_state_str2num - Given a socket state string, return the corresponding state number. + * @state: The state name. */ function sock_state_str2num:long (state:string) { -- cgit From ae65abfb3d6c807f63adb11c060b1ca56b779c02 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 1 Apr 2009 17:20:05 -0400 Subject: PR10020 sys_sigaltstack param change The new code uses a %( kernel_v < "2.6.29" %) conditional to look at the passed pt_regs instead of named *bx parameters. A more general solution will be needed at some point. --- tapset/i686/syscalls.stp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tapset') diff --git a/tapset/i686/syscalls.stp b/tapset/i686/syscalls.stp index 8e69f622..2a89c19d 100644 --- a/tapset/i686/syscalls.stp +++ b/tapset/i686/syscalls.stp @@ -119,7 +119,7 @@ probe syscall.set_zone_reclaim.return = # probe syscall.sigaltstack = kernel.function("sys_sigaltstack") { name = "sigaltstack" - ussp = %( kernel_vr < "2.6.25" %? $ebx %: $bx %) + ussp = %( kernel_vr < "2.6.25" %? $ebx %: %( kernel_vr < "2.6.29" %? $bx %: $regs->bx %) %) argstr = sprintf("%p", ussp) } probe syscall.sigaltstack.return = kernel.function("sys_sigaltstack").return { -- cgit From b2b336288ce9e92a21efe7dcd314f604bc97be29 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 2 Apr 2009 18:42:38 +0200 Subject: PR6580: Implement symname, symdata and modname context functions. This adds a couple of the suggested context/stack revamp functions from PR6580. In particular it replaces the symbolname() function that sneaked in with the pr6866 branch merge with the suggested symname(). * runtime/sym.c (_stp_mod_sec_lookup): Make section optional. (_stp_symbol_snprint): Provide a way to get optional module info. * tapset/context-symbols.stp: Replace symbolname() with symname(), add modname() and symdata(). (probemod): Implement pc based fallback. * tapset/context-unwind.stp (caller): Adjust for _stp_symbol_snprint change. * testsuite/systemtap.context/usymbols.exp: Use new symname. * testsuite/buildok/modname.stp: New test. * testsuite/buildok/symdata.stp: Likewise. * testsuite/buildok/symname.stp: Likewise. --- tapset/context-symbols.stp | 60 ++++++++++++++++++++++++++++++++++++++++------ tapset/context-unwind.stp | 2 +- 2 files changed, 54 insertions(+), 8 deletions(-) (limited to 'tapset') diff --git a/tapset/context-symbols.stp b/tapset/context-symbols.stp index 4c200aa8..66d9fea2 100644 --- a/tapset/context-symbols.stp +++ b/tapset/context-symbols.stp @@ -66,7 +66,7 @@ function probefunc:string () %{ /* pure */ #else ((unsigned long)REG_IP(CONTEXT->regs) >= (unsigned long)PAGE_OFFSET)) { #endif - _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, REG_IP(CONTEXT->regs), current); + _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, REG_IP(CONTEXT->regs), current, 0); if (THIS->__retvalue[0] == '.') /* powerpc symbol has a dot*/ strlcpy(THIS->__retvalue,THIS->__retvalue + 1,MAXSTRINGLEN); } else { @@ -89,13 +89,59 @@ function probemod:string () %{ /* pure */ while (*ptr != '"' && --len && *ptr) *dst++ = *ptr++; *dst = 0; - } else { - /* XXX: need a PC- and symbol-table-based fallback. */ - THIS->__retvalue[0] = '\0'; - } + } else if (CONTEXT->regs) { + struct _stp_module *m; + m = _stp_mod_sec_lookup (REG_IP(CONTEXT->regs), current, NULL); + if (m && m->name) + strlcpy (THIS->__retvalue, m->name, MAXSTRINGLEN); + else + strlcpy (THIS->__retvalue, "", MAXSTRINGLEN); + } else + strlcpy (THIS->__retvalue, "", MAXSTRINGLEN); %} -function symbolname:string (addr:long) %{ /* pure */ +/** + * sfunction modname - Return the kernel module name loaded at the address. + * @addr: The address. + * + * Description: Returns the module name associated with the given + * address if known. If not known it will return the string "". + * If the address was not in a kernel module, but in the kernel itself, + * then the string "kernel" will be returned. + */ +function modname:string (addr: long) %{ /* pure */ + struct _stp_module *m; + m = _stp_mod_sec_lookup (THIS->addr, current, NULL); + if (m && m->name) + strlcpy (THIS->__retvalue, m->name, MAXSTRINGLEN); + else + strlcpy (THIS->__retvalue, "", MAXSTRINGLEN); +%} + +/** + * sfunction symname - Return the symbol associated with the given address. + * @addr: The address to translate. + * + * Description: Returns the (function) symbol name associated with the + * given address if known. If not known it will return the hex string + * representation of addr. + */ +function symname:string (addr: long) %{ /* pure */ + _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr, + current, 0); +%} + +/** + * sfunction symdata - Return the symbol and module offset for the address. + * @addr: The address to translate. + * + * Description: Returns the (function) symbol name associated with the + * given address if known, plus the module name (between brackets) and + * the offset inside the module, plus the size of the symbol function. + * If any element is not known it will be ommitted and if the symbol name + * is unknown it will return the hex string for the given address. + */ +function symdata:string (addr: long) %{ /* pure */ _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr, - current); + current, 1); %} diff --git a/tapset/context-unwind.stp b/tapset/context-unwind.stp index a976f8b6..b3d19e29 100644 --- a/tapset/context-unwind.stp +++ b/tapset/context-unwind.stp @@ -57,7 +57,7 @@ function caller:string() %{ /* pure */ if (CONTEXT->pi) _stp_symbol_snprint( THIS->__retvalue, MAXSTRINGLEN, (unsigned long)_stp_ret_addr_r(CONTEXT->pi), - current); + current, 0); else strlcpy(THIS->__retvalue,"unknown",MAXSTRINGLEN); %} -- cgit From 08dc41a50c508544bc18d384a65a137056a98195 Mon Sep 17 00:00:00 2001 From: Eugene Teo Date: Fri, 3 Apr 2009 23:18:14 +0800 Subject: Improvements to errno tapset This adds an errno_p() function that will return an absolute errno if it is valid, or zero if it is not. It also simplifies the if statement in the errno_str() function. --- tapset/errno.stp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'tapset') diff --git a/tapset/errno.stp b/tapset/errno.stp index eda9bff1..011ff7e2 100644 --- a/tapset/errno.stp +++ b/tapset/errno.stp @@ -345,12 +345,20 @@ static const int Maxerrno = sizeof(errlist)/sizeof(char *); function errno_str:string (err:long) %{ /* pure */ long e = THIS->err; - if (e < 0 && e > -Maxerrno && errlist[-e]) - strlcpy (THIS->__retvalue, errlist[-e], MAXSTRINGLEN); - else if (e > 0 && e < Maxerrno && errlist[e]) + e = (e > 0 ? e : -e); + if (e > 0 && e < Maxerrno && errlist[e]) strlcpy (THIS->__retvalue, errlist[e], MAXSTRINGLEN); %} +function errno_p:long (err:long) %{ /* pure */ + long e = THIS->err; + e = (e > 0 ? e : -e); + if (e > 0 && e < Maxerrno && errlist[e]) + THIS->__retvalue = e; + else + THIS->__retvalue = 0; +%} + %{ static long _stp_returnval(struct pt_regs *regs) { if (regs) { -- cgit From 8e6c3aa3d61109b0276e96cdbc9ffdde60a5ac0a Mon Sep 17 00:00:00 2001 From: Eugene Teo Date: Fri, 3 Apr 2009 23:46:43 +0800 Subject: New ANSI escape sequences tapset This adds a new tapset for ANSI escape sequences. It is based on an existing tapset that was written by Masami Hiramatsu for the stapgames project. This also adds a version of ansi_color.stp script that displays other attributes other than the bold effect. --- tapset/ansi.stp | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 tapset/ansi.stp (limited to 'tapset') diff --git a/tapset/ansi.stp b/tapset/ansi.stp new file mode 100644 index 00000000..0152fb37 --- /dev/null +++ b/tapset/ansi.stp @@ -0,0 +1,70 @@ +# ANSI escape sequences tapset +# Copyright (C) 2009 Red Hat, Inc., Eugene Teo +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# Based on some previous work done by Masami Hiramatsu for stapgames. +# Reference: http://en.wikipedia.org/wiki/ANSI_escape_code +# + +function ansi_clear_screen() { + print("\033[1;1H\033[J") +} + +# Foreground colors | Background colors +# Black 30 | Black 40 +# Blue 34 | Red 41 +# Green 32 | Green 42 +# Cyan 36 | Yellow 43 +# Red 31 | Blue 44 +# Purple 35 | Magenta 45 +# Brown 33 | Cyan 46 +# Light Gray 37 | White 47 +function ansi_set_color(fg:long) { + printf("\033[%dm", fg) +} + +function ansi_set_color2(fg:long, bg:long) { + printf("\033[%d;%dm", bg, fg) +} + +# All attributes off 0 +# Intensity: Bold 1 +# Underline: Single 4 +# Blink: Slow 5 +# Blink: Rapid 6 +# Image: Negative 7 +function ansi_set_color3(fg:long, bg:long, attr:long) { + attr_str = attr ? sprintf(";%dm", attr) : "m" + printf("\033[%d;%d%s", bg, fg, attr_str) +} + +function ansi_reset_color() { + ansi_set_color3(0, 0, 0) +} + +function ansi_new_line() { + printf("\12") +} + +function ansi_cursor_move(x:long, y:long) { + printf("\033[%d;%dH", y, x) +} + +function ansi_cursor_hide() { + print("\033[>5I") +} + +function ansi_cursor_save() { + print("\033[s") +} + +function ansi_cursor_restore() { + print("\033[u") +} + +function ansi_cursor_show() { + print("\033[>5h") +} -- cgit From fc204b30292a3a5f1aa602171dc44d937cb2c20f Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 7 Apr 2009 12:25:53 +0200 Subject: Create usymname and usymdata variant that trigger STP_NEED_VMA_TRACKER. * tapset/context-symbols.stp (syname, symdata): Pass NULL for kernel address. * tapset/ucontext-symbols.stp: New file defining usymname and usymdata. * testsuite/systemtap.context/usymbols.exp: Use usymname, remove STP_NEED_VMA_TRACKER hack. * testsuite/buildok/usymdata.stp: New test. * testsuite/buildok/usymname.stp: Likewise. --- tapset/context-symbols.stp | 4 ++-- tapset/ucontext-symbols.stp | 52 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 tapset/ucontext-symbols.stp (limited to 'tapset') diff --git a/tapset/context-symbols.stp b/tapset/context-symbols.stp index 66d9fea2..783f1b7b 100644 --- a/tapset/context-symbols.stp +++ b/tapset/context-symbols.stp @@ -128,7 +128,7 @@ function modname:string (addr: long) %{ /* pure */ */ function symname:string (addr: long) %{ /* pure */ _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr, - current, 0); + NULL, 0); %} /** @@ -143,5 +143,5 @@ function symname:string (addr: long) %{ /* pure */ */ function symdata:string (addr: long) %{ /* pure */ _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr, - current, 1); + NULL, 1); %} diff --git a/tapset/ucontext-symbols.stp b/tapset/ucontext-symbols.stp new file mode 100644 index 00000000..3813a8bf --- /dev/null +++ b/tapset/ucontext-symbols.stp @@ -0,0 +1,52 @@ +// User context symbols tapset +// Copyright (C) 2009 Red Hat Inc. +// +// This file is part of systemtap, and is free software. You can +// 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. + +// +// User context symbol functions provide additional information about +// addresses from an application. These functions can provide +// information about the user space map (library) that the event occured or +// the function symbol of an address. +// + +%{ +#ifndef STP_NEED_SYMBOL_DATA +#define STP_NEED_SYMBOL_DATA 1 +#endif +#ifndef STP_NEED_VMA_TRACKER +#define STP_NEED_VMA_TRACKER 1 +#endif +%} + +/** + * sfunction usymname - Return the symbol of an address in the current task. + * @addr: The address to translate. + * + * Description: Returns the (function) symbol name associated with the + * given address if known. If not known it will return the hex string + * representation of addr. + */ +function usymname:string (addr: long) %{ /* pure */ + _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr, + current, 0); +%} + +/** + * sfunction usymdata - Return the symbol and module offset of an address. + * @addr: The address to translate. + * + * Description: Returns the (function) symbol name associated with the + * given address in the current task if known, plus the module name + * (between brackets) and the offset inside the module (shared library), + * plus the size of the symbol function. If any element is not known it + * will be ommitted and if the symbol name is unknown it will return the + * hex string for the given address. + */ +function usymdata:string (addr: long) %{ /* pure */ + _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr, + current, 1); +%} -- 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') 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 d5cd287f7860df8752f93de93fcd1cc68884d56b Mon Sep 17 00:00:00 2001 From: David Smith Date: Thu, 9 Apr 2009 12:06:05 -0500 Subject: Uses when available. 2009-04-09 David Smith * buildrun.cxx (compile_pass): Compile autoconf test for . * runtime/autoconf-asm-syscall.c: New "autoconf" test the presence of . * runtime/syscall.h: If exists, use it. Otherwise, use our private copy of the functions for each architecture. (syscall_get_nr): Renamed from __stp_user_syscall_nr(). (syscall_get_return_value): Renamed from __stp_user_syscall_return_value(). (syscall_get_arguments): Renamed from __stp_user_syscall_arg(). * runtime/task_finder.c (__stp_utrace_task_finder_target_syscall_exit): Uses new syscall.h functions. * tapset/utrace.stp: Ditto. --- tapset/utrace.stp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tapset') diff --git a/tapset/utrace.stp b/tapset/utrace.stp index 34cb32c5..00f427e6 100644 --- a/tapset/utrace.stp +++ b/tapset/utrace.stp @@ -6,13 +6,15 @@ %} function _utrace_syscall_nr:long () %{ - THIS->__retvalue = __stp_user_syscall_nr(CONTEXT->regs); /* pure */ + THIS->__retvalue = syscall_get_nr(current, CONTEXT->regs); /* pure */ %} function _utrace_syscall_arg:long (n:long) %{ - THIS->__retvalue = *__stp_user_syscall_arg(current, CONTEXT->regs, (int)THIS->n); /* pure */ + unsigned long arg = 0; /* pure */ + syscall_get_arguments(current, CONTEXT->regs, (int)THIS->n, 1, &arg); + THIS->__retvalue = arg; %} function _utrace_syscall_return:long () %{ - THIS->__retvalue = *__stp_user_syscall_return_value(current, CONTEXT->regs); /* pure */ + THIS->__retvalue = syscall_get_return_value(current, CONTEXT->regs); /* pure */ %} -- cgit From 5e868ddd8263d2f7b61a702891252cc2bacb1c07 Mon Sep 17 00:00:00 2001 From: Andre Detsch Date: Tue, 14 Apr 2009 14:23:59 -0300 Subject: Add new TCP and IP functions This patch adds some basic functions to the IP and TCP tapsets. Mainly, it's possible to get the iphdr and tcphdr from a sk_buff structure. As a consequence, a TCP probe called tcp.receive() was created and is probed every time a TCP packet is received, and a lot of useful fields is available, as the TCP flags. Also a small example that works like tcpdump for received TCP packets was created. This patch was tested on x86 and ppc machines, on 2.6.18 kernel and also on mainline one. Signed-off-by: Breno Leitao Signed-off-by: Andre Detsch Signed-off-by: Josh Stone --- tapset/ip.stp | 46 ++++++++++++++++++++++++++++ tapset/tcp.stp | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) (limited to 'tapset') diff --git a/tapset/ip.stp b/tapset/ip.stp index 1e2e263c..299d88d2 100644 --- a/tapset/ip.stp +++ b/tapset/ip.stp @@ -7,6 +7,10 @@ // // Based on previous work done by Arnaldo Carvalho de Melo +%{ +#include +%} + /** * sfunction ip_ntop - returns a string representation from an integer IP number * @addr: the ip represented as an integer @@ -30,3 +34,45 @@ function __ip_sock_daddr:long (sock:long) { return @cast(sock, "inet_sock")->daddr } + +/* Get the IP header for recent (> 2.6.21) kernels */ +function __get_skb_iphdr_new:long(skb:long) +%{ /* pure */ + struct sk_buff *skb; + skb = (struct sk_buff *)(long)THIS->skb; + /* as done by skb_network_header() */ + #ifdef NET_SKBUFF_DATA_USES_OFFSET + THIS->__retvalue = (long)(kread(&(skb->head)) + kread(&(skb->network_header))); + #else + THIS->__retvalue = (long)kread(&(skb->network_header)); + #endif + CATCH_DEREF_FAULT(); +%} + +/* Get the IP header from a sk_buff struct */ +function __get_skb_iphdr:long(skb:long){ +%( kernel_v < "2.6.21" %? + iphdr = @cast(skb, "sk_buff")->nh->raw + return iphdr +%: + return __get_skb_iphdr_new(skb) +%) +} + +/* return the source next layer protocol for a given sk_buff structure */ +function __ip_skb_proto:long (iphdr) +{ + return @cast(iphdr, "iphdr")->protocol +} + +/* return the source IP address for a given sk_buff structure */ +function __ip_skb_saddr:long (iphdr) +{ + return @cast(iphdr, "iphdr")->saddr +} + +/* return the destination IP address for a given skb */ +function __ip_skb_daddr:long (iphdr) +{ + return @cast(iphdr, "iphdr")->daddr +} diff --git a/tapset/tcp.stp b/tapset/tcp.stp index bb96b0cb..2c5dce7e 100644 --- a/tapset/tcp.stp +++ b/tapset/tcp.stp @@ -15,6 +15,7 @@ #include #include #include +#include %} // Get retransmission timeout in usecs. RTO is initialized from default @@ -78,6 +79,70 @@ function __tcp_sock_dport:long (sock:long){ return @cast(sock, "inet_sock")->dport } +/* returns the TCP header for recent (<2.6.21) kernel */ +function __get_skb_tcphdr_new:long(skb:long) +%{ /* pure */ + struct sk_buff *skb; + skb = (struct sk_buff *)(long)THIS->skb; + /* as done by skb_transport_header() */ + #ifdef NET_SKBUFF_DATA_USES_OFFSET + THIS->__retvalue = (long)(kread(&(skb->head)) + kread(&(skb->transport_header))); + #else + THIS->__retvalue = (long)kread(&(skb->transport_header)); + #endif + CATCH_DEREF_FAULT(); +%} + +/* returns the TCP header for a given sk_buff structure */ +function __get_skb_tcphdr:long(skb:long){ +%( kernel_v < "2.6.21" %? + tcphdr = @cast(skb, "sk_buff")->h->raw + return tcphdr +%: + return __get_skb_tcphdr_new(skb) +%) +} + +/* returns TCP URG flag for a given sk_buff structure */ +function __tcp_skb_urg:long (tcphdr){ + return @cast(tcphdr, "tcphdr")->urg +} + +/* returns TCP ACK flag for a given sk_buff structure */ +function __tcp_skb_ack:long (tcphdr){ + return @cast(tcphdr, "tcphdr")->ack +} + +/* returns TCP PSH flag for a given sk_buff structure */ +function __tcp_skb_psh:long (tcphdr){ + return @cast(tcphdr, "tcphdr")->psh +} + +/* returns TCP RST flag for a given sk_buff structure */ +function __tcp_skb_rst:long (tcphdr){ + return @cast(tcphdr, "tcphdr")->rst +} + +/* returns TCP SYN flag for a given sk_buff structure */ +function __tcp_skb_syn:long (tcphdr){ + return @cast(tcphdr, "tcphdr")->syn +} + +/* returns TCP FIN flag for a given sk_buff structure */ +function __tcp_skb_fin:long (tcphdr){ + return @cast(tcphdr, "tcphdr")->fin +} + +/* returns TCP source port for a given sk_buff structure */ +function __tcp_skb_sport:long (tcphdr){ + return ntohs(@cast(tcphdr, "tcphdr")->source) +} + +/* returns TCP destination port for a given sk_buff structure */ +function __tcp_skb_dport:long (tcphdr){ + return @cast(tcphdr, "tcphdr")->dest +} + /* return the TCP source port for a given sock */ function __tcp_sock_sport:long (sock:long){ return @cast(sock, "inet_sock")->sport @@ -300,3 +365,32 @@ probe tcp.setsockopt.return = kernel.function("tcp_setsockopt").return { ret = $return } +/** + * probe tcp.receive - Called when a TCP packet is received + * @saddr: A string representing the source IP address + * @daddr: A string representing the destination IP address + * @sport: TCP source port + * @dport: TCP destination port + * @urg: TCP URG flag + * @ack: TCP ACK flag + * @psh: TCP PSH flag + * @rst: TCP RST flag + * @syn: TCP SYN flag + * @fin: TCP FIN flag + */ +probe tcp.receive = kernel.function("tcp_v4_rcv") { + iphdr = __get_skb_iphdr($skb) + saddr = ip_ntop(__ip_skb_saddr(iphdr)) + daddr = ip_ntop(__ip_skb_daddr(iphdr)) + protocol = __ip_skb_proto(iphdr) + + tcphdr = __get_skb_tcphdr($skb) + dport = __tcp_skb_dport(tcphdr) + sport = __tcp_skb_sport(tcphdr) + urg = __tcp_skb_urg(tcphdr) + ack = __tcp_skb_ack(tcphdr) + psh = __tcp_skb_psh(tcphdr) + rst = __tcp_skb_rst(tcphdr) + syn = __tcp_skb_syn(tcphdr) + fin = __tcp_skb_fin(tcphdr) +} -- cgit From 1f65cc4ffd1bd362b10d7f07d1cb9c4e7de68027 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 14 Apr 2009 12:34:12 -0700 Subject: PR9953: split up the two process.* tapsets The overlapping process.* tapsets are now separated. Those probe points documented in stapprobes(3stap) remain the same. Those that were formerly in stapprobes.process(3stap) have been renamed to kprocess, to reflect their kernel perspective on processes. --- tapset/DEVGUIDE | 6 +-- tapset/kprocess.stp | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tapset/process.stp | 115 ---------------------------------------------------- 3 files changed, 118 insertions(+), 118 deletions(-) create mode 100644 tapset/kprocess.stp delete mode 100644 tapset/process.stp (limited to 'tapset') diff --git a/tapset/DEVGUIDE b/tapset/DEVGUIDE index e6bc3fb8..693521a8 100644 --- a/tapset/DEVGUIDE +++ b/tapset/DEVGUIDE @@ -59,8 +59,8 @@ For example, process execs can occur in either the do_execve() or the compat_do_execve() functions. The following alias inserts probes at the beginning of those functions: -probe process.exec = kernel.function("do_execve"), - kernel.function("compat_do_execve") { +probe kprocess.exec = kernel.function("do_execve"), + kernel.function("compat_do_execve") { < probe body > } @@ -87,7 +87,7 @@ process is retrieved by calling task_pid() and passing it the task_struct pointer. In this case, the auxiliary function is an embedded C function that's defined in the task tapset (task.stp). -probe process.create = kernel.function("copy_process").return { +probe kprocess.create = kernel.function("copy_process").return { task = $return new_pid = task_pid(task) } diff --git a/tapset/kprocess.stp b/tapset/kprocess.stp new file mode 100644 index 00000000..316e03ce --- /dev/null +++ b/tapset/kprocess.stp @@ -0,0 +1,115 @@ +// kernel process tapset +// Copyright (C) 2006 Intel Corporation. +// +// This file is part of systemtap, and is free software. You can +// 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. +// +// This family of probe points is used to probe process-related activities. +// + +function _IS_ERR:long(ptr:long) %{ /* pure */ + THIS->__retvalue = IS_ERR((const void *)(long)THIS->ptr); +%} + + +/** + * probe kprocess.create - Fires whenever a new process is successfully created + * @new_pid: The PID of the newly created process + * + * Context: + * Parent of the created process. + * + * Fires whenever a new process is successfully created, either as a result of + * fork (or one of its syscall variants), or a new kernel thread. + */ +probe kprocess.create = kernel.function("copy_process").return { + task = $return + if (_IS_ERR(task)) next + new_pid = task_pid(task) +} + + +/** + * probe kprocess.start - Starting new process + * + * Context: + * Newly created process. + * + * Fires immediately before a new process begins execution. + * + */ +probe kprocess.start = kernel.function("schedule_tail") { } + + +/** + * probe kprocess.exec - Attempt to exec to a new program + * @filename: The path to the new executable + * + * Context: + * The caller of exec. + * + * Fires whenever a process attempts to exec to a new program. + */ +probe kprocess.exec = + kernel.function("do_execve"), + kernel.function("compat_do_execve") ? +{ + filename = kernel_string($filename) +} + + +/** + * probe kprocess.exec_complete - Return from exec to a new program + * @errno: The error number resulting from the exec + * @success: A boolean indicating whether the exec was successful + * + * Context: + * On success, the context of the new executable. + * On failure, remains in the context of the caller. + * + * Fires at the completion of an exec call. + */ +probe kprocess.exec_complete = + kernel.function("do_execve").return, + kernel.function("compat_do_execve").return ? +{ + errno = $return + success = (errno >= 0) +} + + +/** + * probe kprocess.exit - Exit from process + * @code: The exit code of the process + * + * Context: + * The process which is terminating. + * + * Fires when a process terminates. This will always be followed by a + * kprocess.release, though the latter may be delayed if the process waits in a + * zombie state. + */ +probe kprocess.exit = kernel.function("do_exit") { + code = $code +} + + +/** + * probe kprocess.release - Process released + * @task: A task handle to the process being released + * @pid: PID of the process being released + * + * Context: + * The context of the parent, if it wanted notification of this process' + * termination, else the context of the process itself. + * + * Fires when a process is released from the kernel. This always follows a + * kprocess.exit, though it may be delayed somewhat if the process waits in a + * zombie state. + */ +probe kprocess.release = kernel.function("release_task") { + task = $p + pid = $p->pid; +} diff --git a/tapset/process.stp b/tapset/process.stp deleted file mode 100644 index e39f740a..00000000 --- a/tapset/process.stp +++ /dev/null @@ -1,115 +0,0 @@ -// process tapset -// Copyright (C) 2006 Intel Corporation. -// -// This file is part of systemtap, and is free software. You can -// 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. -// -// This family of probe points is used to probe process-related activities. -// - -function _IS_ERR:long(ptr:long) %{ /* pure */ - THIS->__retvalue = IS_ERR((const void *)(long)THIS->ptr); -%} - - -/** - * probe process.create - Fires whenever a new process is successfully created - * @new_pid: The PID of the newly created process - * - * Context: - * Parent of the created process. - * - * Fires whenever a new process is successfully created, either as a result of - * fork (or one of its syscall variants), or a new kernel thread. - */ -probe process.create = kernel.function("copy_process").return { - task = $return - if (_IS_ERR(task)) next - new_pid = task_pid(task) -} - - -/** - * probe process.start - Starting new process - * - * Context: - * Newly created process. - * - * Fires immediately before a new process begins execution. - * - */ -probe process.start = kernel.function("schedule_tail") { } - - -/** - * probe process.exec - Attempt to exec to a new program - * @filename: The path to the new executable - * - * Context: - * The caller of exec. - * - * Fires whenever a process attempts to exec to a new program. - */ -probe process.exec = - kernel.function("do_execve"), - kernel.function("compat_do_execve") ? -{ - filename = kernel_string($filename) -} - - -/** - * probe process.exec_complete - Return from exec to a new program - * @errno: The error number resulting from the exec - * @success: A boolean indicating whether the exec was successful - * - * Context: - * On success, the context of the new executable. - * On failure, remains in the context of the caller. - * - * Fires at the completion of an exec call. - */ -probe process.exec_complete = - kernel.function("do_execve").return, - kernel.function("compat_do_execve").return ? -{ - errno = $return - success = (errno >= 0) -} - - -/** - * probe process.exit - Exit from process - * @code: The exit code of the process - * - * Context: - * The process which is terminating. - * - * Fires when a process terminates. This will always be followed by a - * process.release, though the latter may be delayed if the process waits in a - * zombie state. - */ -probe process.exit = kernel.function("do_exit") { - code = $code -} - - -/** - * probe process.release - Process released - * @task: A task handle to the process being released - * @pid: PID of the process being released - * - * Context: - * The context of the parent, if it wanted notification of this process' - * termination, else the context of the process itself. - * - * Fires when a process is released from the kernel. This always follows a - * process.exit, though it may be delayed somewhat if the process waits in a - * zombie state. - */ -probe process.release = kernel.function("release_task") { - task = $p - pid = $p->pid; -} -- cgit From ee0dfa16f900396f4fd89d4d765e877daa8a2c19 Mon Sep 17 00:00:00 2001 From: David Smith Date: Fri, 17 Apr 2009 09:26:08 -0500 Subject: Avoid sign extension in syscall return values. 2009-04-17 David Smith * tapset/utrace.stp: Cast the return value of syscall_get_return_value() to an unsigned long to avoid sign extension. --- tapset/utrace.stp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'tapset') diff --git a/tapset/utrace.stp b/tapset/utrace.stp index 00f427e6..0d26ed5f 100644 --- a/tapset/utrace.stp +++ b/tapset/utrace.stp @@ -1,20 +1,26 @@ /* utrace-only subset of register accessors */ - %{ #include "syscall.h" %} -function _utrace_syscall_nr:long () %{ - THIS->__retvalue = syscall_get_nr(current, CONTEXT->regs); /* pure */ +function _utrace_syscall_nr:long () %{ /* pure */ + THIS->__retvalue = syscall_get_nr(current, CONTEXT->regs); %} -function _utrace_syscall_arg:long (n:long) %{ - unsigned long arg = 0; /* pure */ - syscall_get_arguments(current, CONTEXT->regs, (int)THIS->n, 1, &arg); - THIS->__retvalue = arg; +function _utrace_syscall_arg:long (n:long) %{ /* pure */ + unsigned long arg = 0; + syscall_get_arguments(current, CONTEXT->regs, (int)THIS->n, 1, &arg); + THIS->__retvalue = arg; %} -function _utrace_syscall_return:long () %{ - THIS->__retvalue = syscall_get_return_value(current, CONTEXT->regs); /* pure */ +function _utrace_syscall_return:long () %{ /* pure */ + /* + * Here's the reason for the "unsigned long" cast. Since all + * values inside systemtap are 64-bit numbers, return values were + * getting sign extended. This caused return values to not match + * up with the same values passes as arguments. + */ + THIS->__retvalue = (unsigned long)syscall_get_return_value(current, + CONTEXT->regs); %} -- cgit From 47a2a2303c9b261e88a4333bf2964b4291a22a12 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 20 Apr 2009 22:43:37 +0200 Subject: Pass task from tapset, through stack and unwind functions for lookup. * runtime/stack-arm.c (__stp_stack_print): Take struct task_struct *. * runtime/stack-ia64.c (__stp_stack_print): Likewise. * runtime/stack-ppc64.c (__stp_stack_print): Likewise. * runtime/stack-s390.c (__stp_stack_print): Likewise. * runtime/stack-i386.c (__stp_stack_print): Likewise. And add check and pass to unwind() and _stp_func_print(). * runtime/stack-x86_64.c: Likewise. * runtime/stack.c *_stp_stack_print): Take and pass on task_struct. (_stp_stack_snprint): Likewise. * runtime/unwind.c (unwind): Take and use task_struct for _stp_mod_sec_lookup(). * tapset/context-unwind.stp (print_backtrace): Pass NULL to _stp_stack_print(). (backtrace): Pass NULL to _stp_stack_snprint(). --- tapset/context-unwind.stp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tapset') diff --git a/tapset/context-unwind.stp b/tapset/context-unwind.stp index b3d19e29..f1e99dc8 100644 --- a/tapset/context-unwind.stp +++ b/tapset/context-unwind.stp @@ -28,7 +28,7 @@ */ function print_backtrace () %{ if (CONTEXT->regs) { - _stp_stack_print(CONTEXT->regs, 1, CONTEXT->pi, MAXTRACE); + _stp_stack_print(CONTEXT->regs, 1, CONTEXT->pi, MAXTRACE, NULL); } else { _stp_printf("Systemtap probe: %s\n", CONTEXT->probe_point); } @@ -42,7 +42,7 @@ function print_backtrace () %{ */ function backtrace:string () %{ /* pure */ if (CONTEXT->regs) - _stp_stack_snprint (THIS->__retvalue, MAXSTRINGLEN, CONTEXT->regs, 0, CONTEXT->pi, MAXTRACE); + _stp_stack_snprint (THIS->__retvalue, MAXSTRINGLEN, CONTEXT->regs, 0, CONTEXT->pi, MAXTRACE, NULL); else strlcpy (THIS->__retvalue, "", MAXSTRINGLEN); %} -- cgit From 6094e1992123454047c79ce724475c49e834d218 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 21 Apr 2009 16:45:31 +0200 Subject: Remove documentation weirdness FIXME in tapset print_stack(). Weirdness was fixed in commit d4db5608. * tapset/context-symbols.stp (print_stack): Remove FIXME. --- tapset/context-symbols.stp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tapset') diff --git a/tapset/context-symbols.stp b/tapset/context-symbols.stp index 783f1b7b..e4406d9b 100644 --- a/tapset/context-symbols.stp +++ b/tapset/context-symbols.stp @@ -16,10 +16,10 @@ #define STP_NEED_SYMBOL_DATA 1 #endif %} -// weirdness with print_stack, argument appears in build as undescribed + /** * sfunction print_stack - Print out stack from string. - * @stk: String with list of hexidecimal addresses. (FIXME) + * @stk: String with list of hexidecimal addresses. * * Perform a symbolic lookup of the addresses in the given string, * which is assumed to be the result of a prior call to -- cgit From c45319065d6e3ae91ae833f7afbf0edba6c87d89 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 21 Apr 2009 17:16:51 +0200 Subject: Add ubacktrace(), print_ustack() and print_ubacktrace(). * runtime/sym.c (_stp_usymbol_print): New function. * tapset/ucontext-unwind.stp (print_ubacktrace): New tapset function. (ubacktrace): Likewise. * tapset/ucontext-symbols.stp (print_ustack): Likewise. * testsuite/buildok/ustack.stp: New test for above three functions. --- tapset/ucontext-symbols.stp | 23 ++++++++++++++++++++ tapset/ucontext-unwind.stp | 52 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 tapset/ucontext-unwind.stp (limited to 'tapset') diff --git a/tapset/ucontext-symbols.stp b/tapset/ucontext-symbols.stp index 3813a8bf..2e7ad25b 100644 --- a/tapset/ucontext-symbols.stp +++ b/tapset/ucontext-symbols.stp @@ -50,3 +50,26 @@ function usymdata:string (addr: long) %{ /* pure */ _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr, current, 1); %} + +/** + * sfunction print_ustack - Print out stack for the current task from string. + * @stk: String with list of hexidecimal addresses for the current task. + * + * Perform a symbolic lookup of the addresses in the given string, + * which is assumed to be the result of a prior call to + * ubacktrace() for the current task. + * + * 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_ustack(stk:string) %{ + char *ptr = THIS->stk; + char *tok = strsep(&ptr, " "); + while (tok && *tok) { + _stp_print_char(' '); + _stp_usymbol_print (simple_strtol(tok, NULL, 16), current); + _stp_print_char('\n'); + tok = strsep(&ptr, " "); + } +%} diff --git a/tapset/ucontext-unwind.stp b/tapset/ucontext-unwind.stp new file mode 100644 index 00000000..b70f6da7 --- /dev/null +++ b/tapset/ucontext-unwind.stp @@ -0,0 +1,52 @@ +// User context unwind tapset +// Copyright (C) 2009 Red Hat Inc. +// +// This file is part of systemtap, and is free software. You can +// 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. + +%{ +#ifndef STP_NEED_UNWIND_DATA +#define STP_NEED_UNWIND_DATA 1 +#endif +#ifndef STP_NEED_SYMBOL_DATA +#define STP_NEED_SYMBOL_DATA 1 +#endif +#ifndef STP_NEED_VMA_TRACKER +#define STP_NEED_VMA_TRACKER 1 +#endif +%} + +/** + * sfunction print_ubacktrace - Print stack back trace for current task. + * + * Equivalent to print_ustack(ubacktrace()), + * except that deeper stack nesting may be supported. Return nothing. + */ +function print_ubacktrace () %{ + if (CONTEXT->regs) { + _stp_stack_print(CONTEXT->regs, 1, CONTEXT->pi, MAXTRACE, + current); + } else { + _stp_printf("Systemtap probe: %s\n", CONTEXT->probe_point); + } +%} + +/** + * sfunction ubacktrace - Hex backtrace of current task stack. + * + * Return a string of hex addresses that are a backtrace of the + * stack of the current task. Output may be truncated as per maximum + * string length. Returns empty string when current probe point cannot + * determine user backtrace. + */ + +function ubacktrace:string () %{ /* pure */ + if (CONTEXT->regs) + _stp_stack_snprint (THIS->__retvalue, MAXSTRINGLEN, + CONTEXT->regs, 0, CONTEXT->pi, MAXTRACE, + current); + else + strlcpy (THIS->__retvalue, "", MAXSTRINGLEN); +%} -- cgit From 7d7f074398802c84f544e263995ce15874b9f408 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 21 Apr 2009 19:57:02 +0200 Subject: Mark ucontext tapset functions EXPERIMENTAL. * tapset/ucontext-symbols.stp (usymname, usymdata, print_ustack): mark EXPERIMENTAL. * tapset/ucontext-unwind.stp (print_ubacktrace, ubacktrace): Likewise. --- tapset/ucontext-symbols.stp | 6 +++--- tapset/ucontext-unwind.stp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'tapset') diff --git a/tapset/ucontext-symbols.stp b/tapset/ucontext-symbols.stp index 2e7ad25b..5502f5cd 100644 --- a/tapset/ucontext-symbols.stp +++ b/tapset/ucontext-symbols.stp @@ -23,7 +23,7 @@ %} /** - * sfunction usymname - Return the symbol of an address in the current task. + * sfunction usymname - Return the symbol of an address in the current task. EXPERIMENTAL! * @addr: The address to translate. * * Description: Returns the (function) symbol name associated with the @@ -36,7 +36,7 @@ function usymname:string (addr: long) %{ /* pure */ %} /** - * sfunction usymdata - Return the symbol and module offset of an address. + * sfunction usymdata - Return the symbol and module offset of an address. EXPERIMENTAL! * @addr: The address to translate. * * Description: Returns the (function) symbol name associated with the @@ -52,7 +52,7 @@ function usymdata:string (addr: long) %{ /* pure */ %} /** - * sfunction print_ustack - Print out stack for the current task from string. + * sfunction print_ustack - Print out stack for the current task from string. EXPERIMENTAL! * @stk: String with list of hexidecimal addresses for the current task. * * Perform a symbolic lookup of the addresses in the given string, diff --git a/tapset/ucontext-unwind.stp b/tapset/ucontext-unwind.stp index b70f6da7..0801f1c9 100644 --- a/tapset/ucontext-unwind.stp +++ b/tapset/ucontext-unwind.stp @@ -19,7 +19,7 @@ %} /** - * sfunction print_ubacktrace - Print stack back trace for current task. + * sfunction print_ubacktrace - Print stack back trace for current task. EXPERIMENTAL! * * Equivalent to print_ustack(ubacktrace()), * except that deeper stack nesting may be supported. Return nothing. @@ -34,7 +34,7 @@ function print_ubacktrace () %{ %} /** - * sfunction ubacktrace - Hex backtrace of current task stack. + * sfunction ubacktrace - Hex backtrace of current task stack. EXPERIMENTAL! * * Return a string of hex addresses that are a backtrace of the * stack of the current task. Output may be truncated as per maximum -- 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') 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 9b89b6525b9e2cce69231b6613862b3cc93939c7 Mon Sep 17 00:00:00 2001 From: Przemyslaw Pawelczyk Date: Sat, 25 Apr 2009 17:18:24 +0200 Subject: Correct fd variable name in fadvise64 probe points. * tapset/syscalls.stp: Rename fs variable to fd. --- tapset/syscalls.stp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tapset') diff --git a/tapset/syscalls.stp b/tapset/syscalls.stp index 256174d3..a215dc12 100644 --- a/tapset/syscalls.stp +++ b/tapset/syscalls.stp @@ -733,7 +733,7 @@ probe syscall.faccessat.return = kernel.function("SyS_faccessat").return !, probe syscall.fadvise64 = kernel.function("SyS_fadvise64") !, kernel.function("sys_fadvise64") ? { name = "fadvise64" - fs = $fd + fd = $fd offset = $offset len = $len advice = $advice @@ -751,7 +751,7 @@ probe syscall.fadvise64.return = kernel.function("SyS_fadvise64").return !, probe syscall.fadvise64_64 = kernel.function("SyS_fadvise64_64") !, kernel.function("sys_fadvise64_64") ? { name = "fadvise64_64" - fs = $fd + fd = $fd offset = $offset len = $len advice = $advice @@ -771,7 +771,7 @@ probe syscall.fadvise64_64.return = kernel.function("SyS_fadvise64_64").return ! probe syscall.fadvise64 = kernel.function("SyS_fadvise64") !, kernel.function("sys_fadvise64") { name = "fadvise64" - fs = 0 + fd = 0 offset = 0 len = 0 advice = 0 @@ -789,7 +789,7 @@ probe syscall.fadvise64.return = kernel.function("SyS_fadvise64").return !, probe syscall.fadvise64_64 = kernel.function("SyS_fadvise64_64") !, kernel.function("sys_fadvise64_64") { name = "fadvise64_64" - fs = 0 + fd = 0 offset = 0 len = 0 advice = 0 -- cgit From 40fc3e43cea224623400ac07b6f03c700d209dec Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Mon, 27 Apr 2009 04:34:42 -0400 Subject: Add function of returning the char in given position of string * tapset/string.stp: New function stringat. * testsuite/systemtap.printf/char1.exp: Update test case. * testsuite/systemtap.printf/char1.stp: Ditto. --- tapset/string.stp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tapset') diff --git a/tapset/string.stp b/tapset/string.stp index 2f43aecc..35ee9fa2 100644 --- a/tapset/string.stp +++ b/tapset/string.stp @@ -25,6 +25,18 @@ function substr:string(str:string,start:long, length:long) %{ /* pure */ strlcpy(THIS->__retvalue, THIS->str + THIS->start, length); %} +/** @addtogroup library +* @code function stringat:string(str:string, pos:long) @endcode +* @param str string +* @param pos the given position. 0 = start of the string +* @return Returns the char in given position of string. +*/ +function stringat:long(str:string, pos:long) %{ /* pure */ + if (THIS->pos >= 0 && THIS->pos < strlen(THIS->str)) + THIS->__retvalue = THIS->str[THIS->pos]; + else + THIS->__retvalue = 0; +%} /** @addtogroup library * @code isinstr:long(s1:string,s2:string) @endcode -- cgit From 193ef171ea2cb656f1fe68898d13a40caa1625c2 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 28 Apr 2009 00:24:34 +0200 Subject: Make sure user_string_n() results are always zero terminated strings. * tapset/conversions.stp (user_string_n2): Explicitly null terminate return string. (user_string_n_warn): Likewise. --- tapset/conversions.stp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tapset') diff --git a/tapset/conversions.stp b/tapset/conversions.stp index 70725e9d..31b16821 100644 --- a/tapset/conversions.stp +++ b/tapset/conversions.stp @@ -120,6 +120,8 @@ function user_string_n2:string (addr:long, n:long, err_msg:string) %{ /* pure */ (char __user *) (uintptr_t) THIS->addr, len) < 0) strlcpy(THIS->__retvalue, THIS->err_msg, MAXSTRINGLEN); + else + THIS->__retvalue[len - 1] = '\0'; %} function user_string_n_warn:string (addr:long, n:long) %{ /* pure */ @@ -137,7 +139,8 @@ function user_string_n_warn:string (addr:long, n:long) %{ /* pure */ (void *) (uintptr_t) THIS->addr); _stp_warn(CONTEXT->error_buffer); strlcpy (THIS->__retvalue, "", MAXSTRINGLEN); - } + } else + THIS->__retvalue[len - 1] = '\0'; %} function user_string_n_quoted:string (addr:long, n:long) %{ /* pure */ -- cgit From ea7d087ab3866eb99c19444b237c9586e8dc9b17 Mon Sep 17 00:00:00 2001 From: Ananth N Mavinakayanahalli Date: Thu, 30 Apr 2009 17:00:38 +0530 Subject: PR10007: Avoid probing syscall entry points in the testsuite. While there, fix minor issues with the s390x syscall tapset. --- tapset/s390x/syscalls.stp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'tapset') diff --git a/tapset/s390x/syscalls.stp b/tapset/s390x/syscalls.stp index 07cb0577..17988ace 100644 --- a/tapset/s390x/syscalls.stp +++ b/tapset/s390x/syscalls.stp @@ -45,19 +45,21 @@ probe syscall.ipc.return = kernel.function("sys_ipc").return ? { # long old_mmap(struct mmap_arg_struct __user *arg) # long old32_mmap(struct mmap_arg_struct_emu31 __user *arg) # -probe syscall.mmap = kernel.function("old_mmap"), - kernel.function("old32_mmap") +probe syscall.mmap = kernel.function("old_mmap") ?, + kernel.function("old32_mmap") ?, + kernel.function("SyS_s390_old_mmap") ? { name = "mmap" - if (probefunc() == "old_mmap") + if ((probefunc() == "old_mmap") || (probefunc() == "SyS_s390_old_mmap")) argstr = get_mmap_args($arg) else argstr = get_32mmap_args($arg) } -probe syscall.mmap.return = kernel.function("old_mmap").return, - kernel.function("old32_mmap").return +probe syscall.mmap.return = kernel.function("old_mmap").return ?, + kernel.function("old32_mmap").return ?, + kernel.function("SyS_s390_old_mmap").return ? { name = "mmap" retstr = returnstr(2) @@ -69,19 +71,21 @@ probe syscall.mmap.return = kernel.function("old_mmap").return, # long sys_mmap2(struct mmap_arg_struct __user *arg) # long sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg) # -probe syscall.mmap2 = kernel.function("sys_mmap2"), - kernel.function("sys32_mmap2") +probe syscall.mmap2 = kernel.function("sys_mmap2") ?, + kernel.function("sys32_mmap2") ?, + kernel.function("SyS_mmap2") ? { name = "mmap2" - if (probefunc() == "sys_mmap2") + if ((probefunc() == "sys_mmap2") || (probefunc() == "SyS_mmap2")) argstr = get_mmap_args($arg) else argstr = get_32mmap_args($arg) } -probe syscall.mmap2.return = kernel.function("sys_mmap2").return, - kernel.function("sys32_mmap2").return +probe syscall.mmap2.return = kernel.function("sys_mmap2").return ?, + kernel.function("sys32_mmap2").return ?, + kernel.function("SyS_mmap2").return ? { name = "mmap2" retstr = returnstr(2) -- 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') 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') 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 From 90562d7d561c26b25aa73082bd33eaa399688187 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 13 May 2009 12:51:38 +0200 Subject: Implement caller:string() in terms of symname() and caller_addr(). * tapset/context-unwind.stp (caller): Implement as stap function using symname(), caller_addr() and sprintf(). --- tapset/context-unwind.stp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'tapset') diff --git a/tapset/context-unwind.stp b/tapset/context-unwind.stp index f1e99dc8..d6654d25 100644 --- a/tapset/context-unwind.stp +++ b/tapset/context-unwind.stp @@ -51,16 +51,13 @@ function backtrace:string () %{ /* pure */ * sfunction caller - Return name and address of calling function * * Return the address and name of the calling function. + * This is equivalent to calling: + * sprintf("%s 0x%x", symname(caller_addr(), caller_addr())) * Works only for return probes at this time. */ -function caller:string() %{ /* pure */ - if (CONTEXT->pi) - _stp_symbol_snprint( THIS->__retvalue, MAXSTRINGLEN, - (unsigned long)_stp_ret_addr_r(CONTEXT->pi), - current, 0); - else - strlcpy(THIS->__retvalue,"unknown",MAXSTRINGLEN); -%} +function caller:string() { + return sprintf("%s 0x%x", symname(caller_addr()), caller_addr()); +} /** * sfunction caller_addr - Return caller address -- cgit From 4315a3e938ac70ae9ab435cc609b8291a93feaf4 Mon Sep 17 00:00:00 2001 From: Sunzen Wang Date: Thu, 14 May 2009 11:24:04 +0200 Subject: Fix inconsistent indentation for including header file in aux_syscalls.stp. * tapset/aux_syscalls.stp: Don't indent #include . --- tapset/aux_syscalls.stp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tapset') diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp index 009b0532..9cb7a3df 100644 --- a/tapset/aux_syscalls.stp +++ b/tapset/aux_syscalls.stp @@ -60,10 +60,10 @@ function _struct_timezone_u:string(uaddr:long) %} %{ - // Needed for the following four functions - // _struct_utimbuf_actime, _struct_utimbuf_modtime, - // _struct_compat_utimbuf_actime, _struct_compat_utimbuf_modtime - #include +// Needed for the following four functions +// _struct_utimbuf_actime, _struct_utimbuf_modtime, +// _struct_compat_utimbuf_actime, _struct_compat_utimbuf_modtime +#include %} // Returns the value of the actime field of a utimbuf in user space -- cgit