summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
Commit message (Collapse)AuthorAgeFilesLines
...
* Handle .probes section big endian 32 bit case.Stan Cox2009-12-091-1/+9
| | | | | | 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.
* Add .library("lib").mark("mark") and use it for .mark semaphores.Stan Cox2009-12-081-66/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix PR 11034 by directly allocating per-cpu context data.David Smith2009-12-021-1/+1
| | | | | | | | | | | * translate.cxx (emit_common_header): Change type of 'contexts' to an array of struct context pointers. (emit_module_init): Allocate a context structure for each possible cpu. Free each if an error occurs. (emit_module_exit): Update contexts reference. Free each possible cpu's context structure. * tapsets.cxx (common_probe_entryfn_prologue): Use array instead of percpu data for context structure.
* PR10983: Give preference to tracepoints in trace/events/Josh Stone2009-11-181-2/+2
| | | | | | | | In 2.6.32-rc7, there are two power.h tracepoints headers, and only the one in trace/events/ is valid. In general, we can expect that trace/events/ has newer headers, so we should search those first. * tapsets.cxx (tracepoint_builder::init_dw): Search /events/ first.
* PR5916: Exploit kretprobe data storage areaJosh Stone2009-11-101-27/+160
| | | | | | | | | | | | | | | | | | | | Since 2.6.25, kretprobes can carry a data packet to be filled in an entry_handler. This patch lets us store our implicitly-saved $target variables in .return probes in that data area. * tapset/kretprobe.stp: New get/set functions for kretprobe data. * translate.cxx (c_unparser::emit_common_header): Add context->pi_longs. * tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol_saved_return): Switch between the old and new methods of saving $vars in .return probes. (dwarf_var_expanding_visitor::gen_mapped_saved_return): The old way. (dwarf_var_expanding_visitor::gen_kretprobe_saved_return): The new way. (dwarf_derived_probe::join_group): Don't register paired entry-handlers. (dwarf_derived_probe::dwarf_derived_probe): Remember saved-var details. (dwarf_derived_probe_group::emit_module_decls): Output saved-var details. Also split the kretprobe handler whether we're on entry or return. (dwarf_derived_probe_group::emit_module_init): Prepare the entry handler. * testsuite/systemtap.base/kretprobe-vars.stp: Test implicit $var saving.
* PR10877: Give token* to each component instead of each probe_pointCharley Wang2009-11-101-2/+2
|
* Merge branch 'master' of ssh://sources.redhat.com/git/systemtapDave Brolley2009-11-091-4/+16
|\
| * Fix a comment typoJosh Stone2009-11-061-1/+1
| |
| * expand comment on has_return=0 treatment of -L foo.return probesFrank Ch. Eigler2009-11-061-3/+7
| |
| * Constrain $var-checking for -L of .return probesJosh Stone2009-11-061-10/+10
| | | | | | | | | | | | | | | | | | Normally, using a $var in a return probe create a matching entry probe to save the value. We don't want all this machinery though when we're just checking the accessibility of a $var for -L mode. * tapsets.cxx (dwarf_derived_probe::saveargs): Save/restore has_return while the $var accesses are attempted.
| * PR10849: Support MAXSKIPPED handling on RHEL4 through implementation of ↵Roland Grunberg2009-11-061-2/+2
| | | | | | | | atomic_cmpxchg
| * PR10820-cont': initialize the fields of empty tokenWenji Huang2009-11-061-0/+8
| | | | | | | | * tapsets.cxx (dwarf_derived_probe::saveargs): fill fields.
* | Don't reference global variable modpath in insert_module and its helpers.Dave Brolley2009-11-091-0/+30
|/ | | | | | | | | | | This allows insert_module to to be used for loading the signed uprobes.ko module. Allow the use of $$parms and $$return in uprobes based probes for unprivileged users. Re-add management of module signatures in the cache. Don't know why it was removed.
* PR10466: print the set-intersection of variables retrieved from each branchWenji Huang2009-11-041-11/+9
| | | | | | | * elaborate.h: Remove printargs and add getargs. * tapset-mark.cxx (mark_derived_probe): Ditto. * tapsets.cxx (dwarf_derived_probe,tracepoint_derived_probe): Ditto. * main.cxx (printscript): Make intersection before printing.
* PR10849: make MAXSKIPPED overflow trigger an error messageCharley Wang2009-11-021-4/+4
|
* PR10839: compute default KRETACTIVE from num_possible_cpus() instead of NR_CPUSFrank Ch. Eigler2009-10-301-2/+2
| | | | * tapsets.cxx (dwarf_ and kprobe_derived_probe_group): Redefine KRETACTIVE.
* PR10820: stap -L ignores any variable that isn't accessibleWenji Huang2009-10-291-6/+19
| | | | * tapsets.cxx (saveargs): check the accessibility.
* Improve some runtime struct layoutsJosh Stone2009-10-191-1/+1
| | | | | | | | | | | | | | Guided by pahole, I've shaved off a few padding bytes here and there. New sizes on x86_64: stap_task_finder_target 192 -> 184 stap_itrace_probe 216 -> 208 stap_utrace_probe 328 -> 312 stap_uprobe_tf 200 -> 192 stap_uprobe_spec 48 -> 40 I only changed field layouts, not types or names, so this should be perfectly safe. (FLW)
* provide error message token/context if loc2c doesn'tFrank Ch. Eigler2009-10-191-0/+1
| | | | | * tapsets.cxx (visit_target_symbol): When catching semantic_error, fill in token value if unset. Can happen for loc2c DIE() msgs.
* Fix $$targets in dwarf probesJosh Stone2009-10-141-1/+1
| | | | | | My print_format refactoring in d5e178c1 missed an improperly-named token, an sprint that should be sprintf. Since the token value is now significant, that name needs to be correct.
* Consolidate print_format creationJosh Stone2009-10-131-15/+2
| | | | | | | | | | | | | | | | | | We almost had a factory in print_format::parse_print, so let's take that the rest of the way. This way we don't have so much duplication in initializing the print flags. * staptree.cxx (print_format::parse_print): Replaced with... (print_format::create): New factory to parse and create print_formats. * elaborate.cxx (add_global_var_display): Use this factory. * parse.cxx (parser::parse_symbol): Ditto. * tapset-mark.cxx (mark_var_expanding_visitor::visit_target_symbol_context): Ditto. * tapset-utrace.cxx (utrace_var_expanding_visitor::visit_target_symbol_arg): Ditto. * tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol_context): Ditto. (tracepoint_var_expanding_visitor::visit_target_symbol_context) Ditto.
* Merge branch 'master' of ssh://sources.redhat.com/git/systemtapDave Brolley2009-10-131-4/+6
|\
| * PR10746: improve error message on utrace-less kernelsFrank Ch. Eigler2009-10-081-0/+3
| | | | | | | | | | | | | | * tapset-itrace.exp (itrace_derived_probe ctor): Fail if !CONFIG_UTRACE. * tapset-utrace.exp (utrace_derived_probe ctor): Fail if !CONFIG_UTRACE. * tapsets.cxx (dwarf_builder::build): Fail process.* if !CONFIG_UTRACE. * testsuite/semko/utrace.stp: New test.
| * Remove the global derived_probe->semaphore mapJosh Stone2009-10-061-4/+3
| | | | | | | | | | | | | | | | | | | | Instead just make the semaphore address a member of derived_probe. * session.h (systemtap_session): Remove the map sdt_semaphore_addr. * elaborate.h (derived_probe): Add sdt_semaphore_addr directly. * tapsets.cxx (sdt_query::record_semaphore): Write the addr directly. (uprobe_derived_probe_group::emit_module_decls): Read it directly. * tapset-utrace.cxx (utrace_derived_probe_group::emit_probe_decl): Ditto
* | Ensure that unprivileged-authorized probe point functions are hashed differentlyDave Brolley2009-10-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | than non-authorized ones for the purpose of removing duplicates. 2009-10-13 Dave Brolley <brolley@redhat.com> * elaborate.h (print_dupe_stamp_unprivileged): New static method of derived_probe. (print_dupe_stamp_unprivileged_process_owner): Likewise. * elaborate.cxx (print_dupe_stamp_unprivileged): New static method of derived_probe. (print_dupe_stamp_unprivileged_process_owner): Likewise. * tapset-been.cxx (print_dupe_stamp): New virtual method of be_derived_p robe and never_derived_probe. * tapset-utrace.cxx (print_dupe_stamp): New virtual method of utrace_der ived_probe * tapset-itrace.cxx (itrace_derived_probe::emit_unprivileged_assertion): Removed. (itrace_builder::check_unprivileged): Removed. * tapsets.cxx (print_dupe_stamp): New virtual method of uprobe_derived_p robe
* | Generate safety net assertions in probe function not authorized for ↵Dave Brolley2009-10-091-29/+33
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | unprivileged users. 2009-10-08 Dave Brolley <brolley@redhat.com> * elaborate.h (emit_unprivileged_assertion): New virtual method of deriv ed_probe. (emit_process_owner_assertion): New static method of derived_probe. (check_unprivileged): New virtual method of derived_probe_builder. (match_node::unprivileged_ok): Removed. (match_node::allow_unprivileged): Removed. (match_node::unprivileged_allowed): Removed. * elaborate.cxx (translate.h): #include it. (emit_unprivileged_assertion): New virtual method of derived_probe. (emit_process_owner_assertion): New static method of derived_probe. (check_unprivileged): New virtual method of derived_probe_builder. (match_node::unprivileged_ok): Removed. (match_node::allow_unprivileged): Removed. (match_node::unprivileged_allowed): Removed. (find_and_build): Don't check for unprivileged restrictions here. Call t he builder's check_unprivileged method. (alias_expansion_builder::check_unprivileged): New virtual method. * tapset-been.cxx (be_derived_probe::emit_unprivileged_assertion): New v irtual method. (be_builder::check_unprivileged): Likewise. (never_derived_probe::emit_unprivileged_assertion): Likewise. (never_builder::check_unprivileged): Likewise. (register_tapset_been): Don't call allow_unprivileged. * tapset-itrace.cxx (itrace_derived_probe::emit_unprivileged_assertion): New virtual method. (itrace_builder::check_unprivileged): Likewise. (register_tapset_itrace): Don't call allow_unprivileged. * tapset-utrace.cxx (utrace_derived_probe::emit_unprivileged_assertion): New virtual method. (utrace_builder::check_unprivileged): Likewise. (register_tapset_utrace): Don't call allow_unprivileged. * tapset-timer.cxx (timer_derived_probe::emit_unprivileged_assertion): N ew virtual method. (timer_builder::check_unprivileged): Likewise. (register_tapset_timers): Don't call allow_unprivileged. * tapsets.cxx (uprobe_derived_probe::emit_unprivileged_assertion): New v irtual method. (uprobe_builder::check_unprivileged): Likewise. (register_standard_tapsets): Don't call allow_unprivileged. (register_statement_variants): Remove unprivileged_ok_p parameter. Don't call allow_unprivileged. (register_function_variants): Likewise. (register_function_and_statement_variants): Likewise. (register_patterns): Don't call allow_unprivileged. * translate.cxx (emit_probe): Call v->emit_unprivileged_assertion.
* PR10726: Get the correct scope for statement(NUM)Josh Stone2009-10-051-230/+217
| | | | | | | | | | | | | | | | | | | | The problem in this bug is that our statement(NUM) lookup was only searching for the outermost function (not inlined) which contains the PC in question. When that PC happens to be the beginning of the function and also the beginning of an inline, the caching was using the wrong variable scope. The function/statement(NUM) lookup has been rewritten to bypass all of the CU and function iteration, and just go straight to a getscopes(pc) lookup, so it will now always use the innermost containing die for the variable scope. * tapsets.cxx (query_addr): New, short-circuit for numeric probes. (dwarf_query::query_module_dwarf): Route num probes to query_addr. (query_label): Assume now that we only need to handle _str probes. (query_dwarf_inline_instance): Ditto. (query_dwarf_func): Ditto. (query_cu): Ditto.
* Add DEBUG_UPROBES for sdt semaphores.Stan Cox2009-10-011-0/+7
| | | | | | * tapsets.cxx (uprobe_derived_probe_group::emit_module_decls): Add DEBUG_UPROBES for sdt semaphores * dtrace.in (main): Add -k option to keep around the temp files.
* * tapsets.cxx (sdt_query::record_semaphore): Adjust addr relative toStan Cox2009-09-281-2/+6
| | | | relocation base.
* Simplify copy_file callsJosh Stone2009-09-281-20/+5
| | | | | | | | | | | | | | Every single copy_file call we had was converting strings to char*, printing the same error message, and optionally printing the same verbose string. Let's canonicalize that. * util.cxx (copy_file): Take string filenames, add a verbose flag, and consolidate the message printing. * cache.cxx (add_to_cache): Pass strings and remove message printing. (get_from_cache): Ditto. * main.cxx (main): Ditto. * tapsets.cxx (tracepoint_builder::get_tracequery_module): Ditto. (dwarf_cast_expanding_visitor::filter_special_modules): Ditto.
* Try to build tracequery for all headers at onceJosh Stone2009-09-281-15/+43
| | | | | | | | | | | | | | | | | | | | | | To mitigate PR10424, we switched to building a separate tracequery module for each tracepoint header, so a bad header wouldn't break all of the others. However, with recent kernels that leads to ~18 make commands, which adds up quickly in time. It's cached, so that's not too bad, but as a developer who rebuilds stap frequently, it gets annoying. If we're going to call 18 makes, it's worth it to start with one bigger make that covers all the headers at once (like we used to). If that one fails, we can still fall back to compiling individually. FWIW, the failing ext4.h header was only created in 2.6.31, and was fixed before 2.6.32, so the specific failure in PR10424 has a fairly small window. * buildrun.cxx (make_tracequery): Just take a single vector of headers. * hash.cxx (find_tracequery_hash): Deal with multiple headers. * tapsets.cxx (tracepoint_builder::get_tracequery_module): Ditto. (tracepoint_builder::init_dw): Attempt all system headers together, and if that fails, try again individually.
* Factor out duplicated code to setup user/module Dwfl from dwflpp/translate.Mark Wielaard2009-09-291-1/+2
| | | | | | | | | * setupdwfl.h: Add setup_dwfl_user() and is_user_module(). * setupdwfl.cxx: Likewise. * dwflpp.cxx (setup_user): Use setup_dwfl_user(). * translate.cxx (emit_symbol_data): Likewise and is_user_module(). * tapsets.cxx (dwarf_cast_expanding_visitor::visit_cast_op): Use is_user_module().
* Use dwlpp::setup_kernel for tracepoint modules.Mark Wielaard2009-09-281-1/+1
| | | | | | | | | | | Tracepoint modules ended up going through dwflpp::setup_user() because there was no setup_kernel that takes a list of module names. * dwflpp.h: Add kernel_p bool to constructor that takes a module list. Add setup_kernel() variant that takes a module list. * dwflpp.cxx: Likewise. * tapsets.cxx (tracepoint_builder::init_dw): Call dwflpp constructor indicating we expect kernel modules.
* optimization: reduce generated C code sizeFrank Ch. Eigler2009-09-221-4/+3
| | | | | * tapsets.cxx (uprobe_derived_probe_group::emit_module_decls): Don't emit unnecessary 0 initializers for .tfi and .sdt_semaphore_addr.
* Fix uninitialized line numbers in the function specJosh Stone2009-09-181-1/+4
| | | | | | | | | The rewrite of parse_function_spec left the line numbers uninitialized when not used, but elsewhere was depending on that. Fix the uninit, and also don't depend on it. * tapsets.cxx (dwarf_query::parse_function_spec): Init line stuff. (query_cu): Branch on the spec_type, not the line contents.
* PR10655 part 1: uprobes: track sdt semaphores properlyFrank Ch. Eigler2009-09-181-35/+47
| | | | | | | | | | | | | | | | | | | commit 6846cfc8 introduced an unintended side-effect where semaphore tracking was identified with stap_uprobe_specs[] elements, which are normally static/const. This kernel patch <http://article.gmane.org/gmane.linux.kernel/854187> catches and panics on this. The cure is to move the variable over to the stap_uprobes[] array. * tapsets.cxx (uprobe emit_module_decls): Add sdt_sem_address to stap_uprobe{} struct, to contain per-process relocated semaphore address. (emit_module_decls,_init): Remove tsk field, restore constness of appropriate locals. Activate uprobe semaphore right around uprobe activation time. Remove semaphore clearing upon process exit, since by then it's gone. (emit_module_exit): Use remembered relocated semaphore address to clean up. Fix "-uprobe" DEBUG_UPROBES message. * runtime.h: #include <linux/sched.h>. * dtrace.in (*_semaphore): Make it an unsigned short - intended 16 bits on all common architectures/multilibs.
* Simplify the sdt semaphore decrement in utraceJosh Stone2009-09-171-0/+3
| | | | | | | | | | | | | | | | The decrement can happen at the same time that the utrace detach is called. However, I'm concerned that this code isn't correctly handling the case where multiple tasks may register the same probe, so for now I've noted those places. I think task finder may have to help in fixing this... * tapset-utrace.cxx (utrace_derived_probe_group::emit_module_init): As noted in uprobes-land, there's no need to tear down anything. (utrace_derived_probe_group::emit_module_exit): Unify the detach and semaphore decrement, and note a concern about multiple tasks. (utrace_derived_probe_group::emit_module_decls): Note same concern. * tapsets.cxx (uprobe_derived_probe_group::emit_module_decls): Ditto. (uprobe_derived_probe_group::emit_module_exit): Ditto.
* Simplify sdt's record_semaphoreJosh Stone2009-09-171-16/+5
| | | | * tapsets.cxx (sdt_query::record_semaphore): Use lookup_symbol_address.
* Map std semaphores from probe->addrJosh Stone2009-09-171-24/+16
| | | | | | | | | | | | | Each probe needs to know the associated semaphore address, rather than the other way around. * session.h (sdt_semaphore_addr): Reverse the key-value types. * tapsets.cxx (record_semaphore): Take an index to only record the semaphore for newly added results. (sdt_query::handle_query_module): Adjust accordingly. (uprobe_derived_probe_group::emit_module_decls): Now it's a simple map lookup for sdt_sem_address. * tapset-utrace.cxx (utrace_derived_probe_group::emit_probe_decl): Ditto.
* Merge branch 'function_scopes'Josh Stone2009-09-161-71/+106
|\
| * PR10461: Match C++ scopes for namespaces and classesJosh Stone2009-09-161-71/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function spec for dwarf probes now supports scopes, so you can limit the probes to specific namespaces or classes. Multiple scopes can be specified, and they will be matched progressively outward. probe process("foo").function("std::vector<*>::*") { ... } probe process("foo").function("::global_function") { ... } * dwflpp.cxx (dwflpp::get_parent_scope): New, finds the containing scopes of the specified DIE. (dwflpp::function_scope_matches): New, checks that the scopes containing the function all match the given scope patterns. * tapsets.cxx (dwarf_query::parse_function_spec): Rewrite, now handles multiple scope separators too. (query_dwarf_func): Check that the functions scopes match.
* | * sdt.h (STAP_SEMAPHORE): New. Add guard to utrace probe points.Stan Cox2009-09-161-5/+81
|/ | | | | | | | | | | | | | * itrace.h (__access_process_vm): Moved from here... * runtime/access_process_vm.h: New. ...to here. * translate.cxx (translate_pass): Include access_process_vm.h * session.h (sdt_semaphore_addr): New. * tapsets.cxx (sdt_query::record_semaphore): New. Record sdt_semaphore_addr. (uprobe_derived_probe_group::emit_module_decls): Allow for uprobe guard variable to be set and unset. (uprobe_derived_probe_group::emit_module_decls): Likewise. (uprobe_derived_probe_group::emit_module_exit): Likewise. * tapset-utrace.cxx (utrace_derived_probe_group::emit_probe_decl): Likewise. (utrace_derived_probe_group::emit_module_decls): Likewise. (utrace_derived_probe_group::emit_module_exit): Likewise.
* Remove function comparison from label iterationJosh Stone2009-09-151-4/+19
| | | | | | | | | | | We already have filtered functions and inlines, so just iterate in each of those to look for labels. * dwflpp.cxx (dwflpp::iterate_over_labels): Assume that the die we're looking at is already a matching function, and don't descend into inlined functions in this body. * tapsets.cxx (query_srcfile_label): Iterate through inlines too. (query_cu): Iterate over functions and inlines instead of the CU.
* Merge branch 'master' of ssh://sources.redhat.com/git/systemtapFrank Ch. Eigler2009-09-151-256/+120
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'master' of ssh://sources.redhat.com/git/systemtap: (34 commits) Update the langref copyright notice Fix some probe examples in the language reference Remove automatic authorization of servers started by root as trusted signers. docs: add abnormal termination section to PROCESSING Remove unneeded header file Get the module to sign from -p4's stdout Move --unprivileged support news to the top. Firther updates to NEWS regarding signing and unprivileged users. Authorize new certificates created for servers started by root as authorized signers. 2009-09-14 Dave Brolley <brolley@redhat.com> Allow remaining process.* probes for unprivileged users. Use the sched_switch tracepoint if available. PR10608: mark test cases untested once compilation failed Make check.exp not sleep so much in test_installcheck. Make tracepoints.exp test more efficient by running as one giant script. Only test highest optimization for exelib.exp test. Replace small exelib.exp testcases with one jumbo testcase. Remove duplicate uprobe_derived_probe code Add semaphores for use with the forthcoming sdt marker checks. Add actual pc address to semantic error about inaccessible variables. ... Conflicts: tapsets.cxx
| * Merge branch 'master' of ssh://sources.redhat.com/git/systemtapDave Brolley2009-09-141-274/+100
| |\
| | * Remove duplicate uprobe_derived_probe codeJosh Stone2009-09-111-219/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Much of uprobe_derived_probe is a straight copy of dwarf_derived_probe, and some of the comments even acknowledge this. I'm instead making this an inheritance, so the duplication can be chopped away. * tapsets.cxx (struct dwarf_derived_probe): Reorganize for inheritance. (dwarf_derived_probe::dwarf_derived_probe): Adapt to handle process. (struct uprobe_derived_probe): Inherit from dwarf_derived_probe and remove duplicate members and methods. (uprobe_derived_probe::emit_module_decls): Member name changes.
| | * PR10594 cont'd: Use parent die cache for variable lookupJosh Stone2009-09-101-2/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Variable lookup is usually done through the scopes from dwarf_getscopes at a particular pc. This requires an expensive traversal to find the inner-most die containing the pc. For cases where that containing die is known, e.g. at a particular function entry, we can do much better with our die_parent_cache. This may also help get more accurate variable scopes in cases where multiple dies contain a pc and the innermost isn't what we're trying to probe. For example, an inlined call chain of foo->bar->baz may all have the same entry pc, but if the probe was on function("bar"), we would want the variables in bar's scope, not baz's. * dwflpp.h (struct dwflpp): Remove pc_cached_scopes, num_cached_scopes, and cached_scopes, as they are now remembered by the caller. * dwflpp.cxx (dwflpp::getscopes): New - the DIE version uses the parent cache, and the pc version just defers to dwarf_getscopes. (dwflpp::print_locals, literal_stmt_for_local): Take a scopes vector. (dwflpp::find_variable_and_frame_base): Take a scopes vector from the caller instead of computing it every time. (dwflpp::dwarf_getscopes_cached): Removed. * tapsets.cxx (dwarf_var_expanding_visitor::getscopes): New cached lookup function which gets the scopes from the DIE if possible. (dwarf_var_expanding_visitor::visit_target_symbol): Call getscopes.
| | * Simplify deleting all map valuesJosh Stone2009-09-101-2/+1
| | | | | | | | | | | | | | | | | | * util.h (delete_map): New templated map deleter. * dwflpp.cxx (dwflpp::~dwflpp): Use it. * tapsets.cxx (symbol_table::~symbol_table): Use it.
| | * PR10594: Provide a cached dwarf_getscopes_dieJosh Stone2009-09-101-15/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This avoids repeated DIE traversal by caching all parents on the first call, so future calls are just a simple walk up parent links. * dwflpp.cxx (dwflpp::getscopes_die): New cached function that mimics libdw's dwarf_getscopes_die using cached parent links. (dwflpp::cache_die_parents): New function to build the parent cache. (dwflpp::~dwflpp): Clean up the parent caches. (dwflpp::iterate_over_labels): Use the cached getscopes_die. (dwflpp::find_variable_and_frame_base): Ditto. * tapsets.cxx (dwarf_derived_probe::saveargs): Ditto. (uprobe_derived_probe::saveargs): Ditto. (dwarf_var_expanding_visitor::visit_target_symbol_context): Ditto.
| * | Allow remaining process.* probes for unprivileged users.Dave Brolley2009-09-141-6/+17
| | |