summaryrefslogtreecommitdiffstats
path: root/runtime/sym.c
Commit message (Collapse)AuthorAgeFilesLines
* runtime: more diagnostics for build-id checkingFrank Ch. Eigler2010-04-081-8/+8
| | | | * runtime/sym.c: Store individual rc's for build-id comparisons.
* Remove <asm/segment.h> inclusion to fix ppc build.David Smith2010-03-181-1/+0
| | | | | * runtime/sym.c: Removed <asm/segment.h> include. That file doesn't exist on ppc, and it appears to be empty everywhere else.
* PR10812: make build-id checking somewhat more robust w.r.t. bad addressesFrank Ch. Eigler2010-03-161-18/+36
| | | | | * runtime/sym.c (_stp_module_check): Use a failure-tolerant get_user() loop instead of memcmp() for buildid binary strings.
* 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.
* PR11015 Support shared library reloading (in different processes)Mark Wielaard2009-12-221-57/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* support for a brief backtrace formatTim Moore2009-12-171-6/+18
| | | | | | | | | | | | | | 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
* Add assert for detecting shared library reloading, PR11015.Mark Wielaard2009-11-241-6/+15
| | | | | * runtime/sym.c (_stp_tf_mmap_cb): Only look for first load of whole module that is executable. Add check for detecting reloading of module.
* Explain "cheat" comment in sym.c (_stp_tf_mmap_cb).Mark Wielaard2009-11-171-0/+11
| | | | | | | | | | | | We are abusing the "first" section address here to indicate where the module (actually first segment) is loaded (which is why we are ignoring the offset). It would be good to redesign the stp_module/stp_section data structures to better align with the actual memory mappings we are interested in (especially the "section" naming is slightly confusing since what we really seem to mean are elf segments (which can contain multiple elf sections). * runtime/sym.c (_stp_tf_mmap_cb): Add cheat comment.
* PR10010 Support $globals in shared libraries.Mark Wielaard2009-11-161-2/+5
| | | | | | | | * dwflpp.cxx (dwflpp::emit_address): Enable task finder and emit a _stp_module_relocate for the ".dynamic" section when seeing a user-space dso address. * runtime/sym.c (_stp_mod_sec_lookup): Remove .dynamic section addr cheat. (_stp_tf_mmap_cb): Add cheat here.
* PR10524: reduce massive-uprobe script modules' .data consumptionFrank Ch. Eigler2009-09-081-15/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | The general approach is to rip out task_finder_tgt's from all over the place (including the unwindsym vmcbs, and the stap_uprobe_specs), and instead have a small handful of them: one for all unwindsyms, and one per abstract probed process (PID or NAME). These are in turn shared by all new stap_unwind_specs by index. Before: probe process("./stap").function("*") -rw-r--r--. 1 fche users 11775283 2009-09-08 20:26 /var/tmp/fche/systemtap/cache/96/stap_96c0479d674db55ec98d8a8750a790e7_7989596.ko text data bss dec hex filename 445158 8351944 4306472 13103574 c7f1d6 /var/tmp/fche/systemtap/cache/96/stap_96c0479d674db55ec98d8a8750a790e7_7989596.ko After: (Note how data shrank, though text gained a bit in const-init-data.) -rw-r--r--. 1 fche users 4021569 2009-09-08 20:27 /var/tmp/fche/systemtap/cache/e4/stap_e46e88634efd850b1586e81c231c239a_8058419.ko text data bss dec hex filename 1896511 2192 4324808 6223511 5ef697 /var/tmp/fche/systemtap/cache/e4/stap_e46e88634efd850b1586e81c231c239a_8058419.ko * tapsets.cxx (uprobe_derived_probe_group): Rewrite emit_module_decls, and adjust emit_module_init. * runtime/sym.c (_stp_sym_init): Initialize unwindsyms-shared vmcb. * runtime/sym.h (_stp_module): Remove *vmcb field. * translate.cxx (emit_module_init, dump_unwindsyms): Adapt. * translate.h (assert_0_indent): Flush output before possibly assert-failing.
* Fix build-id check for relocatable kernelEugeniy Meshcheryakov2009-09-071-1/+2
| | | | | | Save offset of build id relative to _stext instead of absolute address for kernel and apply relocations at run-time. This fixes Debian bug #545277 (http://bugs.debian.org/545277).
* PR10589: switch to kernel vscnprintf for _stp_{dbug,warn,error} calls in runtimeFrank Ch. Eigler2009-09-021-8/+6
| | | | | | | | | | | _stp_vscnprintf is only suitable for calls from the script, with slightly different conventions (64-bit ints/pointers, extra formatting directives). * runtime/runtime.h (_stp_{dbug,warn,error}): Add __attribute__ format(printf). * runtime/io.c (_stp_vlog): Ditto. Use vscnprintf(). * runtime/sym.c (_stp_module_check): Remove hexdumping (%.*M) of mismatching buildids. Switch to _stp_warn from printk (KERN_WARNING). * translate.cxx, runtime/unwind.c: Numerous print formatting tweaks.
* PR10228: use task_finder_vma for -d /user/object files.Frank Ch. Eigler2009-08-141-2/+2
| | | | | | | | | | | | * main.cxx (main): For "-d /path" arguments, enable task finder. * runtime/sym.h (_stp_module): Add *vmcb member. * task_finder{.cxx,.h} (emit_vma_callback_probe_decl): Zap. * tapset-itrace.cxx, tapset-utrace.cxx: Use unwindsyms_modules instead. * tapsets.cxx (uprobe::emit_module_decls): Ditto. * translate.cxx (emit_module_init): Emit task finder registrations for vmcb's associated with _stp_modules. (dump_unwindsyms): Associate vmcbs with user-space unwindsyms entries.
* PR6961: gcc warning tweakFrank Ch. Eigler2009-07-171-3/+4
| | | | * sym.c (_stp_usymbol_print): Ditto.
* PR6961: gcc warning tweakFrank Ch. Eigler2009-07-171-3/+4
| | | | * sym.c (_stp_symbol_print): (Redundantly) initialize locals.
* Merge commit 'origin/master' into pr7043David Smith2009-05-211-54/+166
|\ | | | | | | | | | | | | Conflicts: runtime/print.c runtime/transport/transport.c runtime/transport/transport_msgs.h
| * PR10081: improve error message for verifying build-idWenji Huang2009-04-261-28/+23
| | | | | | | | | | | | | | Output debuginfo file name and build-id if verification failed. * runtime/sym.c: Print more info if not matched.
| * Add ubacktrace(), print_ustack() and print_ubacktrace().Mark Wielaard2009-04-211-0/+26
| | | | | | | | | | | | | | | | * 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.
| * Pass task to _stp_func_print and _stp_kallsyms_lookup.Mark Wielaard2009-04-191-2/+3
| | | | | | | | | | | | | | | | | | * runtime/sym.c (_stp_func_print): Take task, pass to _stp_kallsyms_lookup. * runtime/stack.c (print_stack_address): Pass NULL. * runtime/stack-i386.c (_stp_stack_print_fallback): Pass NULL. (__stp_stack_print): Pass NULL or current. * runtime/stack-x86_64.c (_stp_stack_print_fallback): Pass NULL. (__stp_stack_print): Pass current.
| * Make sure addr falls inside section in _stp_mod_sec_lookup.Mark Wielaard2009-04-141-14/+10
| | | | | | | | | | * runtime/sym.c (_stp_mod_sec_lookup): Use section size to match addr. Only return exact matches, not just closes offset.
| * Only set sec in _stp_mod_sec_lookup when not NULL.Mark Wielaard2009-04-141-1/+2
| | | | | | | | * runtime/sym.c (_stp_mod_sec_lookup): Only set sec when not NULL.
| * Make sure code using the vma tracker compiles again.Mark Wielaard2009-04-081-2/+0
| | | | | | | | | | | | | | | | * runtime/runtime.h: Include task_finder.c. * runtime/sym.c: Always define task_finder callbacks for usage in tapsets. * runtime/task_finder.c: Define dummy stap_task_finder_target when ! defined(CONFIG_UTRACE). * tapsets.cxx: Never include task_finder.c directly.
| * Fix DEBUG_TASK_FINDER_VMA compilation.Mark Wielaard2009-04-081-1/+1
| | | | | | | | * runtime/sym.c (_stp_tf_mmap_cb): We get passed vm_flags, not flags.
| * Added '#ifdef STP_NEED_VMA_TRACKER' around code that needs it.David Smith2009-04-081-1/+2
| | | | | | | | | | | | | | 2009-04-08 David Smith <dsmith@redhat.com> * runtime/sym.c: Added '#ifdef STP_NEED_VMA_TRACKER' around code that needs it.
| * Use _stp_snprintf in _stp_symbol_snprint.Mark Wielaard2009-04-081-2/+2
| | | | | | | | * runtime/sym.c (_stp_symbol_snprint): Use _stp_snprintf, no _stp_printf.
| * Track VMA per pid (group_leader/tgid).Mark Wielaard2009-04-071-5/+6
| | | | | | | | | | * runtime/sym.c (_stp_tf_vm_cb): Add and remove tsk->group_leader. (_stp_mod_sec_lookup): find vma for task->group_leader.
| * PR 9940. Rearchitected task_finder.c a bit.David Smith2009-04-071-23/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-04-07 David Smith <dsmith@redhat.com> PR 9940. * tapsets.cxx (emit_vma_callback_probe_decl): Initialized new callbacks. (utrace_derived_probe_group::emit_probe_decl): Ditto. (uprobe_derived_probe_group::emit_module_decls): Uses new callback. Makes sure mapping is executable before trying to set a probe in it. (itrace_derived_probe_group::emit_module_init): Calls _stp_sym_init(). (utrace_derived_probe_group::emit_module_init): Ditto. (uprobe_derived_probe_group::emit_module_init): Ditto. * runtime/sym.c: Moved task_finder_vma.c inclusion here from task_finder.c. (_stp_sym_init): New function. (_stp_tf_mmap_cb): New function that replaces _stp_tf_vm_cb. (_stp_tf_munmap_cb): Ditto. * runtime/task_finder.c: Removed task_finder_vma.c inclusion. Split vm_callback into 3 callbacks: mmap_callback, munmap_callback, and mprotect_callback. (stap_register_task_finder_target): Initializes new events variables for the new callbacks. (__STP_TASK_VM_BASE_EVENTS): No longer specifies syscall entry events. (__stp_call_mmap_callbacks): New function. (__stp_call_mmap_callbacks_with_vma): Ditto. (__stp_call_munmap_callbacks): Ditto. (__stp_call_mprotect_callbacks): Ditto. (__stp_call_vm_callbacks): Removed. (__stp_utrace_task_finder_target_quiesce): Calls __stp_call_mmap_callbacks() instead of __stp_call_vm_callbacks(). (__stp_utrace_task_finder_target_syscall_entry): Removed function. (__stp_utrace_task_finder_target_syscall_exit): Reports raw mmap()/mprotect()/munmap() events.
| * PR6580: Implement symname, symdata and modname context functions.Mark Wielaard2009-04-021-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * Move _stp_tf_vm_cb to sym.c.Mark Wielaard2009-03-201-0/+34
| | | | | | | | | | | | * tapsets.cxx (utrace_derived_probe_group::emit_module_decls): Remove output task finder vma callback _stp_tf_vm_cb. * runtime/sym.c (_stp_tf_vm_cb): And add it here.
| * Initialize user and vm_start before use.Mark Wielaard2009-03-191-3/+2
| | | | | | | | * runtime/sym.c (_stp_mod_sec_lookup): Initialize user and vm_start.
| * Get rid of __stp_tf_get_vma_entry_addr function.Mark Wielaard2009-03-191-12/+16
| | | | | | | | | | | | | | | | * runtime/task_finder_vma.c (__stp_tf_get_vma_entry_addr): Deleted. (struct __stp_tf_vma_entry): Replace module by user void* field. (stap_add_vma_map_info): Take a void *user arg. (stap_find_vma_map_info): Take a void **user arg. * runtime/sym.c (_stp_mod_sec_lookup): Use stap_find_vma_map_info.
| * Merge branch 'master' into pr6866Mark Wielaard2009-02-201-7/+5
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: ChangeLog: Removed runtime/ChangeLog: Removed runtime/sym.c: Merged runtime/task_finder.c: Merged tapset/ChangeLog: Removed testsuite/ChangeLog: Removed
| * | Always include task_finder.c and enable emit_vm_callback_probe_decl.Mark Wielaard2008-12-151-1/+3
| | |
| * | PR6866: First pass at translating addresses to symbol names through vma.Mark Wielaard2008-12-101-6/+26
| | |
* | | Major hacking to minimal config.David Smith2009-02-241-0/+1
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-02-24 David Smith <dsmith@redhat.com> * print.h: New file. * print.c: Includes new print.h file. * print_new.c (stp_print_flush): Commented out some code that needs replacing. * sym.c: Includes sym.h. * transport/debugfs.c: Includes transport.h. * transport/relayfs.c: Updated _stp_get_root_dir() call. * transport/transport.c: Ifdef'ed out most setup. * transport/transport.h: Ifdef'ed out all but basics. * transport/utt.c (utt_create_tree): Updated _stp_get_root_dir() call. * transport/utt.h: Commented out 'rchan' in struct utt_trace. (utt_reserve): Ifdef'ed out guts.
* | Removed unused functions and variables.David Smith2009-02-181-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-02-18 David Smith <dsmith@redhat.com> * io.c (_stp_log): Removed unused function. * map.c (_stp_cmp): Replace _stp_log() with dbug(). * mempool.c (_stp_mempool_resize): Removed unused function. * print.c (next_fmt): Removed unused function. * procfs.c: Removed unused variable '_stp_num_procfs_files'. * regs.c (_stp_ret_addr): Removed unused function. * string.c (_stp_text_str): Removed unused variable 'len'. * string.h: Removed unused variable '_stdout_' and function declaration for deleted function '_stp_vsprintf'. * sym.c: Removed unused variables. * unwind.c (_stp_create_unwind_hdr): Removed unused function. 2009-02-18 David Smith <dsmith@redhat.com> * control.c: Removed unused variable '_stp_current_buffers'. * procfs.c (_stp_set_buffers): Removed unused function. (_stp_register_ctl_channel_fs): Removed unused variables and label. * symbols.c (u32_swap): Removed unused function. (generic_swap): Ditto. (_stp_sort): Ditto. (_stp_section_is_interesting): Ditto. * transport.c (_stp_transport_init): Removed unused variable 'ret'.
* | Use 'static' as much as possibleJosh Stone2009-01-281-4/+4
|/ | | | | | | | | | This change just inserts 'static' on runtime, tapset, and generated C functions and globals, so the compiler can do a better job of optimizing. My tests with small scripts show ~10% reduction in compile time and ~20% reduction in module size. Larger scripts may show less benefit, but I expect purely positive results.
* PR4886: enable assertive build-id checking for new kernelsFrank Ch. Eigler2008-11-261-2/+11
|
* PR4886: weaken build-id failure semanticsFrank Ch. Eigler2008-10-071-33/+27
|
* PR4886: check build-id if able.Wenji Huang2008-10-061-0/+66
| | | | This provides sanity check of debuginfo file based on build-id. Many cases are considered, whether build-id exists in debuginfo file or not, whether module is loaded or not, whether build-id exists in runtime kernel/module. It will do work when LD >= 2.18 and kernel >=2.6.23, otherwise no check.
* Add new function _stp_mod_sec_lookup extracted from _stp_kallsyms_lookup.Mark Wielaard2008-09-101-23/+32
|
* Correct this_section_offset calculation in _stp_kallsyms_lookup.Mark Wielaard2008-09-091-1/+1
|
* support multiple-relocatable-section modules such as hypothetical ↵Frank Ch. Eigler2008-07-171-52/+49
| | | | -ffunction-sections .ko's
* avoid appearing to succeed in stp_relocation() of a symbol for a module that ↵Frank Ch. Eigler2008-07-041-0/+4
| | | | is not known to be loaded
* emit all symbol tables at compile time; don't do any module munging; new ↵Frank Ch. Eigler2008-07-041-95/+45
| | | | unwinder still disabled
* STP_RELOCATE message for kernel relocatability (re)adaption, starting ↵Frank Ch. Eigler2008-06-291-4/+7
| | | | implementation
* 2.6.25 fixes and stack level limits.Martin Hunt2008-04-151-2/+3
|
* rebased unwind_branch on top of current masterFrank Ch. Eigler2008-03-251-3/+3
|
* 2008-02-27 Martin Hunt <hunt@redhat.com>hunt2008-02-271-91/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | * sym.h (_stp_module): Add text_size, lock, and unwind data pointer. * sym.c (_stp_find_module_by_addr): New function. (_stp_kallsyms_lookup): Call _stp_find_module_by_addr(). (_stp_get_unwind_info): New. * runtime.h: Move debug macros to debug.h. Include it. * debug.h: New file. * map.c: Update debug calls. * map-gen.c: Update debug calls. * pmap-gen.c: Update debug calls. * mempool.c: New file. * symbols.c: Use rwlocks. Use new dbug macros. Handle unwind info if present. * transport.c: Include mempool.c. Update dbug and kbug calls to new macros. * transport_msgs.h (_stp_command_name): Add struct containing message names for debugging. * control.c, procfs.c: Use new dbug macros. Use new mempool functions.