summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* PR10538: Use {...} for naming anonymous typesJosh Stone2009-08-191-1/+3
| | | | * tapsets.cxx (dwarf_type_name): Handle NULL dwarf_diename.
* PR10518: context shrinkage with function recursion analysis feeding MAXNESTINGFrank Ch. Eigler2009-08-181-1/+1
| | | | | | | | * translate.cxx (emit_common_header, translate_pass): Use new recursion_info visitor to calculate appropriate MAXNESTING value for scripts with or without recursion. * tapsets.cxx (common_probe_entryfn_prologue): Initialize c->nesting = -1. * stap.1.in: Clarify MAXNESTING value.
* Adapt tracepoints to the new probe_locals unionJosh Stone2009-08-181-1/+1
| | | | | | | * tapsets.cxx (tracepoint_derived_probe_group::emit_module_decls): Use probe_locals to set the tracepoint arguments for the probe. * testsuite/systemtap.base/tracepoints.exp: Include the arguments in the pass-4 tracepoint test.
* Cache failed tracepoint headers tooJosh Stone2009-08-141-2/+8
| | | | | | | | | | Rather than re-attempting a tracepoint header that fails to compile, we now save an empty file into the cache to indicate "nothing to see here." See also PR10424. * tapsets.cxx (tracepoint_builder::get_tracequery_module): Use /dev/null as the empty result file if make_tracequery fails. (tracepoint_builder::init_dw): Ignore empty tracequery modules.
* PR10228: use task_finder_vma for -d /user/object files.Frank Ch. Eigler2009-08-141-24/+0
| | | | | | | | | | | | * 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.
* PR10507: tweak heuristics for stap_uprobes[] allocationFrank Ch. Eigler2009-08-121-5/+12
| | | | | | * tapsets.cxx (uprobes::emit_module_decls): Compute MAXUPROBES with x-treme kl3v3rn3ss. * stap.1.in: Clarify MAXUPROBES.
* PR10461: Probe identical functions only onceJosh Stone2009-08-111-0/+14
| | | | | | | | | | | | | | | In C++ especially, a function definition in a header may be compiled into multiple CUs, but the linker will merge those into a single output function. We don't want to place multiple probes on the same function. The dupe-detection from the alias code (commit 1c6b77e5) already tracks identical functions within a CU, so I've just lifted this to instead track function entrypcs at the module level. * dwflpp.cxx (dwflpp::iterate_over_functions): Remove dupe checks. * tapsets.cxx (dwarf_query): Add alias_dupes set to the query. (dwarf_query::handle_query_module): Reset the dupes for each module. (query_dwarf_func): Check that we only probe each entrypc once.
* Zap dwarf_diename_integrateJosh Stone2009-08-071-2/+2
| | | | | | The dwarf_diename in elfutils learned a long time ago to use dwarf_attr_integrate when looking up the name. Our minimum elfutils 0.126 has this, so we don't need to kludge it ourselves.
* Fix a couple of sdt_query reorg problems.Stan Cox2009-08-061-2/+3
| | | | | | | * tapsets.cxx (sdt_query::handle_query_module): For uprobe probes: 1) find all same named probes to handle multiple probes per module 2) use new_base for uprobe probes to handle $$name * sdt_misc.exp: Test $$name
* PR10294: support wider range for statement probeWenji Huang2009-08-051-2/+2
| | | | | | | | | * dwflpp.cxx (iterate_over_srcfile_lines): Add pattern parameter. * dwflpp.h (iterate_over_srcfile_lines): Ditto. * testsuite/systemtap.base/bz10294.c: Test case. * testsuite/systemtap.base/bz10294.stp: Ditto. * testsuite/systemtap.base/bz6905.exp: Deleted. * testsuite/systemtap.base/statement.exp: Merge bz10294 with bz6905.
* PR10491 Don't assign to REG_IP if it isn't an lvalue (s390 and ia64).Mark Wielaard2009-08-061-0/+30
| | | | | | | | | | | | | | | To fixup REG_IP to show the correct value after a [ku]probe trap we assigned the address of the actual instruction pointer of the probed instruction. That doesn't work on architectures, s390 and ia64, where REG_IP is not a simple lvalue. Just don't try to fixup the address in those cases. If this isn't enough, the uprobe_stmt_num.exp testcase will point this out. * runtime/regs.h: Define REG_IP_LVALUE for x86_64, i386, powerpc64 and arm. * tapsets.cxx (dwarf_derived_probe_group::emit_module_decls): Only fixup REG_IP when REG_IP_LVALUE is defined. (uprobe_derived_probe_group::emit_module_decls): Likewise. (kprobe_derived_probe_group::emit_module_decls): Likewise.
* Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-08-041-419/+678
|\ | | | | | | | | | | Conflicts: cache.cxx
| * Add update_visitor::replaceJosh Stone2009-08-031-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | I noticed that most uses of update_visitor::require() were simply writing the value back to the same place, i.e. foo = require(foo). The new replace() method just encapsulates that paradigm, so we don't have the duplication between the LHS and RHS. * staptree.h (update_visitor::replace): New. * elaborate.cxx, staptree.cxx, tapset-mark.cxx, tapset-perfmon.cxx, tapset-procfs.cxx, tapset-utrace.cxx, tapsets.cxx: Update all require calls that are simply updating the value in-place.
| * PR2049: support arbitrary $target-array indexingJosh Stone2009-08-031-5/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than just numeric literals, we can now support arbitrary expressions for the index value. Note that loc2c won't allow this for noncontiguous arrays, as the access methods need to be statically computed, but for contiguous arrays and pointers-as-arrays it works just fine. * staptree.h (target_symbol::component): Add expression_array_index. * staptree.cxx (target_symbol::visit_components): New helper. (target_symbol::assert_no_components): Recognize new array type. (target_symbol::component::print): Print subexpressions. (traversing_visitor::visit_target_symbol, visit_cast_op): Visit the indexing components too. (varuse_collecting_visitor::visit_target_symbol): Ditto. (update_visitor::visit_target_symbol, visit_cast_op): Ditto. * elaborate.cxx (void_statement_reducer::visit_target_symbol): New. (void_statement_reducer::visit_cast_op): Save indexes too. * parse.cxx (parser::parse_target_symbol_components): Parse expressions. * tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol): Pass expression-indexes as parameters (indexN) to the dwarf function. (dwarf_cast_expanding_visitor::visit_cast_op): Ditto. (tracepoint_var_expanding_visitor::visit_target_symbol_arg): Ditto. (sdt_var_expanding_visitor::visit_target_symbol): Visit the new @cast. * dwflpp.cxx (dwflpp::translate_components): Use THIS->indexN. * translate.cxx (c_unparser::visit_target_symbol): Correct error msg. * testsuite/systemtap.base/pointer_array.stp: Use a simple index.
| * Unify no-component assertions on target variablesJosh Stone2009-07-311-25/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are several tapsets that can't deal with component dereferences on their target variables, and they all check-and-throw in the same way. This refactors the checks into a target_symbol member. * staptree.cxx (target_symbol::assert_no_components): New. * tapsets.cxx (tracepoint_var_expanding_visitor::visit_target_symbol_arg, tracepoint_var_expanding_visitor::visit_target_symbol_context): Use the new assertion function to check for no components. * tapset-mark.cxx (mark_var_expanding_visitor::visit_target_symbol_arg, mark_var_expanding_visitor::visit_target_symbol_context): Ditto. * tapset-perfmon.cxx (perfmon_var_expanding_visitor::visit_target_symbol): Ditto. * tapset-procfs.cxx (procfs_var_expanding_visitor::visit_target_symbol): Ditto. * tapset-utrace.cxx (utrace_var_expanding_visitor::visit_target_symbol_arg, utrace_var_expanding_visitor::visit_target_symbol_context): Ditto.
| * Make a real type for target_symbol->componentsJosh Stone2009-07-311-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now the dereferences on target_symbol and cast_op are tracked with a struct instead of just a generic pair. The first immediate benefit is that we can track the token for more exact error reporting. * staptree.h (target_symbol): Add a new component type. * staptree.cxx (target_symbol::component::print): New. (operator<<(ostream&, target_symbol::component&): New. (target_symbol::print): Adapt component printing. (cast_op::print): Ditto. * parse.cxx (parser::parse_target_symbol_components): Adapt to the new component construction. * dwflpp.cxx (dwflpp::find_struct_member): take the component as a parameter for a better token in error messages (dwflpp::translate_components): Adapt to the new component type. * tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol): Don't overwrite the token in target_symbol saved errors. (tracepoint_var_expanding_visitor::visit_target_symbol_arg): Ditto.
| * PR10458. User actual breakpoint address for [ku]probe[ret].Mark Wielaard2009-07-311-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setup the pt_regs REG_IP to the actual breakpoint address before entering a probe handler for [ku]probe[ret] (and restore it after returning). This helps getting symbol resolution and backtraces more correct and makes it more conform with other probe handlers like the iutrace and profile timers that also provide pt_regs (which untill now exhibited off-by-one errors while unwinding). * tapsets.cxx (dwarf_derived_probe_group::emit_module_decls): Setup REG_IP correctly before calling enter_kprobe_probe and enter_kretprobe_probe, and restore afterwards. (uprobe_derived_probe_group::emit_module_decls): Likewise for enter_uprobe_probe and enter_uretprobe_probe. (kprobe_derived_probe_group::emit_module_decls): Likewise for enter_kprobe2_probe and enter_kretprobe2_probe. * runtime/unwind/i386.h (arch_unw_init_frame_info): Initialize info->call_frame to zero. * runtime/unwind/x86_64.h (arch_unw_init_frame_info): Likewise.
| * PR10459. Disable all warning messages on -w.Mark Wielaard2009-07-301-18/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | * stap.1.in: Document that -w disables all warning messages. * dwflpp.cxx (get_module_dwarf): Only output warning when session suppress_warnings is not set. * translate.cxx (dump_unwindsyms): Likewise. (emit_symbol_data_done): Likewise. * tapsets.cxx (query_module_symtab): Likewise. (read_from_elf_file): Take systemtap_session, check suppress_warnings before emitting warning. (read_from_text_file): Likewise. (get_symtab): Call read_from_elf_file and read_from_text_file with session.
| * Enable variable listing (-L) for uprobesJosh Stone2009-07-291-0/+69
| | | | | | | | | | | | | | | | | | All $target variables and their C-types are now printed in -L mode. * tapsets.cxx (uprobe_derived_probe::uprobe_derived_probe): Save the local arguments while we still have the dwflpp open. (uprobe_derived_probe::saveargs): New (uprobe_derived_probe::printargs): New
| * Enable variable listing (-L) for dwarf probesJosh Stone2009-07-291-0/+69
| | | | | | | | | | | | | | | | | | All $target variables and their C-types are now printed in -L mode. * tapsets.cxx (dwarf_derived_probe::dwarf_derived_probe): Save the local arguments while we still have the dwflpp open. (dwarf_derived_probe::saveargs): New (dwarf_derived_probe::printargs): New
| * Break up dwarf_var_expanding_visitor::visit_target_symbolJosh Stone2009-07-291-361/+379
| | | | | | | | | | | | | | | | | | This just refactors large chunks of visit_target_symbol into a couple of smaller functions. * tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol_context): New (dwarf_var_expanding_visitor::visit_target_symbol_saved_return): New (dwarf_var_expanding_visitor::visit_target_symbol): Call the new ones
| * Mention where we looked and if we didn't find line info on statement probe.Mark Wielaard2009-07-271-0/+3
| | | | | | | | | | * tapsets.cxx (query_cu): When statement check fails and no line info available, mention the CU had no line info.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-07-231-401/+460
|\|
| * Use the query paradigm for resolving sdt probesJosh Stone2009-07-211-375/+384
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a bad assumption in the probe_table initialization that the dwflpp->module would be immediately valid. We should not assume that dwflpp only has one module, or that any module is necessarily in focus. Instead, I've created an sdt_query class which will call an iterate_over_modules like the other dwarf probe types. For now this means just a single module, but it will also open the door to iterating over all linked libraries too, for example. * dwflpp.cxx (dwflpp::setup_user): don't "save mod!" anymore * tapsets.cxx (probe_table -> sdt_query): convert to a query-style class, and also take over the task of iterating over the probes. (dwarf_builder::build): leave the iteration to sdt_query
| * Remove unused 'sess' from dwarf_query ctorJosh Stone2009-07-211-6/+4
| |
| * PR10424: Consider each tracepoint header separatelyJosh Stone2009-07-201-12/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the current monolithic tracepoint query module, a failure in any of the discovered tracepoint headers means that you can't use any of the others either. This patch creates a separate query module for each header so they can pass or fail independently. * buildrun.cxx (make_tracequery): take a single header name instead of globbing for everything we can find. * hash.cxx (find_tracequery_hash): name the header file we're hashing. * tapsets.cxx (tracepoint_query::handle_query_func): make sure we don't duplicate tracepoints found through different headers. (tracepoint_builder::get_tracequery_module): get a header's module (tracepoint_builder::init_dw): glob for all tracepoint headers, and feed all their modules into dwflpp.
| * Return hash module values directly as stringsJosh Stone2009-07-201-9/+10
| | | | | | | | | | | | | | | | * session.h (systemtap_session): remove tracequery_path * hash.cxx (find_tracequery_hash, find_typequery_hash): return strings * tapsets.cxx (dwarf_cast_expanding_visitor::filter_special_modules): get the hashed path from the return value instead of a parameter (tracepoint_builder::init_dw): ditto, and don't stuff it in session
| * * tapsets.cxx (dwarf_builder::probe_table::convert_probe):Stan Cox2009-07-201-46/+43
| | | | | | | | | | | | First check kprobe and utrace (did we arrive via stap?) then check if probe arg matches mark("NAME") * sdt.h (STAP_PROBE?_): Use STAP_GUARD for stap check, not gettid.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-07-171-4/+4
|\|
| * PR3498 cont'd: better tolerate missing modulesFrank Ch. Eigler2009-07-171-4/+4
| | | | | | | | | | * tapsets.cxx (get_{user,kern}_dw): Skip partially allocated (0-initialized) FOO_dw[] slots that may result from dwflpp::ctor exceptions.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-07-161-1/+15
|\|
| * PR5930: Address-op for $target and @cast membersJosh Stone2009-07-151-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows the '&' operator to get the address of @cast and $target variable expressions. * staptree.h (target_symbol): add addressof field * staptree.cxx (target_symbol::print): print '&' for addressof (cast_op::print): ditto * parse.cxx (parser::parse_value): allow '&' prefix on $target/@cast * dwflpp.cxx (dwflpp::translate_final_fetch_or_store): allow taking the computed address without actually doing a final fetch. * tapset* (*::visit_target_symbol): throw errors for $vars w/o addresses * testsuite/systemtap.base/cast.stp: add &@cast test * testsuite/semok/target_addr.stp: test '&' on different member types * testsuite/semko/target_addr?.stp: test failure on bitfields/registers
| * tapsets.cxx doesn't need loc2c.h. All done through dwflpp.cxx now.Mark Wielaard2009-07-141-1/+0
| | | | | | | | * tapsets.cxx: Remove loc2c.h include.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-07-131-2/+2
|\| | | | | | | | | | | Conflicts: main.cxx
| * PR10075: emit address in probe registration logicwenji2009-07-121-2/+2
| | | | | | | | | | * tapsets.cxx(dwarf_derived_probe_group::emit_module_init, kprobe_derived_probe_group::emit_module_init): print address.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-07-101-1/+1
|\|
| * PR3498 cont'd, fix wildcard module("*") probesFrank Ch. Eigler2009-07-081-1/+1
| | | | | | | | | | | | | | | | * dwflpp.cxx (name_has_wildcard): Make static. (dwfl_report_offline_predicate): Check & adjust behavior. * dwflpp.h: Corresponding changes. * tapsets.cxx: Note that kern_dw[] keys may be wildcard strings. * testsuite/buildok/fortysix.stp: New test.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-07-081-27/+22
|\|
| * PR3498: speed up pass-2 and pass-3 for kernel offline dwfl module searchingFrank Ch. Eigler2009-07-071-27/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dwflpp.cxx (dwflpp ctor): Parametrize for user/kernel modes. Update callers. (dwfl_report_offline_predicate): New function. Filter and abort searches early if possible. (setup_kernel): Use new predicate. * dwflpp.h: Corresponding changes. * tapsets.cxx (dwfl_report_offline_predicate): Remove this shared implementation. (dwarf_builder): Turn kern_dw into module_name->dwflpp* map, just like user_dw. (get_kern_dw): Adapt. (dwarf_build_no_more): Adapt. * tapsets.h: Remove old shared predicate. * translate.cxx (dwfl_report_offline_predicate2): New function. Filter and abort searches early if possible. (emit_symbol_data): Use it.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-07-021-82/+73
|\|
| * PR10327: resolve symbol aliases to dwarf functionsJosh Stone2009-07-011-82/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will first read in the symbol table for modules, and update the dwarf cu_function_cache with aliased names too. Then when iterating in dwarf, all of the possible names are matched, instead of only the canonical dwarf name. * dwflpp.cxx (dwflpp::iterate_over_functions): call update_symtab, and track wildcard addresses in a set to avoid alias dupes * dwflpp.h (symbol_table::Compare): removed * tapsets.cxx (symbol_table::map_by_addr): replaces list_by_addr (symbol_table::sort): removed -- multimap doesn't need sorting (symbol_table::mark_dwarf_redundancies): removed, see update_symtab (symbol_table::purge_syscall_stubs): remove map elements inline (dwarf_query::handle_query_module): preload the symtable. (query_dwarf_func): don't compare the function a second time, especially since it may have been an alias that matched at first. (module_info::get_symtab): allow being called multiple times (module_info::update_symtab): copy dies from the cache to the symtab, and also add aliased names to the cache
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-06-291-13/+35
|\|
| * An i386 kprobe needs regparm(0) to access args.Stan Cox2009-06-261-0/+17
| | | | | | | | * tapsets.cxx (probe_table::convert_probe): Add regparm for kprobe.
| * Use_utrace_syscall_arg with sdt utrace probes to avoid i386 arg fetching ↵Stan Cox2009-06-261-13/+18
| | | | | | | | | | | | | | | | | | problems. * tapsets.cxx (probe_table): Add is_uprobe and is_utrace. (probe_table::convert_probe): Use _utrace_syscall_arg. (sdt_var_expanding_visitor): Add utrace_probe. (sdt_var_expanding_visitor::visit_target_symbol): Use _utrace_syscall_arg.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-06-251-2/+14
|\|
| * PR10305 Mark probes fail on prelinked shared library.Mark Wielaard2009-06-241-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Mark probes rely on literal statement addresses, these are based on the on-disk module address space. Introduce helper function to turn such addresses into symbol addresses as expected by libdwfl. Also properly adjust for dw bias when such addresses are used in dw queries. * dwflpp.h (dwflpp::literal_addr_to_sym_addr): New method. * dwflpp.cxx (query_cu_containing_address): Don't "globalize" address. (literal_addr_to_sym_addr): New method. * tapsets.cxx (query_module_dwarf): Turn literal addresses into symbol addresses. (query_dwarf_func): Likewise and adjust for dw module bias.