| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When we have many individual function lookups, like the nearly 1000 with
syscall.*, each one will iterate every CU in the module (M) and then do a
cache lookup in N entries. That's a thousand MlogN lookups.
We can instead keep the functions in a module-wide map, and then the
complexity is just a thousand logMN lookups.
Before:
$ ./run-stap -l 'syscall.**' --vp 01 >/dev/null
Pass 2: analyzed script: 793 probe(s), 11 function(s), 20 embed(s),
0 global(s) using 245872virt/147304res/78272shr kb,
in 1390usr/60sys/1448real ms.
After:
$ ./run-stap -l 'syscall.**' --vp 01 >/dev/null
Pass 2: analyzed script: 793 probe(s), 11 function(s), 20 embed(s),
0 global(s) using 246228virt/147616res/78276shr kb,
in 720usr/60sys/782real ms.
* dwflpp.cxx (dwflpp::iterate_single_function): Do a simple function
lookup based on a module-wide cache.
(dwflpp::mod_function_caching_callback): Helper for above.
* tapsets.cxx (dwarf_query::query_module_functions): Query a single
function from the module-wide cache.
(dwarf_query::query_module_dwarf): Use above for simple cases.
|
|
|
|
|
|
| |
* dwflpp.cxx (dwflpp::iterate_over_functions): No caller is using
has_statement_num anymore (since 6b517475), so kill it.
* tapsets.cxx (query_cu): Let the default call rule the day.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds stap_kprobe_process_found and stap_kprobe_mmap_found handlers
and then the task_finder uses those to set the semaphore values.
The probe adds user_path and user_lib which are used by the
task_finder to decide what object to sniff.
* sdt.h (STAP_SEMAPHORE): Also define for kprobes.
* tapsets.cxx (dwarf_derived_probe): Add user_path and user_lib.
(dwarf_derived_probe::join_group): Enable task finder for kprobes.
(dwarf_derived_probe::dwarf_derived_probe): Set user_path and
user_lib.
(dwarf_derived_probe_group::emit_module_decls): Emit
stap_kprobe_mmap_found, sdt_sem_offset, sdt_sem_address, pathname,
and finder declarations. Emit stap_kprobe_process_found and
stap_kprobe_mmap_found.
(dwarf_derived_probe_group::emit_module_init): Setup task finder.
(sdt_query::convert_location): Remove TOK_LIBRARY token.
(dwarf_builder::build): Set user_path and user_lib.
(kprobe_derived_probe): Add path and library.
(kprobe_builder::build): Get process and library params
|
|
|
|
|
|
|
|
|
|
| |
* staptree.h (literal_number): Add a bool "print_hex".
* staptree.cxx (literal_number::print): Switch to hex if needed.
* tapsets.cxx (dwarf_derived_probe::dwarf_derived_probe): Write the
statement number component with a hex literal_number.
(sdt_query::convert_location): Ditto
(kprobe_derived_probe::kprobe_derived_probe): Ditto.
(hwbkpt_derived_probe::hwbkpt_derived_probe): Ditto for data addr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The const_folder is where we prune constant expressions, like
conditionals based on a @defined($foo), so we want to give this a chance
to work before skip-badvars comes in and throws a warning.
As an added bonus, this makes skip-badvars more generic, so it will work
even for non-dwarf $target variables.
* elaborate.cxx (const_folder::visit_target_symbol): Enact skip-badvars.
* tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol): Don't
worry about badvars here anymore. Save the error now, clean up later.
* testsuite/semok/badvar_undefined.stp: Test that @defined with
skip-badvars doesn't throw any warnings.
|
|
|
|
|
|
|
| |
IMO, it's better to contain the CONFIG check inside the perf code.
* tapsets.cxx (register_standard_tapsets): Always call perf register.
* tapset-perfmon.cxx (register_tapset_perf): Do the CONFIG check here.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
SDT and label probes are not really final probe types themselves, but
rather they get translated into some other final type. This patch
preserves this relationship as if SDT and label probes were dynamically
generated aliases.
* elaborate.cxx (probe::create_alias): New, fake an alias_derived_probe.
* tapsets.cxx (query_label): Append the label name as an alias.
(sdt_query::handle_query_module): Let convert_location do the alias.
(sdt_query::convert_location): Translate the location using an alias.
* main.cxx (printscript): Elaborate the derivation debug dump.
|
|
|
|
|
| |
Inspired by the Python equivalents, these new utility functions just
make it a little cleaner to match at the beginning or end of a string.
|
|
|
|
|
|
|
| |
* tapsets.cxx (sdt_query::convert_probe): Fix a few missing tokens.
(sdt_var_expanding_visitor::visit_target_symbol): Ditto.
* translate.cxx (c_unparser::record_actions): Add a defensive check,
which perhaps someday can be an assertion instead.
|
|
|
|
|
| |
* tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol): Don't
squash target_symbol errors in the operand of @defined().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--disable-cache : turn off all caching
--clean-cache : clean up stale entries and then quit
--poison-cache : force regeneration of items that would have hit the cache
These are undocumented for now, until we decide whether they are
generally useful.
* main.cxx (main): Parse the new options.
* session.h (systemtap_session): Add poison_cache; document the others.
* clean.cxx (clean_cache): No longer static.
(get_stapconf_from_cache, get_script_from_cache): Respect poison.
* tapsets.cxx (tracepoint_builder::get_tracequery_module): Ditto.
(dwarf_cast_expanding_visitor::filter_special_modules): Ditto.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* staptree.h (functiondecl): Add a synthetic flag.
* elaborate.cxx (semantic_pass_opt1): Don't warn about synthetic funcs.
* tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol): Mark
the new function as synthetic.
(dwarf_cast_expanding_visitor::visit_cast_op): Ditto.
(tracepoint_var_expanding_visitor::visit_target_symbol_arg): Ditto.
* tapset-perfmon.cxx
(perfmon_var_expanding_visitor::visit_target_symbol): Ditto.
* tapset-procfs.cxx (procfs_var_expanding_visitor::visit_target_symbol):
Ditto.
* testsuite/semok/thirtyeight.stp: New check with -W and @defined.
|
| |
|
|
|
|
|
|
|
|
| |
* tapsets.cxx (var_expanding_visitor::visit_defined_op): If no error was
raised or replacement made on a target_symbol, then its @defined state
is still indeterminate. Some later pass (like @cast) might handle it.
* elaborate.cxx (const_folder::visit_defined_op): Squash any escapees.
* testsuite/semok/thirtysix.stp: Add more variants.
|
|
|
|
|
|
|
|
|
|
| |
We now check validity *before* the entry-probe is generated, so invalid
$vars have a chance to be properly optimized without error.
* tapsets.cxx
(dwarf_var_expanding_visitor::visit_target_symbol_saved_return):
Attempt variable expansion immediately, and skip out on failure.
* testsuite/semok/thirtysix.stp: unblock the previously broken part.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
unresolvable $variables
* staptree.cxx (target_symbol::chain): New function.
* staptree.h: Declare it.
* (*): Use it instead of hand-chaining to target_symbol->saved_conversion_error.
* tapset-mark.cxx (*::visit_target_symbol): Chain resolution error object,
do not throw.
* tapset-procfs.cxx (*::visit_target_symbol): Ditto.
* tapset-utrace.cxx (*::visit_target_symbol): Ditto.
* tapsets.cxx (*::visit_target_symbol): Ditto.
(*::visit_defined_op): Explain & enforce the above.
* testsuite/semok/thirtysix.stp: Expand.
* testsuite/systemtap.base/sdt_misc.exp: Bonus fix: make work with blddir != srcdir.
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* 'master' of ssh://sources.redhat.com/git/systemtap:
PR10719 part 1: Partial constant folding
Simplify null_statement construction
Fixed PR 11269 by properly handling mmap syscall 'fd' argument.
Removed rvalue operator check.
PR 10690 (partial fix). Handle '.=' operator in procfs probes.
Conflicts:
tapsets.h
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* tapsets.h (var_expanding_visitor): Add 'valid_ops' and 'op' member
variables.
* tapsets.cxx (var_expanding_visitor::var_expanding_visitor): Set
'valid_ops' to '='. By default, var_expanding_visitor classes only
handle the '=' operator.
(var_expanding_visitor::visit_assignment): Remember what operator we're
handling. When an operator is found that isn't in the 'valid_ops' set,
error.
* tapset-procfs.cxx
(procfs_var_expanding_visitor::procfs_var_expanding_visitor): Add '.='
to the 'valid_ops' set.
(procfs_var_expanding_visitor::visit_target_symbol): Handle the '.='
operator when the target variable is an lvalue.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* staptree.h (defined_op): New class.
* all files: Extend all visitors as appropriate, mostly
dummy/pass-through implementation.
* parse.cxx (parse_target_symbol): New function, factored out
of parse_symbol().
(parse_define_op): New function.
* NEWS: Mention it.
* parse.h: Corresponding changes.
* tapsets.cxx (var_expanding_visitor::visit_defined_op):
Implement @defined() semantics.
(dwarf_var_expanding_visitor::visit_target_symbol): Adjust.
* tapset-utrace.c (visit_target_symbol_arg): Avoid crashes
on $argZZZ.
* tapsets.cxx (sdt_var_expanding_visitor): Ditto.
* semok/thirtysix.stp: New test.
|
|
|
|
|
|
|
|
|
|
|
| |
* tapsets.cxx (hwbkpt_derivedc_probe_group): Lose max_... field.
Rename hwbkpt_probes_vector -> hwbkpt_probes.
(enroll): Instead set it here, emit normal suppressible warning if
exceeded.
(emit_*): Use newline(NN) etc. for proper indentation of generated code.
(emit_module_init): Defer most potential problems to
register_wide_hw_breakpoint() instead of preemptive errors.
* translate.cxx (emit_module_init): Assert 0 indentation more frequently.
|
| |
|
|
|
|
|
|
| |
* tapsets.cxx (hwbkpt_builder::build): Assert needed
kernel_configs here, instead of..
(register_standard_tapsets): ... here.
|
|
|
|
|
|
|
| |
- Bind unprivileged permission at probe registration time.
- Remove check_unprivileged filter from derived_probe_builder
and its children.
- Add test suites for unprivilegedok and unprivilegedko.
|
|
|
|
|
|
|
|
| |
* tapsets-mark.cxx, tapsets.cxx: Don't even publish probe point families that are
inappropriate for use in --unprivileged mode.
(dwarf_derived_probe_*unprivileged*): Remove, to default to blanket no-permission
rather than emit_process_owner_permission mode.
* testsuite/semko/fortyeight.stp: New test.
|
|
|
|
|
|
| |
Switch to list<string> from set<string> for collecting
available $var lists. Use O(N**2) list-uniqueifier
that preserves initial ordering.
|
| |
|
|
|
|
| |
Part 2]
|
|
|
|
|
|
|
|
|
| |
Our hack for producing nicer listing modes was to write the mark name in
component index 1. That's fine for process.mark, but writes the wrong
position for process.library.mark. It now munges the last probe
component of any number of indexes.
(A better fix is due in PR10831, preserving the derivation chain.)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Our literal_addr_to_sym_addr() function was just wrong. To compensate for
raw addresses read from elf (either given by the user or through a mark
transformation) we need to know what the elf_bias is (as returned by
dwfl_module_getelf) before feeding them to any libdwfl functions.
* tapsets.cxx (query_module_dwarf): Always add elf_bias to raw function or
statement addresses before calling query_addr().
(query_addr): Don't call literal_addr_to_sym_addr().
* dwflpp.h (literal_addr_to_sym_addr): Removed.
* dwflpp.cxx (literal_addr_to_sym_addr): Likewise.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|\ |
|
| |
| |
| |
| |
| |
| | |
* 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.
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tapsets.cxx (uprobe_derived_probe_group::emit_module_decls): Move
sdt_sem_address from standalone to stap_uprobes. Remove sdt_sem_tid.
In emitted function stap_uprobe_change_plus distinguish VM_EXEC/VM_WRITE
cases, use sdt_sem_address member, move setting of semaphores to new
emitted function stap_uprobe_change_semaphore_plus.
(stap_uprobe_process_found): Call stap_uprobe_change_semaphore_plus.
(stap_uprobe_mmap_found): Likewise.
* stap-postgres.stp (postgresrelease): New. Sync to current upstream version.
* stap-tcl.sh: Check if wget failed.
* stap-tcl.stp: Check for skipped probes.
* xulrunner.exp: Check if wget failed.
|
|
|
|
|
|
|
|
| |
* tapsets.cxx (emit_module_decls): #undef TRACE_INCLUDE_FILE
in front of each #include'd trace/event header, to prevent
macro redefinition.
(init_dw): Respect pending_interrupts in traceprobe module
compilation loop.
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* sdt.h (UTRACE_SDT): Remove.
* tapset-utrace.cxx (utrace_derived_probe): Remove has_library and library.
(utrace_derived_probe_group::emit_probe_decl): Remove mmap_callback,
sdt_sem_offset, and sdt_sem_address.
(utrace_derived_probe_group::emit_module_decls): Remove sdt_sem_offset and
sdt_sem_address support.
* tapsets.cxx (sdt_var_expanding_visitor): Remove utrace_probe.
(sdt_query::handle_query_module) Remove utrace_type.
(sdt_query::convert_probe): Likewise.
* postgres.exp: Remove utrace testing.
* sdt.exp: Likewise.
* sdt_misc.exp: Likewise.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
* translate.cxx (translate_pass): Don't #include <access_blah.>
* tapsets.cxx, tapset-utrace.cxx: Replace __access_process_vm()
calls with get_user() / put_user() respectively.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
| |
* runtime/loc2c-runtime.h: Remove k_ vs u_[store_]deref; share instead.
* tapsets.cxx: Remove k_ vs u_ redirection for *deref().
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
| |
* tapsets.cxx (uprobe_derived_probe_group::emit_module_decls): Emit
sdt_sem_tid. Use it to recalculate sem address when task changes.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
tapsets.cxx (sdt_query::handle_query_module): Improve trace handling.
(sdt_query::convert_location): Create new component instead of reusing old.
|
|
|
|
|
|
| |
sdt.h (STAP_PROBE_ADDR): Add 32 bit big endian case.
(STAP_PROBE_DATA_): Use .balign
tapsets.cxx (sdt_query::get_next_probe): Stop if there is no probe name.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
tapset-utrace.cxx (TOK_LIBRARY): New.
(utrace_derived_probe::utrace_derived_probe): Add library and has_library.
(utrace_builder::build): Handle library.
(utrace_derived_probe_group::emit_probe_decl): Add sdt_sem_offset to
emitted stap_utrace_probes. Add stap_task_finder_target
mmap_callback for handling shared library. Handle sdt_sem_offset in
emitted_stp_utrace_probe_cb. Add stap_utrace_mmap_found.
(register_tapset_utrace): Handle .library
tapset-utrace.cxx (TOK_LIBRARY): New.
(base_query::base_query): Add path and has_library.
(dwarf_derived_probe::dwarf_derived_probe) Likewise.
(dwarf_derived_probe::register_patterns): Handle .library
(sdt_query::convert_location): Likewise.
(dwarf_builder::build): Likewise.
(uprobe_derived_probe_group::emit_module_decls): Emit
sdt_sem_address. Add sdt_sem_offset to emitted stap_uprobe_spec.
Add offset and vm_flags to signature of stap_uprobe_change_plus, and
handle sdt_sem_offset. Allow writeable segments in emitted
stap_uprobe_mmap_found.
sdt_misc.exp: Test .library
util.cxx (find_executable): Add env_path to sig and use it in getenv.
util.h (find_executable): Likewise. Make "PATH" the default.
dtrace.in (provider): Turn on semaphores.
sdt.h: Likewise.
|