summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
Commit message (Collapse)AuthorAgeFilesLines
...
| * 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
| | |
* | | PR10642: fix wildcard-driven quadratic explosion of .return $$parms probesFrank Ch. Eigler2009-09-151-44/+47
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For $variables listed in .return probes, a synthetic probe is being created, for saving the named variable values at function entry. However, the probe point for this synthetic probe was copied naively, so that several problems could occur: - if the original probe point contained wildcards, then each synthetic one also did, and was therefore multiply derived later - if the probe point referred to a multiply instantiated function, the synthetic one was not directly identified with it (at the dwarf_addr level) Now the synthetic probe is created more carefully, bypassing any further derivation/expansion processing steps. * tapsets.cxx (dwarf_var_expanding_visitor): Change add_probe to add_call_probe field. (visit_target_symbol_saved_return): Store only the body of the synthetic probe. (dwarf_derived_probe ctor): Create intimately related dwarf_derived_probe for synthetic probe. (uprobe_derived_probe ctor): Ditto.
* | PR10602: improved fix for REG_IP lvalueFrank Ch. Eigler2009-09-091-42/+12
|/ | | | | | | | | * runtime/regs.h (SET_REG_IP): Define. (REG_IP_LVALUE): Undefine. * tapsets.cxx (*::emit_module_decls): Use SET_REG_IP() instead of old LVALUE? conditional. Written by jkenisto & jistone.
* PR10524: reduce massive-uprobe script modules' .data consumptionFrank Ch. Eigler2009-09-081-77/+219
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* PR4186 cont'd: Squash both EM_PPC and EM_PPC64 to powerpc.Mark Wielaard2009-09-081-4/+1
| | | | | * tapsets.cxx (validate_module_elf): Set expect_machine = "powerpc" for both EM_PPC and EM_PPC64 to match session architecture set in main.
* Merge branch 'master' of sourceware.org:/git/systemtapJosh Stone2009-09-031-9/+8
|\
| * Allow process begin/end probes for unprivileged users.Dave Brolley2009-09-031-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-09-03 Dave Brolley <brolley@redhat.com> * tapsets.cxx (visit_cast_op): Don't disallow unprivileged users. Annotate synthesized function with /* unprivileged */. * tapset-utrace.cxx (register_tapset_utrace): Call allow_unprivileged for process begin and end probes. * translate.cxx (translate_pass): Generate '#define STP_PRIVILEGED 1' unless --unprivileged was specified. * runtime/transport/transport.c: Don't define _stp_unprivileged_user. * runtime/task_finder.c (__stp_utrace_attach_match_filename): Check that _stp_uid equals the task euid when STP_PRIVILEGED is not defined. (stap_start_task_finder): Likewise. * runtime/staprun/staprun.c (insert_stap_module): Don't generate module option _stp_unprivileged_user.
| * PR10589 followup. More tapsets.cxx _stp_warn formatting fixlets.Mark Wielaard2009-09-031-4/+4
| | | | | | | | | | | | | | | | struct kretprobe nmissed an int, but struct kprobe nmissed an unsigned long. * tapsets.cxx (dwarf_derived_probe_group::emit_module_exit): Adjust _stp_warn format string for kprobe nmissed argument. (kprobe_derived_probe_group::emit_module_init): Likewise.
| * PR10589 followup. tapsets.cxx _stp_warn formatting fixlets.Mark Wielaard2009-09-031-2/+2
| | | | | | | | | | | | * tapsets.cxx (dwarf_derived_probe_group::emit_module_init): Cast _stp_warn arguments. (kprobe_derived_probe_group::emit_module_init): Likewise.
* | Fetch the blacklist section only when neededJosh Stone2009-09-031-4/+2
| | | | | | | | | | | | | | | | | | | | We only check blacklisting on kernel probes, so it's a waste to dig up the section name otherwise. * dwflpp.cxx (dwflpp::blacklisted_p): Lookup the section directly. (relocate_address::relocate_address): Don't do blacklisting here. * tapsets.cxx (dwarf_query::add_probe_point): Don't carry the blacklist section directly anymore.
* | PR10573: Squash duplicate inline instancesJosh Stone2009-09-031-1/+26
| | | | | | | | | | | | | | | | | | | | | | In C++, identical functions included in multiple CUs will get merged at link time into a single instance. We need to make sure that inlines within those merged functions are not probed multiple times. * tapsets.cxx (inline_instance_info::operator<): Used for set support. (dwarf_query::handle_query_module): Clear inline_dupes on each module. (query_dwarf_inline_instance): Squash this inline instance if it's already in the inline_dupes set.
* | PR10572: Allow duplicate function names in a CUJosh Stone2009-09-021-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't assume that a given function name will only appear once in a CU. In C++, two functions may have the same name in different classes or namespaces, or even in the same scope with overloaded parameters. Even in C, the compiler may generate multiple copies of a single function with different optimizations. We now use a multimap for function names, so we shouldn't miss any. * dwflpp.h (cu_type_cache_t, mod_cu_type_cache_t): New typedef to keep a normal map for the global_alias_cache. (cu_function_cache_t): Use a multimap for function names. * dwflpp.cxx (dwflpp::iterate_over_functions): Walk over the range of exactly-matching functions. * tapsets.cxx (query_dwarf_func): Don't abort after seeing an exact match -- there could be more to come.
* | Unify lex_cast* and avoid string copiesJosh Stone2009-09-021-11/+11
|/ | | | | | | | | | | | | | | We always use lex_cast either to string or from string, so I made that explicit, and got rid of some string copies in the process. There was also stringify(), which was redundant to lex_cast<string>. We also always used lex_cast_hex to string, so that's now hard-coded and again eliminated a string copy. For lex_cast_qstring<string>, there's no need to write the streamify the input, so a specialization now operates directly on the input. Hopefully this is a bit cleaner, and I do measure it to be a little faster on scripts with many probes.
* Reorganize iterate_over_labelsJosh Stone2009-08-261-15/+32
| | | | | | | | | | | | | | | I noticed that iterate_over_labels was using a static variable as a recursion variable, which isn't a safe thing to do since it will only be initialized once. While fixing that, I also reorganized the function quite a bit. * dwflpp.cxx (dwflpp::iterate_over_labels): Take the current function as a parameter instead of using a static local. Rewrite some of the code as well to try to make it more obvious. * tapsets.cxx (add_label_name): Remove in favor of query_label. (query_label): New, to check decl_file and fix probe listing. (query_srcfile_label, query_cu): Adjust to iterate_over_labels change and start using query_label as the callback.
* PR4186 cont'd: Squash EM_S390 to s390.Mark Wielaard2009-08-261-1/+1
| | | | * tapsets.cxx (validate_module_elf): Set expect_machine to "s390".
* Compute cu_name dynamicallyJosh Stone2009-08-251-2/+2
| | | | | | | | | | | | We only need cu_name for errors and verbose messages, so it's a waste to always construct it in focus_on_cu. It's now built only as-needed. * dwflpp.cxx (dwflpp::cu_name): Now a method instead of a data member. (dwflpp::focus_on_module): No cu_name to clear now. (dwflpp::focus_on_cu): No cu_name to set now. (dwflpp::declaration_resolve): Adjust to call cu_name() now. (dwflpp::iterate_over_functions): Ditto. * tapsets.cxx (query_cu): Ditto.
* PR4186 cont'd: option #2: standardize on kernel ARCH/SUBARCH throughoutFrank Ch. Eigler2009-08-251-1/+2
| | | | | | | | * main.cxx (main): Perform equivalent sed by hand on uname()->machine. * stap.1.in: Clarify -a ARCH slightly. * tapsets.cxx (validate_module_elf): Accept "arm*"for EM_ARM. * tapset/**, testsuite/**: Removed/collapsed "i386"/"i686" branches, renamed "ppc64"->"powerpc" and "s390x"->"s390".
* PR2475: Filter filenames against the decl_fileJosh Stone2009-08-241-5/+12
| | | | | | | | | | | | We used to only check that a CU contains at least one srcfile matching the user's file spec. This patch ensures that the selected function was actually defined in one of the matching srcfiles. * tapsets.cxx (struct dwarf_query): Make filtered_srcfiles carry strings, so we can easily lookup matches later. (query_dwarf_func): Check that the decl_file is in filtered_srcfiles. (query_cu): Adjust to using set<string>. * dwflpp.cxx (dwflpp::collect_srcfiles_matching): Take a set<string>.
* Fix failing uprobes.exp -p5 failures by removing trailing spaces in $$ vars.Mark Wielaard2009-08-241-5/+9
| | | | | | | | * tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol_context): Don't add extra space at end of list, only add space between symbols. * testsuite/systemtap.base/uprobes.exp: Use more specific expect regex. * testsuite/systemtap.base/vars.exp: Don't just chop off last char of printf output string.
* PR10507: tweak MAXUPROBES calculation to shrink table for small static ↵Frank Ch. Eigler2009-08-211-3/+7
| | | | | | | | number of probes * tapsets.cxx (uprobe_derived_probe_group::emit_module_decls): Use geometric mean rather than arithmetic mean. Add a comment to explain relative harmlessness of exceeding the "minimum" or "maximum" values.
* PR10544: clean up stap child process error handlingFrank Ch. Eigler2009-08-211-1/+1
| | | | | | | * util.cxx (stap_system): Take extra verbosity value. Standardize error handling / tracing. * util.h: Corresponding changes. * buildrun.cxx, main.cxx, modsign.cxx: Update callers.
* cleanup: rename task_finder_target->pathname -> procnameFrank Ch. Eigler2009-08-211-3/+3
| | | | | | | | | | The previous name made it easy to misread the purpose of this field. It is only for matching executable names, not for shared libraries. * runtime/task_finder.c (task_finder_target): Rename field. (*): Adjust. * tapset-itrace.cxx, tapset-utrace.cxx, tapsets.cxx, translate.cxx: Ditto.
* Create a dwarf_attr_die idiomJosh Stone2009-08-191-18/+7
| | | | | | | | | | | | | | | We commonly do a dwarf_attr_integrate followed by dwarf_formref_die, with no care for the Dwarf_Attribute, so I captured that idiom in an inline function. * dwarf_wrappers.h (dwarf_attr_die): New. * dwarf_wrappers.cxx (dwarf_type_name): Call dwarf_attr_die. * dwflpp.cxx (dwflpp::print_members): Ditto. (dwflpp::find_struct_member): Ditto. * tapsets.cxx (dwarf_derived_probe::saveargs): Ditto. (uprobe_derived_probe::saveargs): Ditto. (resolve_tracepoint_arg_type): Ditto. (tracepoint_derived_probe::build_args): Ditto.
* Use dwarf_type_name in more placesJosh Stone2009-08-191-74/+5
| | | | | | | | | | | | | | * dwarf_wrappers.cxx (dwarf_type_name): Moved here from tapsets.cxx, and added a variant that returns a string for easier ostreaming. * dwflpp.cxx (dwflpp::print_members): Use dwarf_type_name for errors. (dwflpp::find_struct_member): Ditto. (dwflpp::translate_components): Ditto. (dwflpp::translate_final_fetch_or_store): Ditto. (dwflpp::literal_stmt_for_pointer): Ditto. * tapsets.cxx (dwarf_derived_probe::saveargs): Pass die to dwarf_type_name by pointer instead of reference. (uprobe_derived_probe::saveargs): Ditto. (resolve_tracepoint_arg_type): Ditto.