diff options
-rw-r--r-- | doc/SystemTap_Tapset_Reference/tapsets.tmpl | 20 | ||||
-rw-r--r-- | doc/Tapset_Reference_Guide/en-US/Tapset_Dev_Guide.xml | 18 | ||||
-rw-r--r-- | doc/Tapset_Reference_Guide/manpager.sh | 103 | ||||
-rw-r--r-- | runtime/loc2c-runtime.h | 14 | ||||
-rw-r--r-- | runtime/staprun/mainloop.c | 8 | ||||
-rw-r--r-- | runtime/task_finder.c | 22 | ||||
-rw-r--r-- | runtime/task_finder_vma.c | 30 | ||||
-rw-r--r-- | runtime/transport/control.c | 7 | ||||
-rw-r--r-- | runtime/transport/transport.c | 20 | ||||
-rw-r--r-- | runtime/transport/transport_msgs.h | 8 | ||||
-rw-r--r-- | tapset/context-symbols.stp | 6 | ||||
-rw-r--r-- | tapset/context-unwind.stp | 6 | ||||
-rw-r--r-- | tapset/context.stp | 6 | ||||
-rw-r--r-- | tapset/ioscheduler.stp | 20 | ||||
-rw-r--r-- | tapset/memory.stp | 5 | ||||
-rw-r--r-- | tapset/networking.stp | 8 | ||||
-rw-r--r-- | tapset/process.stp | 4 | ||||
-rw-r--r-- | tapset/scsi.stp | 8 | ||||
-rw-r--r-- | tapset/signal.stp | 195 | ||||
-rw-r--r-- | tapset/socket.stp | 4 | ||||
-rw-r--r-- | tapset/tcp.stp | 4 | ||||
-rw-r--r-- | tapset/timestamp.stp | 6 | ||||
-rw-r--r-- | tapset/udp.stp | 4 | ||||
-rw-r--r-- | tapsets.cxx | 4 | ||||
-rw-r--r-- | translate.cxx | 32 |
25 files changed, 414 insertions, 148 deletions
diff --git a/doc/SystemTap_Tapset_Reference/tapsets.tmpl b/doc/SystemTap_Tapset_Reference/tapsets.tmpl index 798cfb3b..892d30a9 100644 --- a/doc/SystemTap_Tapset_Reference/tapsets.tmpl +++ b/doc/SystemTap_Tapset_Reference/tapsets.tmpl @@ -117,8 +117,8 @@ <title>Context Functions</title> <para> The context functions provide additional information about where - the event occurred. - These functions can provide information such as a backtrace + 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. </para> @@ -132,22 +132,26 @@ <para> Each timestamp function returns a value to indicate when a function is executed. - Thus, these returned values can be used to indicate - when an event occurs, provide an ordering for events, or compute - the amount of time elapsed between to time stamps. + 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. </para> !Itapset/timestamp.stp </chapter> <chapter id="memory_stp"> <title>Memory Tapset</title> + <para> + This family of probe points is used to probe memory-related events. + It contains the following probe points: + </para> !Itapset/memory.stp </chapter> <chapter id="iosched.stp"> <title>IO Scheduler Tapset</title> <para> - This family of probe points is used to probe the IO scheduler activities. + This family of probe points is used to probe IO scheduler activities. It contains the following probe points: </para> !Itapset/ioscheduler.stp @@ -156,7 +160,7 @@ <chapter id="scsi.stp"> <title>SCSI Tapset</title> <para> - This family of probe points is used to probe the SCSI activities. + This family of probe points is used to probe SCSI activities. It contains the following probe points: </para> !Itapset/scsi.stp @@ -203,7 +207,7 @@ <chapter id="process.stp"> <title>Process Tapset</title> <para> - This family of probe points is used to probe the process activities. + This family of probe points is used to probe process-related activities. It contains the following probe points: </para> !Itapset/process.stp diff --git a/doc/Tapset_Reference_Guide/en-US/Tapset_Dev_Guide.xml b/doc/Tapset_Reference_Guide/en-US/Tapset_Dev_Guide.xml index 555fa7e6..01e4c358 100644 --- a/doc/Tapset_Reference_Guide/en-US/Tapset_Dev_Guide.xml +++ b/doc/Tapset_Reference_Guide/en-US/Tapset_Dev_Guide.xml @@ -62,11 +62,13 @@ beginning of those functions: </para> +<para> <programlisting> probe process.exec = kernel.function("do_execve"), kernel.function("compat_do_execve") {<replaceable>probe body</replaceable>} </programlisting> +</para> <para> Try to place probes on stable interfaces (i.e., functions @@ -102,6 +104,7 @@ kernel.function("compat_do_execve") defined in <filename>task.stp</filename>. </para> +<para> <programlisting> probe process.create = kernel.function("copy_process").return { @@ -109,6 +112,7 @@ probe process.create = kernel.function("copy_process").return new_pid = task_pid(task) } </programlisting> +</para> <para> It is not advisable to write probes for every function. Most SystemTap users @@ -191,6 +195,7 @@ probe process.create = kernel.function("copy_process").return The specified format for documenting tapsets is as follows: </para> +<para> <programlisting> /** * probe tapset.name - Short summary of what the tapset does. @@ -209,9 +214,11 @@ probe process.create = kernel.function("copy_process").return * A paragraph that will appear under the heading "Header". **/ </programlisting> - +</para> + <para>For example:</para> +<para> <programlisting> /** * probe vm.write_shared_copy- Page copy for shared page write. @@ -226,17 +233,21 @@ probe process.create = kernel.function("copy_process").return * always preceded by a <command>vm.shared_write</command>. **/ </programlisting> +</para> -<para>To override the automatically-generated <command>Synopsis</command> content, use: +<para>To override the automatically-generated <command>Synopsis</command> content, use:</para> +<para> <programlisting> * Synopsis: - * <programlisting>Synopsis string</programlisting> + * <replaceable>New Synopsis string</replaceable> * </programlisting> +</para> <para>For example:</para> +<para> <programlisting> /** * probe signal.handle - Fires when the signal handler is invoked @@ -247,6 +258,7 @@ probe process.create = kernel.function("copy_process").return * sigset_t *oldset, struct pt_regs * regs)</programlisting> */ </programlisting> +</para> <para> It is recommended that you use the <command><programlisting></command> tag in diff --git a/doc/Tapset_Reference_Guide/manpager.sh b/doc/Tapset_Reference_Guide/manpager.sh new file mode 100644 index 00000000..9aede5c4 --- /dev/null +++ b/doc/Tapset_Reference_Guide/manpager.sh @@ -0,0 +1,103 @@ +#!/bin/bash +# This script builds the man pages from comments in tapsets. As such, the man page content +# generated herein should be in sync with Tapset Reference Guide + +# cleanup +rm -rf manpages + +# create working directory +mkdir manpages ; + +# create list of man pages to generate; should be in sync with Tapset Reference Guide +cat ../SystemTap_Tapset_Reference/tapsets.tmpl | grep ^\!Itapset > manpageus ; +sed -i -e 's/\!Itapset\///g' manpageus ; + +# copy list of man pages into working directory +for i in `cat manpageus` ; do cp ../../tapset/$i manpages ; done ; + +# enter workdir +# rm manpageus ; +cd manpages ; + +# copy tapsetdescriptions, then clean +for i in `ls`; do sed -n '/\/\/ <tapsetdescription>/,/\/\/ <\/tapsetdescription>/ s/.*/&/w temp' < $i ; +mv temp $i.tapsetdescription ; +sed -i -e 's/\/\/ <tapsetdescription>//g' $i.tapsetdescription ; +sed -i -e 's/\/\/ <\/tapsetdescription>//g' $i.tapsetdescription ; +sed -i -e 's/\/\///g' $i.tapsetdescription ; +done + +# strip all tapset files to just comments; but first, make sure all comments are exactly 1 space before * +for i in `ls | grep -v tapsetdescription` ; do sed -i -e 's/^ \*/ \*/g' $i; done ; +for i in `ls | grep -v tapsetdescription` ; do sed -i -e '/^ \*/!d' $i; done ; +# rename all tapsets (remove .stp filename suffix), create templates +for i in `ls | grep -v tapsetdescription` ; do echo $i > tempname ; sed -i -e 's/.stp//g' tempname ; mv $i `cat tempname` ; mv tempname $i ; done ; +# clean all tapsetdescriptions (remove excess spaces) +# for i in `ls | grep tapsetdescription` ; do perl -p -i -e 's|^\n||g' $i ; done ; + +for i in `ls | grep -v .stp | grep -v tapsetdescription` ; +do echo ".\" -*- nroff -*-" >> $i.template ; +echo ".TH STAPPROBES.manpagename 5 @DATE@ "IBM"" >> $i.template ; +echo ".SH NAME" >> $i.template ; +echo "stapprobes."`cat $i.stp`" \- systemtap "`cat $i.stp`" probe points" >> $i.template ; +echo " " >> $i.template ; +echo ".\" macros" >> $i.template ; +echo ".de SAMPLE" >> $i.template ; +echo ".br" >> $i.template ; +echo ".RS" >> $i.template ; +echo ".nf" >> $i.template ; +echo ".nh" >> $i.template ; +echo ".." >> $i.template ; +echo ".de ESAMPLE" >> $i.template ; +echo ".hy" >> $i.template ; +echo ".fi" >> $i.template ; +echo ".RE" >> $i.template ; +echo ".." >> $i.template ; +echo " " >> $i.template ; +echo ".SH DESCRIPTION" >> $i.template ; +cat $i.stp.tapsetdescription >> $i.template ; +echo ".P" >> $i.template ; +echo ".TP" >> $i.template ; +done + +for i in `ls | grep -v .stp | grep -v tapsetdescription | grep -v template` ; +do cp $i $i.manpagebody ; +perl -p -i -e 's| \* sfunction|.B|g' $i.manpagebody ; +perl -p -i -e 's| \* probe|.B|g' $i.manpagebody ; +perl -p -i -e 's| -|\n\t|g' $i.manpagebody ; +perl -p -i -e 's|(^\t[^\n]*)\n|$1\n\n.B Arguments:|g' $i.manpagebody ; +perl -p -i -e 's| \* @([^:]*):|.I $1 \n|g' $i.manpagebody ; +perl -p -i -e 's| \* ([^:]*):|.B $1 \n|g' $i.manpagebody ; +perl -p -i -e 's| \* ||g' $i.manpagebody ; +perl -p -i -e 's|.B Arguments: \*|.B No Arguments:\n\n.B Description:|g' $i.manpagebody ; +perl -p -i -e 's|.B Arguments:.I|.B Arguments:\n.I|g' $i.manpagebody ; +perl -p -i -e 's|^ \*/|\n.P\n.TP|g' $i.manpagebody ; +perl -p -i -e 's|\.I|\n\n.I|g' $i.manpagebody ; +perl -p -i -e 's|.B Context|\n.B Context|g' $i.manpagebody ; +#perl -p -i -e 's|^[^*]*\*|.P|g' $i.manpagebody ; +done + +# generate footer template +mv ../manpageus . +sed -i -e 's/.stp//g' manpageus +echo ".SH SEE ALSO" >> footer +echo ".IR stap (1)," >> footer +echo ".IR stapprobes (5)," >> footer +for i in `cat manpageus`; do echo ".IR stapprobes."$i" (5)," >> footer ; done + +# assemble parts +for i in `cat manpageus`; do +cat $i.template >> stapprobes.$i.5.in ; +cat $i.manpagebody >> stapprobes.$i.5.in ; +cat footer >> stapprobes.$i.5.in ; +done + +# cleanup +for i in `cat manpageus`; do +perl -p -i -e 's|.B Description:/|\n.P\n.TP|g' stapprobes.$i.5.in ; +done + + +# perl -p -i -e 's|||g' $i.manpagebody +# use to move marked strings. +# sed -n '/\/\/ <tapsetdescription>/,/\/\/ <\/tapsetdescription>/ s/.*/&/w bleh' < ioscheduler
\ No newline at end of file diff --git a/runtime/loc2c-runtime.h b/runtime/loc2c-runtime.h index 0af19edc..92c017d3 100644 --- a/runtime/loc2c-runtime.h +++ b/runtime/loc2c-runtime.h @@ -187,22 +187,22 @@ #define kread(ptr) ({ \ typeof(*(ptr)) _v; \ - if (probe_kernel_read((void *)&_v, (void *)(ptr), sizeof(*(ptr)))) \ - DEREF_FAULT(ptr); \ + if (lookup_bad_addr((unsigned long)(ptr)) || \ + probe_kernel_read((void *)&_v, (void *)(ptr), sizeof(*(ptr)))) \ + DEREF_FAULT(ptr); \ _v; \ }) #define kwrite(ptr, value) ({ \ typeof(*(ptr)) _v; \ _v = (typeof(*(ptr)))(value); \ - if (probe_kernel_write((void *)(ptr), (void *)&_v, sizeof(*(ptr)))) \ - STORE_DEREF_FAULT(ptr); \ + if (lookup_bad_addr((unsigned long)addr) || \ + probe_kernel_write((void *)(ptr), (void *)&_v, sizeof(*(ptr)))) \ + STORE_DEREF_FAULT(ptr); \ }) #define deref(size, addr) ({ \ intptr_t _i; \ - if (lookup_bad_addr((unsigned long)addr)) \ - __deref_bad(); \ switch (size) { \ case 1: _i = kread((u8 *)(addr)); break; \ case 2: _i = kread((u16 *)(addr)); break; \ @@ -215,8 +215,6 @@ }) #define store_deref(size, addr, value) ({ \ - if (lookup_bad_addr((unsigned long)addr)) \ - __store_deref_bad(); \ switch (size) { \ case 1: kwrite((u8 *)(addr), (value)); break; \ case 2: kwrite((u16 *)(addr), (value)); break; \ diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c index 7baae940..b5ba7fbf 100644 --- a/runtime/staprun/mainloop.c +++ b/runtime/staprun/mainloop.c @@ -477,6 +477,14 @@ int stp_main_loop(void) cleanup_and_exit(0); break; } + case STP_REQUEST_EXIT: + { + /* module asks us to start exiting, so send STP_EXIT */ + dbug(2, "got STP_REQUEST_EXIT\n"); + int32_t rc, btype = STP_EXIT; + rc = write(control_channel, &btype, sizeof(btype)); + break; + } case STP_START: { struct _stp_msg_start *t = (struct _stp_msg_start *)data; diff --git a/runtime/task_finder.c b/runtime/task_finder.c index 9db713c3..ae381a41 100644 --- a/runtime/task_finder.c +++ b/runtime/task_finder.c @@ -55,7 +55,6 @@ typedef int (*stap_task_finder_vm_callback)(struct stap_task_finder_target *tgt, unsigned long vm_end, unsigned long vm_pgoff); -#ifdef DEBUG_TASK_FINDER_VMA static int __stp_tf_vm_cb(struct stap_task_finder_target *tgt, struct task_struct *tsk, int map_p, char *vm_path, @@ -63,21 +62,32 @@ static int __stp_tf_vm_cb(struct stap_task_finder_target *tgt, unsigned long vm_end, unsigned long vm_pgoff) { + int i; +#ifdef DEBUG_TASK_FINDER_VMA _stp_dbug(__FUNCTION__, __LINE__, "vm_cb: tsk %d:%d path %s, start 0x%08lx, end 0x%08lx, offset 0x%lx\n", tsk->pid, map_p, vm_path, vm_start, vm_end, vm_pgoff); +#endif if (map_p) { - // FIXME: What should we do with vm_path? We can't save - // the vm_path pointer itself, but we don't have any - // storage space allocated to save it in... - stap_add_vma_map_info(tsk, vm_start, vm_end, vm_pgoff); + struct _stp_module *module = NULL; + if (vm_path != NULL) + for (i = 0; i < _stp_num_modules; i++) + if (strcmp(vm_path, _stp_modules[i]->name) == 0) + { +#ifdef DEBUG_TASK_FINDER_VMA + _stp_dbug(__FUNCTION__, __LINE__, + "vm_cb: matched path %s to module\n", vm_path); +#endif + module = _stp_modules[i]; + break; + } + stap_add_vma_map_info(tsk, vm_start, vm_end, vm_pgoff, module); } else { stap_remove_vma_map_info(tsk, vm_start, vm_end, vm_pgoff); } return 0; } -#endif struct stap_task_finder_target { /* private: */ diff --git a/runtime/task_finder_vma.c b/runtime/task_finder_vma.c index 4dce4be8..87a32fe5 100644 --- a/runtime/task_finder_vma.c +++ b/runtime/task_finder_vma.c @@ -25,6 +25,9 @@ struct __stp_tf_vma_entry { unsigned long vm_end; unsigned long vm_pgoff; // Is that enough? Should we store a dcookie for vm_file? + + // Module that this vma entry is mapped from, if any. + struct _stp_module *module; }; static struct __stp_tf_vma_entry @@ -211,7 +214,8 @@ __stp_tf_get_vma_map_entry_internal(struct task_struct *tsk, // Add the vma info to the vma map hash table. static int stap_add_vma_map_info(struct task_struct *tsk, unsigned long vm_start, - unsigned long vm_end, unsigned long vm_pgoff) + unsigned long vm_end, unsigned long vm_pgoff, + struct _stp_module *module) { struct hlist_head *head; struct hlist_node *node; @@ -242,6 +246,7 @@ stap_add_vma_map_info(struct task_struct *tsk, unsigned long vm_start, entry->vm_start = vm_start; entry->vm_end = vm_end; entry->vm_pgoff = vm_pgoff; + entry->module = module; head = &__stp_tf_vma_map[__stp_tf_vma_map_hash(tsk)]; hlist_add_head(&entry->hlist, head); @@ -305,3 +310,26 @@ stap_find_vma_map_info(struct task_struct *tsk, unsigned long vm_addr, mutex_unlock(&__stp_tf_vma_mutex); return rc; } + +// Get vma_entry of the address (vm_start/vm_end) if the vma is +// present in the vma hash table containing. +// Returns NULL if not present. +static struct __stp_tf_vma_entry * +__stp_tf_get_vma_entry_addr(struct task_struct *tsk, unsigned long addr) +{ + struct hlist_head *head; + struct hlist_node *node; + struct __stp_tf_vma_entry *entry; + + mutex_lock(&__stp_tf_vma_mutex); + head = &__stp_tf_vma_map[__stp_tf_vma_map_hash(tsk)]; + hlist_for_each_entry(entry, node, head, hlist) { + if (tsk->pid == entry->pid + && addr >= entry->vm_start && addr < entry->vm_end) { + mutex_unlock(&__stp_tf_vma_mutex); + return entry; + } + } + mutex_unlock(&__stp_tf_vma_mutex); + return NULL; +} diff --git a/runtime/transport/control.c b/runtime/transport/control.c index edde244d..680d7306 100644 --- a/runtime/transport/control.c +++ b/runtime/transport/control.c @@ -13,6 +13,8 @@ static _stp_mempool_t *_stp_pool_q; static struct list_head _stp_ctl_ready_q; static DEFINE_SPINLOCK(_stp_ctl_ready_lock); +static void _stp_cleanup_and_exit(int send_exit); + static ssize_t _stp_ctl_write_cmd(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { u32 type; @@ -46,7 +48,7 @@ static ssize_t _stp_ctl_write_cmd(struct file *file, const char __user *buf, siz } break; case STP_EXIT: - _stp_exit_flag = 1; + _stp_cleanup_and_exit(1); break; case STP_BULK: #ifdef STP_BULKMODE @@ -93,6 +95,9 @@ static void _stp_ctl_write_dbug(int type, void *data, int len) case STP_TRANSPORT: _dbug("sending STP_TRANSPORT\n"); break; + case STP_REQUEST_EXIT: + _dbug("sending STP_REQUEST_EXIT\n"); + break; default: _dbug("ERROR: unknown message type: %d\n", type); break; diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c index 7fcebd42..762c0a92 100644 --- a/runtime/transport/transport.c +++ b/runtime/transport/transport.c @@ -25,7 +25,6 @@ static struct utt_trace *_stp_utt = NULL; static unsigned int utt_seq = 1; static int _stp_probes_started = 0; static pid_t _stp_target = 0; -static int _stp_exit_called = 0; static int _stp_exit_flag = 0; #include "control.h" #ifdef STP_OLD_TRANSPORT @@ -89,13 +88,14 @@ static void _stp_handle_start(struct _stp_msg_start *st) /* when someone does /sbin/rmmod on a loaded systemtap module. */ static void _stp_cleanup_and_exit(int send_exit) { - if (!_stp_exit_called) { + static int called = 0; + if (!called) { int failures; dbug_trans(1, "cleanup_and_exit (%d)\n", send_exit); _stp_exit_flag = 1; /* we only want to do this stuff once */ - _stp_exit_called = 1; + called = 1; if (_stp_probes_started) { dbug_trans(1, "calling probe_exit\n"); @@ -119,6 +119,18 @@ static void _stp_cleanup_and_exit(int send_exit) } } +static void _stp_request_exit(void) +{ + static int called = 0; + if (!called) { + /* we only want to do this once */ + called = 1; + dbug_trans(1, "ctl_send STP_REQUEST_EXIT\n"); + _stp_ctl_send(STP_REQUEST_EXIT, NULL, 0); + dbug_trans(1, "done with ctl_send STP_REQUEST_EXIT\n"); + } +} + /* * Called when stapio closes the control channel. */ @@ -169,7 +181,7 @@ static void _stp_work_queue(void *data) /* if exit flag is set AND we have finished with probe_start() */ if (unlikely(_stp_exit_flag && _stp_probes_started)) - _stp_cleanup_and_exit(1); + _stp_request_exit(); if (likely(_stp_attached)) queue_delayed_work(_stp_wq, &_stp_work, STP_WORK_TIMER); } diff --git a/runtime/transport/transport_msgs.h b/runtime/transport/transport_msgs.h index 596f4925..0d9a5983 100644 --- a/runtime/transport/transport_msgs.h +++ b/runtime/transport/transport_msgs.h @@ -21,19 +21,20 @@ struct _stp_trace { enum { STP_START, - STP_EXIT, + STP_EXIT, STP_OOB_DATA, STP_SYSTEM, STP_TRANSPORT, STP_CONNECT, - STP_DISCONNECT, + STP_DISCONNECT, STP_BULK, STP_READY, - STP_RELOCATION, + STP_RELOCATION, /** deprecated STP_OLD_TRANSPORT **/ STP_BUF_INFO, STP_SUBBUFS_CONSUMED, STP_REALTIME_DATA, + STP_REQUEST_EXIT, STP_MAX_CMD }; @@ -52,6 +53,7 @@ static const char *_stp_command_name[] = { "STP_BUF_INFO", "STP_SUBBUFS_CONSUMED", "STP_REALTIME_DATA", + "STP_REQUEST_EXIT", }; #endif /* DEBUG_TRANS */ 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. - +// <tapsetdescription> +// Context functions provide additional information about where an event occurred. These functions can +//provide information such as a backtrace to where the event occured and the current register values for the +//processor. +// </tapsetdescription> %{ #ifndef STP_NEED_SYMBOL_DATA #define STP_NEED_SYMBOL_DATA 1 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. - +// <tapsetdescription> +// Context functions provide additional information about where an event occurred. These functions can +//provide information such as a backtrace to where the event occured and the current register values for the +//processor. +// </tapsetdescription> %{ #ifndef STP_NEED_UNWIND_DATA #define STP_NEED_UNWIND_DATA 1 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. - +// <tapsetdescription> +// Context functions provide additional information about where an event occurred. These functions can +//provide information such as a backtrace to where the event occured and the current register values for the +//processor. +// </tapsetdescription> /** * sfunction print_regs - Print a register dump. */ 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. - +// <tapsetdescription> +// This family of probe points is used to probe IO scheduler activities. +// </tapsetdescription> %{ #include <linux/blkdev.h> #include <linux/elevator.h> %} /** - * 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 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. +// <tapsetdescription> +// This family of probe points is used to probe memory-related events. +// </tapsetdescription> %{ #include <linux/mm.h> %} @@ -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)); %} 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. - +// <tapsetdescription> +// This family of probe points is used to probe the activities of the network device. +// </tapsetdescription> /** * probe netdev.receive - Data recieved from network device. * @dev_name: The name of the device. e.g: eth0, ath1. @@ -49,7 +51,7 @@ /// /// </variablelist> ///</para> -/* 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") { 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. - +// <tapsetdescription> +// This family of probe points is used to probe process-related activities. +// </tapsetdescription> function _IS_ERR:long(ptr:long) %{ /* pure */ THIS->__retvalue = IS_ERR((const void *)(long)THIS->ptr); 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. - +// <tapsetdescription> +// This family of probe points is used to probe SCSI activities. +// </tapsetdescription> %{ #include <linux/types.h> #include <scsi/scsi_cmnd.h> @@ -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")? diff --git a/tapset/signal.stp b/tapset/signal.stp index 8fb6fe57..711ee70f 100644 --- a/tapset/signal.stp +++ b/tapset/signal.stp @@ -8,16 +8,17 @@ // 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). // - +// <tapsetdescription> +// This family of probe points is used to probe signal activities. +// 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 for a particular process (if pid_name==stap). +// </tapsetdescription> /** - * 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 @@ -27,7 +28,8 @@ * @task: A task handle to the signal recipient * @sinfo: The address of <command>siginfo</command> struct * @shared: Indicates whether the signal is shared by the thread group - * @send2queue- Indicates whether the signal is sent to an existing <command>sigqueue</command> + * @send2queue: Indicates whether the signal is sent to an existing + * <command>sigqueue</command> * @name: The name of the function used to send out the signal * * Context: @@ -114,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 <command>__group_send_sig_info</command>, - * <command>specific_send_sig_info</command>, or <command>send_sigqueue</command>. - * Refer to the Description of this probe for more information about the return - * values of each function call. + * <command>specific_send_sig_info</command>, + * or <command>send_sigqueue</command> * @shared: Indicates whether the sent signal is shared by the thread group. - * @send2queue: Indicates whether the sent signal was sent to an existing <command>sigqueue</command> - * @name: The name of the function used to send out the signal. + * @send2queue: Indicates whether the sent signal was sent to an + * existing <command>sigqueue</command> + * @name: The name of the function used to send out the signal * * Context: * The signal's sender. <remark>(correct?)</remark> @@ -129,24 +131,24 @@ probe _signal.send.part3 = kernel.function("send_sigqueue") * Possible <command>__group_send_sig_info</command> and * <command>specific_send_sig_info</command> return values are as follows; * - * <command>0</command> - The signal is sucessfully sent to a process, + * <command>0</command> -- 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 <command>sigqueue</command> of the receiving process. * - * <command>-EAGAIN</command> - The <command>sigqueue</command> of the receiving process is + * <command>-EAGAIN</command> -- The <command>sigqueue</command> of the receiving process is * overflowing, the signal was RT, and the signal was sent by a user using something other * than <command>kill()</command> * * Possible <command>send_group_sigqueue</command> and * <command>send_sigqueue</command> return values are as follows; * - * <command>0</command> - The signal was either sucessfully added into the + * <command>0</command> -- The signal was either sucessfully added into the * <command>sigqueue</command> of the receiving process, or a <command>SI_TIMER</command> entry is already * queued (in which case, the overrun count will be simply incremented). * - * <command>1</command> - The signal was ignored by the receiving process. + * <command>1</command> -- The signal was ignored by the receiving process. * * * <command>-1</command> - (<command>send_sigqueue</command> only) The task was marked @@ -232,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 @@ -240,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 <command>siginfo</command> structure - * @name: Name of the probe point; default value is <command>signal.checkperm</command> + * @name: Name of the probe point; default value is + * <command>signal.checkperm</command> */ probe signal.checkperm = kernel.function("check_kill_permission") { @@ -261,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 + * <command>signal.checkperm</command> + * @retstr: Return value as a string + */ probe signal.checkperm.return = kernel.function("check_kill_permission").return { name = "signal.checkperm" @@ -269,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 <command>STOPPED</command> or - * <command>TRACED</command> 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 + * <command>STOPPED</command> or <command>TRACED</command> state * @state_mask: A string representation indicating the mask - * of task states you wish to wake. Possible values are <command>TASK_INTERRUPTIBLE</command>, - * <command>TASK_STOPPED</command>, <command>TASK_TRACED</command>, - * and <command>TASK_INTERRUPTIBLE</command>. + * of task states to wake. Possible values are + * <command>TASK_INTERRUPTIBLE</command>, <command>TASK_STOPPED</command>, + * <command>TASK_TRACED</command>, and <command>TASK_INTERRUPTIBLE</command>. */ probe signal.wakeup = kernel.function("signal_wake_up") { @@ -293,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 @@ -308,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 + * <command>signal.checkperm</command> + * @retstr: Return value as a string + */ probe signal.check_ignored.return = kernel.function("sig_ignored").return ? { name = "sig_ignored" @@ -333,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 - * <command>SIGSEGV</command> as a result of problems it encountered while handling a received signal + * probe signal.force_segv - Forcing send of <command>SIGSEGV</command> * @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 @@ -360,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 <command>SIGSEGV</command> complete + * @name: Name of the probe point; default value is + * <command>force_sigsegv</command> + * @retstr: Return value as a string + */ probe signal.force_segv.return = kernel.function("force_sigsegv").return, kernel.function("force_sigsegv_info").return ? @@ -370,9 +389,8 @@ probe signal.force_segv.return = /** - * probe signal.syskill - Fires when the kernel function <command>sys_kill</command> - * 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 @@ -380,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 <command>tkill</command> 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 <command>tkill</command> call is analogous to <command>kill(2)</command>, * 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 <command>tgkill</command> - * 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 <command>tgkill</command> call is similar to <command>tkill</command>, * except that it also allows the caller to specify the thread group ID of * the thread to be signalled. This protects against TID reuse. @@ -416,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 @@ -439,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 ? @@ -448,25 +483,25 @@ probe signal.send_sig_queue.return = /** - * probe signal.pending - Fires when the <command>SIGPENDING</command> system call is used; - * this normally occurs when the <command>do_sigpending</command> kernel function is executed - * @sigset_add: The address of the user-space signal set (<command>sigset_t</command>) - * @sigset_size: The size of the user-space signal set. - * - * Synopsis: - * <programlisting>long do_sigpending(void __user *set, unsigned long sigsetsize)</programlisting> + * probe signal.pending - Examining pending signal + * @sigset_add: The address of the user-space signal set + * (<command>sigset_t</command>) + * @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 + * <command>do_sigpending</command> 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) @@ -474,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 <command>siginfo</command> table - * @sig_code: The <command>si_code</command> value of the <command>siginfo</command> signal - * @ka_addr: The address of the <command>k_sigaction</command> table associated with the signal + * @sig_code: The <command>si_code</command> value of the + * <command>siginfo</command> signal + * @ka_addr: The address of the <command>k_sigaction</command> 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: - * <programlisting>static int handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, - * sigset_t *oldset, struct pt_regs * regs)</programlisting> */ -//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 @@ -508,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) @@ -515,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 <command>sigaction</command> struct associated with the signal - * @oldsigact_addr: The address of the old <command>sigaction</command> struct associated with the signal + * @sigact_addr: The address of the new <command>sigaction</command> + * struct associated with the signal + * @oldsigact_addr: The address of the old <command>sigaction</command> + * struct associated with the signal * @sa_handler: The new handler of the signal * @sa_mask: The new mask of the signal */ @@ -535,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) @@ -554,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 * <command>SIG_BLOCK=0</command> (for blocking signals), * <command>SIG_UNBLOCK=1</command> (for unblocking signals), and * <command>SIG_SETMASK=2</command> for setting the signal mask. - * @sigset_addr: The address of the signal set (<command>sigset_t</command>) to be implemented - * @oldsigset_addr: The old address of the signal set (<command>sigset_t</command>) - * @sigset: The actual value to be set for <command>sigset_t</command> <remark>(correct?)</remark> - * Synopsis: - * <programlisting>int sigprocmask(int how, sigset_t *set, sigset_t *oldset)</programlisting> + * @sigset_addr: The address of the signal set (<command>sigset_t</command>) + * to be implemented + * @oldsigset_addr: The old address of the signal set + * (<command>sigset_t</command>) + * @sigset: The actual value to be set for <command>sigset_t</command> + * <remark>(correct?)</remark> */ probe signal.procmask = kernel.function("sigprocmask") { @@ -591,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: - * <programlisting>void flush_signals(struct task_struct *t)</programlisting> + * @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 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. - +// <tapsetdescription> +// This family of probe points is used to probe socket activities. +// </tapsetdescription> %{ #include <net/sock.h> #include <asm/bitops.h> 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. - +// <tapsetdescription> +// This family of probe points is used to probe events that occur in the TCP layer, +// </tapsetdescription> %{ #include <linux/version.h> #include <net/sock.h> 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. - +// <tapsetdescription> +// 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. +// </tapsetdescription> /** * sfunction get_cycles - Processor cycle count. * 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. - +// <tapsetdescription> +// This family of probe points is used to probe events that occur in the UDP layer. +// </tapsetdescription> %{ #include <linux/version.h> #include <net/sock.h> diff --git a/tapsets.cxx b/tapsets.cxx index b02e2cce..6efcb3af 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -7172,10 +7172,8 @@ utrace_derived_probe_group::emit_module_decls (systemtap_session& s) // Emit a "fake" probe decl that is really a hook for to get // our vm_callback called. string path = it->first; - s.op->newline() << "#ifdef DEBUG_TASK_FINDER_VMA"; emit_vm_callback_probe_decl (s, true, path, (int64_t)0, "__stp_tf_vm_cb"); - s.op->newline() << "#endif"; for (unsigned i = 0; i < it->second.size(); i++) { @@ -7193,10 +7191,8 @@ utrace_derived_probe_group::emit_module_decls (systemtap_session& s) { // Emit a "fake" probe decl that is really a hook for to get // our vm_callback called. - s.op->newline() << "#ifdef DEBUG_TASK_FINDER_VMA"; emit_vm_callback_probe_decl (s, false, "", it->first, "__stp_tf_vm_cb"); - s.op->newline() << "#endif"; for (unsigned i = 0; i < it->second.size(); i++) { diff --git a/translate.cxx b/translate.cxx index 17c37dc3..f4c28536 100644 --- a/translate.cxx +++ b/translate.cxx @@ -4497,17 +4497,35 @@ dump_unwindsyms (Dwfl_Module *m, // see https://bugzilla.redhat.com/show_bug.cgi?id=465872 // and http://sourceware.org/ml/systemtap/2008-q4/msg00579.html #ifdef _ELFUTILS_PREREQ -#if _ELFUTILS_PREREQ(0,138) + #if _ELFUTILS_PREREQ(0,138) // Let's standardize to the buggy "end of build-id bits" behavior. build_id_vaddr += build_id_len; + #endif + #if !_ELFUTILS_PREREQ(0,141) + #define NEED_ELFUTILS_BUILDID_WORKAROUND + #endif +#else + #define NEED_ELFUTILS_BUILDID_WORKAROUND #endif + + // And check for another workaround needed. + // see https://bugzilla.redhat.com/show_bug.cgi?id=489439 + // and http://sourceware.org/ml/systemtap/2009-q1/msg00513.html +#ifdef NEED_ELFUTILS_BUILDID_WORKAROUND + if (build_id_vaddr < base && dwfl_module_relocations (m) == 1) + { + GElf_Addr main_bias; + dwfl_module_getelf (m, &main_bias); + build_id_vaddr += main_bias; + } #endif - if (c->session.verbose > 1) { - clog << "Found build-id in " << name - << ", length " << build_id_len; - clog << ", end at 0x" << hex << build_id_vaddr - << dec << endl; - } + if (c->session.verbose > 1) + { + clog << "Found build-id in " << name + << ", length " << build_id_len; + clog << ", end at 0x" << hex << build_id_vaddr + << dec << endl; + } } // Look up the relocation basis for symbols |