summaryrefslogtreecommitdiffstats
path: root/runtime
Commit message (Collapse)AuthorAgeFilesLines
* Use clamping to more easily normalize input valuesJosh Stone2010-02-163-8/+16
| | | | | | The kernel has min/max/clamp macros to make range comparisons easier. Clamp is a newer invention, but we can define it for older kernels in terms of min and max.
* PR11277: Use consistent octal in quoted stringsJosh Stone2010-02-161-10/+3
| | | | | | | | | | Previously, our octal escapes used variable lengths, which can lead to ambiguities. Also, 8-bit characters would only output the least digit. * runtime/string.c (_stp_text_str): Always output 3-digit octal escapes, and handle 8-bit chars more gracefully. * testsuite/systemtap.string/text_str.stp: Include an 8-bit character. * testsuite/systemtap.string/text_str.exp: Above + expect 3-digit octal.
* Fixed PR 11078. Changed code to avoided procfs race condition.David Smith2010-02-032-4/+215
| | | | | | | | | | | | | | | | | * runtime/procfs.c: Allow STP_MAX_PROCFS_FILES define to be overridden. (_stp_create_procfs): Calls proc_create() instead of create_proc_entry() to avoid a race condition. * runtime/procfs-probes.c: New file containing procfs probe support routines. * tapset-procfs.cxx (procfs_derived_probe::join_group): Update struct _stp_procfs_data definition. (procfs_derived_probe::emit_module_decls): Include procfs-probes.c, which is where the definition of struct stap_procfs_probe exists. Update generated routines to read/write procfs data. (procfs_derived_probe_group::emit_module_init): Pass file_operations argument to _stp_create_procfs(). Initialize mutex. (procfs_var_expanding_visitor::visit_target_symbol): Update generated code.
* Fixed PR 11220 by setting MAP_STRING_LENGTH to MAXSTRINGLEN.David Smith2010-01-251-3/+5
| | | | | | * runtime/map.h: Set MAP_STRING_LENGTH to MAXSTRINGLEN so that large strings can be stored in arrays. * testsuite/systemtap.base/array_string.exp: New testcase.
* use eh_frame_hdr table to speed up unwindingTim Moore2010-01-202-16/+43
| | | | | | | | | | | | * runtime/sym.h (_stp_module): add unwind_hdr_addr member. * runtime/unwind.c (read_ptr_sect): Modification of read_pointer that also handles offsets from text or "data" sections. (read_pointer): Use it. (_stp_search_unwind_hdr): Use read_ptr_sect to calculate values that are relative to the .eh_frame_hdr section. (unwind_frame): Search the frame header if this is an eh frame. * translate.cxx (get_unwind_data): Get the eh_frame_hdr too. (dump_unwindsyms): Write out eh_frame_hdr stuff.
* Relax sdt address check for attach to running process case.Stan Cox2010-01-151-2/+2
| | | | * uprobes-common.c (stap_uprobe_change_plus): Relax VM_EXEC check.
* runtime: better staprun diagnostics for failed signature testsFrank Ch. Eigler2010-01-151-2/+8
| | | | * modverify.c (verify_module): Print some messages for verbose > 1.
* Improve stack printing formatWenji Huang2010-01-151-1/+2
| | | | * runtime/stack.c (_stp_stack_print_tsk): Use _stp_symbol_print.
* PR11151: Recover stap_uprobes slots on process exitJosh Stone2010-01-142-0/+16
| | | | | | | | | | When a process exits, it won't necessarily bother to munmap all of its shared libraries. This patch makes sure that with uprobes in libraries, we still grab an exit notification and clear everything out. * runtime/uprobes-common.c (stap_uprobe_process_munmap): New. * tapsets.cxx (uprobe_derived_probe_group::emit_module_decls): Use above callback so that we can recover our resources on process exit.
* Use gnu indentation style.Stan Cox2010-01-141-59/+66
|
* Merge branch 'master' of ssh://sources.redhat.com/git/systemtapWilliam Cohen2010-01-131-3/+54
|\
| * Use __access_process_vm_noflush for static user semaphore decrement.Stan Cox2010-01-131-3/+54
| | | | | | | | | | | | * access_process_vm (__access_process_vm_noflush): New * tapsets.cxx (uprobe_derived_probe_group::emit_module_exit): Use it. * translate.cxx (translate_pass): Declare it.
* | Move userspace probing boiler plate code in translator to runtime library.William Cohen2010-01-132-0/+326
|/
* map through uretprobe trampoline in an arbitrary taskTim Moore2010-01-134-35/+114
| | | | | | | | | * runtime/uprobes2/uprobes.c (uprobe_get_pc_task): new function (lookup_uretprobe): new helper function (uprobe_get_pc): use it * runtime/uprobes2/uprobes.h (uprobe_get_pc_task): declare * runtime/uprobes/uprobes.c : ditto * runtime/uprobes/uprobes.h : ditto
* Removed bogus task_finder error message.David Smith2010-01-131-1/+1
| | | | | * runtime/task_finder.c (__stp_utrace_attach): No longer prints bogus error message when utrace_barrier succeeds.
* PR10493: autoconf for cpu_khzWenji Huang2010-01-131-7/+5
| | | | | | * buildrun.cxx (output_cpu_khz): New function to check cpu_khz. (compile_pass): Invoke function output_cpu_khz. * runtime/time.c : Use STAPCONF_CPU_KHZ.
* Add stack walking function for 2.6.33Wenji Huang2010-01-111-0/+14
| | | | | * runtime/stack.c (walk_context_stack): New function. (print_stack_ops): Add function pointer.
* Fixed PR 11148 by reworking transport directory locks.David Smith2010-01-081-14/+30
| | | | | | | | | | * runtime/transport/transport.c (_stp_get_root_dir): No longer locks/unlocks the transport directory. (_stp_remove_root_dir): Ditto. (_stp_transport_fs_init): Locks and unlocks the transport directory. Ensures that the root directory can't be deleted between calling _stp_get_root_dir() and creating the module dir. (_stp_transport_fs_close): Locks and unlocks the transport directory.
* Partial PR 10848 fix. Added testcase for STP_MAXMEMORY.David Smith2010-01-071-20/+21
| | | | | | | | | * runtime/alloc.c (_stp_kmalloc): Renamed 'MAXMEMORY' to 'STP_MAXMEMORY'. (_stp_kzalloc): Ditto. (_stp_vmalloc): Ditto. (_stp_alloc_percpu): Ditto. (_stp_kmalloc_node): Ditto. * testsuite/systemtap.base/maxmemory.exp: New test for STP_MAXMEMORY.
* Partial PR 10848 fix. Added '-DMAXMEMORY=NUM' processing.David Smith2010-01-051-8/+124
| | | | | | | | | | * runtime/alloc.c (_stp_mem_debug_validate): New debug function. (_stp_kmalloc): Added MAXMEMORY code to check size of memory used by module. (_stp_kzalloc): Ditto. (_stp_vmalloc): Ditto. (_stp_alloc_percpu): Ditto. (_stp_kmalloc_node): Ditto.
* bz6436 backtraces from uprobesTim Moore2010-01-055-69/+99
| | | | | | | | | | | | | | | | | | | | | This implements proper unwinding from uprobes in the presence of uretprobe trampolines. * runtime/stack.c (_stp_stack_print): Rework for uprobe context case and refactor a bit. * runtime/uprobes2/uprobes.h (GET_PC_URETPROBE_NONE): new constant * runtime/uprobes2/uprobes.c (uprobe_get_pc): Support translating the trampoline function from uprobe context in addition to uretprobe context. * runtime/uprobes/uprobes.h (GET_PC_URETPROBE_NONE): ditto * runtime/uprobes/uprobes.c (uprobe_get_pc): ditto * tapsets.cxx (uprobe_derived_probe_group::emit_module_decls): Initialize ri in context to GET_PC_URETPROBE_NONE in generated enter_uprobe_probe. * testsuite/systemtap.context/fib.stp: Add an option to do a backtrace on function entry. * testsuite/systemtap.context/fib.exp: Test backtrace in function entry (uprobe) probes.
* Remove all caching from _stp_module_relocate.Mark Wielaard2009-12-291-38/+13
| | | | | | | | | | | This function now also does user space address relocation. The connection with module loading/unloading was removed in commit 1b94bf which made all symbol tables emitted at compile time. _stp_module_relocate is called from the dwarf unwinder, and when doing some of the symbol lookup through dwflpp::emit_adress now. * runtime/sym.c (_stp_module_relocate): Remove last, last_sec and last_tsk caching and invalidation code.
* Set last_tsk in runtime/sym.c _stp_module_relocate.Mark Wielaard2009-12-291-0/+1
| | | | last_tsk was checked but never set. Noticed by Wenji Huang.
* ppc stack: transcribe portions of modern kernel ppc/.../asm/ptrace.hFrank Ch. Eigler2009-12-221-0/+18
| | | | | * runtime/stack-ppc.c (__stp_stack_print): Define STACK_FRAME_LR_SAVE, STACK_FRAME_REGS_MARKER,STACK_FRAME_MARKER, etc.
* Fixed ia64 compile problem with runtime/stack-ia64.c.David Smith2009-12-221-1/+2
| | | | * runtime/stack-ia64.c (__stp_stack_print): Added new 'ri' parameter.
* Fixed compilation on f11.David Smith2009-12-211-0/+1
| | | | * runtime/task_finder.c: Fixed last checkin.
* PR11113 fix. Support new utrace API.David Smith2009-12-213-4/+155
| | | | | | | | | | | | | | | | | | | | * tapset-utrace.cxx (utrace_derived_probe_group::emit_module_decls): Handles new utrace api. * runtime/itrace.c (usr_itrace_report_signal): Ditto. (usr_itrace_report_clone): Ditto. (usr_itrace_report_death): Ditto. * runtime/task_finder.c (__stp_utrace_task_finder_report_clone): Ditto. (__stp_utrace_task_finder_report_exec): Ditto. (__stap_utrace_task_finder_report_death): Ditto. (__stp_utrace_task_finder_target_death): Ditto. (__stp_utrace_task_finder_target_quiesce): Ditto. (__stp_utrace_task_finder_target_syscall_entry): Ditto. (__stp_utrace_task_finder_target_syscall_exit): Ditto. * runtime/uprobes2/uprobes.c (uprobe_report_signal): Ditto. (uprobe_report_quiesce): Ditto. (uprobe_report_exit): Ditto. (uprobe_report_clone): Ditto. (uprobe_report_exec): Ditto.
* PR10601: cleanup for i386, x86-64Frank Ch. Eigler2009-12-211-7/+16
| | | | | | * runtime/loc2c-runtime.h (usr_i386): Fix si/di ordering. Add ip. (usr_x86_64): Add rip. (u_*_register): Use kernel standard ARRAY_SIZE() instead of S().
* PR11015 Support shared library reloading (in different processes)Mark Wielaard2009-12-215-77/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * runtime/task_finder_vma.c (stap_remove_vma_map_info): Return negative status on failure. (stap_find_vma_map_info): Likewise. (stap_find_vma_map_info_user): New function. (stap_drop_vma_maps): New function. * runtime/sym.h (addr): Renamed to static_addr, to store addresses for sections which are always mapped at the same address. (_stp_module_relocate): Add extra struct task_struct *tsk argument. * runtime/sym.c (_stp_tf_exec_cb): New callback, calls stap_drop_vma_maps. (_stp_tf_mmap_cb): Don't store address in module.section, but call stap_add_vma_map_info() per tsk->group_leader for matched module. Don't register empty/null modules. (_stp_module_relocate): Take extra struct task_struct *tsk argument, cache last tsk used. Only use section->static_addr for none dynamic modules. Use stap_find_vma_map_info_user() to locate dynamic modules. (_stp_mod_sec_lookup): Add extra argument unsigned long *rel_addr to optionally store relative address when module/section found. (_stp_kallsyms_lookup): Use _stp_mod_sec_lookup to find relative address. (_stp_sym_init): Register _stp_tf_exec_cb in stap_task_finder_target. Add error check to see if task finder could be initialized. * dwflpp.cxx (emit_address): Pass NULL for kernel/modules and current for user tasks to _stp_module_relocate. * runtime/transport/symbols.c (_stp_do_relocation): Set new static_addr _stp_section field. * runtime/unwind.c (adjustStartLoc): Take new struct task_struct *tsk argument and pass to stap_find_vma_map_info_user and _stp_module_relocate to find adjusted addr. (_stp_search_unwind_hdr): Pass through struct task_struct *tsk. (unwind_frame): Likewise. * tapset/context-symbols.stp (probemod): Add NULL to _stp_mod_sec_lookup call to indicate we aren't interested in relative address. * tapsets.cxx (dwarf_derived_probe_group::emit_module_init): Pass NULL to _stp_module_relocate to indicate kernel/module address.
* brown paper bag typo fixyFrank Ch. Eigler2009-12-201-1/+1
|
* runtime: more build fix for non-utrace kernelsFrank Ch. Eigler2009-12-202-1/+3
| | | | | | * runtime/stack-i386.c (_stp_stack_print): Make call to uprobe_get_pc() conditional on CONFIG_UTRACE. * runtime/stack-x86_64.c: Ditto.
* PR10601: unfork deref()Frank Ch. Eigler2009-12-201-22/+16
| | | | | * runtime/loc2c-runtime.h: Remove k_ vs u_[store_]deref; share instead. * tapsets.cxx: Remove k_ vs u_ redirection for *deref().
* runtime: rhel4 build fix for uretprobe-wannabe stack tracebacksFrank Ch. Eigler2009-12-201-1/+3
| | | | * runtime/stack.c (_stp_stack_print): Comment out *retprobe logic if !CONFIG_UTRACE.
* runtime backtracing: port commit #2e7f8442 to uprobes1Frank Ch. Eigler2009-12-203-2/+46
| | | | * runtime/uprobes/uprobes.c (uprobe_get_pc): new function
* PR10601 cont'd, RHEL5 backward compatibility with more runtime/autoconf*Frank Ch. Eigler2009-12-203-5/+35
|
* PR10601 part 1: i386 and x86-64 regset for dwarf fetch/store_register()sFrank Ch. Eigler2009-12-201-85/+300
| | | | | | | | | | * runtime/loc2c-runtime.h (fetch_register, store_register): forked into k_ (kernel) and u_ (user) varieties. Implement i386 and x86_64 in terms of regset.h; fall back to k_* for other architectures. * tapsets.cxx: (*::visit_target_symbol): Emit macros to map loc2c's fetch/store_register to loc2c-runtime's k_ or u_ as appopriate.
* Remove uprobes.h declaration from runtime.hTim Moore2009-12-184-12/+16
| | | | | | | | | | | Turns out that it breaks on kernels that don't have utrace. * runtime/runtime.h : Don't include uprobes.h * runtime/stack.c: Include uprobes.h * runtime/stack-i386.c: Check if uprobes is included at all. * runtime/stack-x86_64.c: ditto * tapsets.cxx (uprobe_derived_probe_group::emit_module_decls): put uprobes.h include back in.
* support for a brief backtrace formatTim Moore2009-12-175-14/+46
| | | | | | | | | | | | | | This only prints symbol+offset, or an address if the symbol isn't known. * runtime/runtime.h (SYM_VERBOSE_NO, SYM_VERBOSE_FULL, SYM_VERBOSE_BRIEF): new constants * runtime/stack.c (_stp_stack_print): support brief format * runtime/sym.c (_stp_func_print): ditto * tapset/ucontext-unwind.stp (print_ubacktrace_brief): new function * testsuite/systemtap.context/fib.c: new test program * testsuite/systemtap.context/fib.stp: new test * testsuite/systemtap.context/fib.exp: new test
* backtrace through uprobes trampoline.Tim Moore2009-12-176-6/+26
| | | | | | | | | | | | | | Only works in uretprobes for the moment. * runtime/stack-x86_64.c (__stp_stack_print): Rewrite trampoline PC addresses if necessary. * runtime/stack-i386.c (__stp_stack_print): ditto * runtime/stack-arm.c (__stp_stack_print): Add extra argument * runtime/stack-ppc.c (__stp_stack_print): ditto * runtime/stack-s390.c (__stp_stack_print): ditto * runtime/stack.c (_stap_stack_print): call __stp_stack_print with uretprobe_instance. * testsuite/systemtap.context/uprobe_backtrace.stp: new test
* function to translate from the uretprobe trampoline back to the originalTim Moore2009-12-162-0/+46
| | | | | | return address * runtime/uprobes2/uprobes.c (uprobe_get_pc): new function
* set the IP in return probes to the returned-to instructionTim Moore2009-12-162-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | It's easily available in kretprobes and uretprobes and is consistent with the rest of the program state. * translate.cxx (emit_common_header) : add uretprobe_instance to context. * tapsets.cxx (common_probe_entryfn_prologue): Initialize ri in context to 0. (dwarf_derived_probe_group::emit_module_decls): Change IP to return address in kretprobes. (uprobe_derived_probe_group::emit_module_decls): enter_uretprobe_probe: set ri (uretprobe_instance) in context. Change IP to return address in uretprobes. Don't emit uprobe include and #define * runtime/runtime.h : Add includes and #define for uprobes. * runtime/stack.c (_stp_stack_print, _stp_stack_snprint): Add extra argument for uretprobe_instance. * tapset/context-unwind.stp (print_backtrace, backtrace): Pass NULL for uretprobe_instance to _stp_stack_print. * tapset/ucontext-unwind.stp (print_ubacktrace, ubacktrace): pass uretprobe_instance to _stp_stack_print * testsuite/systemtap.context/uprobe_uaddr.exp : new test for uaddr in function probes * testsuite/systemtap.context/uprobe_uaddr.stp : new file
* Merge branch 'master' of ssh://sources.redhat.com/git/systemtapDave Brolley2009-12-151-18/+35
|\
| * Fixed DEBUG_MEM debug memory tracking.David Smith2009-12-151-18/+35
| | | | | | | | | | | | | | | | | | * runtime/alloc.c (_stp_kmalloc): Fixed compilation when DEBUG_MEM is defined. Improved allocated memory tracking. (_stp_kzalloc): Ditto. (_stp_vmalloc): Ditto. (_stp_alloc_percpu): Ditto. (_stp_kmalloc_node): Ditto.
* | Merge branch 'master' of ssh://sources.redhat.com/git/systemtapDave Brolley2009-12-147-45/+51
|\|
| * Do not use condition_codes() on armEugeniy Meshcheryakov2009-12-131-1/+1
| | | | | | | | | | | | | | | | | | It does not exist in recent kernels. Use regs->ARM_cpsr instead, this should work with all versions of linux found in git repo (versions >=2.6.12-rc2). Difference between condition_codes() and regs->ARM_cpsr should not matter for systemtap.
| * runtime build: fix alloc.c buildability on old gcc 3.4Frank Ch. Eigler2009-12-111-2/+2
| | | | | | | | * runtime/alloc.c (_stp_kmalloc): Move var decl back to top.
| * runtime: undefine DEBUG_MEM, retain alloc countingFrank Ch. Eigler2009-12-101-9/+10
| | | | | | | | | | | | | | DEBUG_MEM can & does evoke locking timeouts. * runtime/alloc.c (*): Track __stp_allocated_memory regardless of DEBUG_MEM.
| * runtime: print stp_alloc statistics in startup printkFrank Ch. Eigler2009-12-102-20/+13
| | | | | | | | | | * runtime/alloc.c: Define DEBUG_MEM. * runtime/print.c (_stp_print_kernel_info): Reformat/rescale mem values.
| * Fix regression in statistic operationsAnton Vorontsov2009-12-091-6/+12
| | | | | | | | | | | | | | | | | | | | | | In commit 98c783852039061db8c1611742660aaded0eab77 ("Use proper types for do_div") I imprudently changed some variables to an unsigned type while in some places the code actually relies on a sign. So, let's be a bit smarter now and use temporary variables. Reported-by: Wenji Huang <wenji.huang@oracle.com> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
| * PR 10848 partial fix by using systemtap memory functions everywhere.David Smith2009-12-092-8/+12
| | | | | | | | | | | | | | * runtime/addr-map.c (add_bad_addr_entry): Uses systemtap memory allocation/deallocation wrappers. * runtime/itrace.c (create_itrace_info): Ditto. (remove_usr_itrace_info): Ditto.