summaryrefslogtreecommitdiffstats
path: root/elaborate.cxx
Commit message (Collapse)AuthorAgeFilesLines
* PR11399: Allow '**' to match tapsets across '.'Josh Stone2010-03-251-0/+74
| | | | | | | | | | | | | | Normally wildcards are constrained to matching a single probe point component between the '.' separator. This patch enables '**' to match across the separator. Probe point parameters are still absolute separators though, as there's not really a meaningful semantic we could use to cross them with '**'. * elaborate.cxx (isdoubleglob): Check for '**'. (match_node::find_and_build): Recurse '**' to cross separators. * testsuite/semok/doubleglob.stp: New test of broad wildcards. * testsuite/semko/doubleglob.stp: New negative test.
* PR11346: Move the skip-badvars logic into const-foldingJosh Stone2010-03-181-0/+24
| | | | | | | | | | | | | | | 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.
* optimizer diagnostics: identify taken branch of optimizationsFrank Ch. Eigler2010-03-181-3/+3
| | | | | * elaborate.cxx (const_folder::visit_if_statement, visit_binary_expression, visit_ternary_expression): Print constant value in -vvv diagnostics.
* Start of perf tapset parsingWill Cohen2010-03-171-0/+1
|
* Remove the old performance monitoring code.Will Cohen2010-03-171-1/+0
|
* PR10831: Remember derived "aliases" in the probe chainJosh Stone2010-03-161-0/+13
| | | | | | | | | | | | | 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.
* PR11366 Always call semantic_pass_const_fold.Mark Wielaard2010-03-101-2/+3
| | | | | | | | | Even in unoptimized mode we want constant folding to work to make sure non-existing $variable expressions (detected through @defined) aren't included. * elaborate.cxx (semantic_pass_optimize1): Call semantic_pass_const_fold() unconditionally.
* PR11360: Make @defined and -L play niceJosh Stone2010-03-091-9/+17
| | | | | | | | | | | | | The constant-folding is now enabled for s.listing_mode_vars, despite all other optimizations being disabled. This is needed so we can prune any invalid branches that are gated by @defined. * elaborate.cxx (semantic_pass): Leave the optimization decision to the optimization passes themselves. (semantic_pass_optimize1): Predicate most optimizations, but enable the constant-folding for listing_mode_vars too. (semantic_pass_optimize2): Predicate all (1) optimizations. * testsuite/semok/defined_list_vars.stp: New test.
* Make sure synthesized var display is tokenfulJosh Stone2010-03-051-11/+14
| | | | * elaborate.cxx (add_global_var_display): Assign a few token*s.
* PR11004: try / catch error-handling script syntaxFrank Ch. Eigler2010-03-031-0/+54
| | | | | | | | | | | | | | | * parse.h (try_block): New class. Update basic visitors. * staptree.cxx: Implement basic visitors. * parse.cxx (expect_kw): Fix to actually look for keywords. (parse_try_block): New function. (lexer ctor): Designate 'try' and 'catch' as keywords. * elaborate.cxx (dead_assignment_remover, dead_statmtexpr_remover): Optimize. (other visitors): Implement. * translate.cxx (c_unparser): Implement via super-handy __local__ labels. (emit_probe, emit_function): Make outer out: label also __local__. * testsuite/buildok/fortyone.stp, semko/fortynine.stp, systemtap.base/trycatch.exp: Test it. * NEWS, doc/langref.txt, stap.1.in: Document it.
* PR11246 cont'd: Separate script/stapconf cachingJosh Stone2010-03-021-0/+1
| | | | | | | | | | | I'm separating the caching and creation logic for stapconf, so it can be conditionalized on s.use_cache instead of s.use_script_cache. * session.h (systemtap_session): Store base_hash for better reuse. * hash.cxx (get_base_hash): Get the base from the session, or build it. (find_hash): Split into separate script/stapconf versions. * cache.cxx (add_to_cache, get_from_cache): Ditto. * main.cxx (main): Adapt caller, and delay stapconf until pass-4.
* Squash elision warnings on synthetic functionsJosh Stone2010-02-261-1/+1
| | | | | | | | | | | | | | * 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.
* Expand @defined to support more casesJosh Stone2010-02-251-0/+15
| | | | | | | | * 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.
* PR10719 cont'd: const-fold binary expressionsJosh Stone2010-02-241-2/+97
| | | | | | | | We can compute results between two literals, we can reduce identity elements, and reduce constants if the non-literal side has no side effects. * elaborate.cxx (const_folder::visit_binary_expression): Implement.
* PR10719 cont'd: const-fold logical opsJosh Stone2010-02-241-4/+84
| | | | | | | | | We can compute results between two literals, we can short-circuit some literals on the left ("0&&x", "1||x"), and we can simplify literals on the right if the left has no side effect ("x&&0", "x||1"). * elaborate.cxx (const_folder::visit_logical_or_expr): Implement. (const_folder::visit_logical_and_expr): Implement.
* PR10719 cont'd: const-fold comparisonsJosh Stone2010-02-231-2/+85
| | | | | | | | | | We can compute results between two literals, and we can also compute comparisons to boundary numbers. (We could also check boundary strings, "" and "\377\377...", but even I am not THAT pedantic... yet...) * elaborate.cxx (const_folder::visit_comparison): Implement.
* PR10719 cont'd: const-fold string concatenationJosh Stone2010-02-231-2/+24
| | | | | | We can concat literal strings directly and discard empty strings. * elaborate.cxx (const_folder::visit_concatenation): Implement.
* Merge branch 'master' of ssh://sources.redhat.com/git/systemtapFrank Ch. Eigler2010-02-231-6/+230
|\ | | | | | | | | | | | | | | | | | | | | | | * '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
| * PR10719 part 1: Partial constant foldingJosh Stone2010-02-231-0/+227
| | | | | | | | | | | | | | | | | | This implements constant folding for if/for/foreach, unary expressions, and ternary expressions. Binary expressions are TODO... * elaborate.cxx (const_folder): New visitor to collapse constants. (semantic_pass_const_fold): Drive everything through const_folder. (semantic_pass_optimize1): Call it.
| * Simplify null_statement constructionJosh Stone2010-02-231-6/+3
| | | | | | | | It only needs a token*, so build that into the constructor.
* | PR11005: @defined($tvar) predicate, part 1Frank Ch. Eigler2010-02-231-0/+26
|/ | | | | | | | | | | | | | | | | | * 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.
* elaborate.cxx: Point to the location of the error when rejectingDave Brolley2010-02-151-1/+2
| | | | probe points.
* Rework identification of probes allowed for unprivileged users.Dave Brolley2010-02-151-21/+16
| | | | | | | - 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.
* Hardware Breakpoints for x86 / x86_64, based on mainline kernel. [Changes : ↵Prerna Saxena2010-01-291-0/+1
| | | | Part 2]
* PR10877: Give token* to each component instead of each probe_pointCharley Wang2009-11-101-5/+6
|
* Correct the safety-net escape WRT lockingJosh Stone2009-10-211-1/+3
| | | | | | | | | | Within a probe body, the "out" label starts the normal exit path, including unlocking whatever globals are used in that probe. Since the unprivileged safety-net checks are before the locks are ever grabbed, we should bypass the unlock on the way out. * elaborate.cxx (derived_probe::emit_process_owner_assertion): Use "return" instead of "goto out".
* PR10799: warn on possibly uintended local-vs-global namespace collisionFrank Ch. Eigler2009-10-191-5/+15
| | | | | | | | | * elaborate.cxx (find_var): Take extra token parameter. Look for cross-file global variable resolution, signal a warning. * testsuite/systemtap.examples/io/traceio2.stp: Fix it. * testsuite/systemtap.syscall/sys.stp: Fix it. * NEWS: Document it.
* Consolidate print_format creationJosh Stone2009-10-131-20/+10
| | | | | | | | | | | | | | | | | | 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-2/+2
|\
| * Remove the global derived_probe->semaphore mapJosh Stone2009-10-061-2/+2
| | | | | | | | | | | | | | | | | | | | 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/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-22/+47
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* cleanup: tweak "read-only <variable>" messageFrank Ch. Eigler2009-09-281-4/+4
| | | | | | * elaborate.cxx (semantic_pass_opt2): Use "never-assigned" instead of "read-only". (dead_stmtexpr_remover::visit_expr_statement): Ditto.
* Unify lex_cast* and avoid string copiesJosh Stone2009-09-021-3/+3
| | | | | | | | | | | | | | | 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.
* PR10568: Ensure that aliases pull in their tapsetJosh Stone2009-08-271-0/+11
| | | | | | | | | | | When a probe alias is resolved in a tapset, the contents of that tapset should be included in the compiled script, just as we do for global variables and functions. * elaborate.cxx (alias_expansion_builder::build): When an alias is instantiated, add its stapfile to the session files. * testsuite/systemtap.base/tapset_includes.exp: New test. * testsuite/systemtap.base/tapset/*.stp: Testing tapsets for above.
* PR10495: allow multiple probe aliases with same nameFrank Ch. Eigler2009-08-181-9/+14
| | | | | | | | * elaborate.cxx (match_node::bind): Change ->end to ->ends[] vector. (find_and_build,build_no_more): Iterate over ends[]. * elaborate.h: Corresponding changes. * testsuite/semok/thirtyfour.stp: New test. * NEWS, doc/langref.tex: Note this.
* Only add extra error on no probes found if no previous errors already shown.Mark Wielaard2009-08-101-1/+1
| | | | | * elaborate.cxx (semantic_pass): Don't add "no probes found" if session already had other errors.
* Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-08-041-21/+79
|\ | | | | | | | | | | Conflicts: cache.cxx
| * Add update_visitor::replaceJosh Stone2009-08-031-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | 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-2/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-07-101-12/+12
|\|
| * Remove the filename copy from token->locationJosh Stone2009-07-091-12/+12
| | | | | | | | | | The location already has a pointer to a stapfile with the filename, so there's no need to keep an extra copy.
* | Disallow embedded C in tapset functions ifor unprivileged users unless ↵Dave Brolley2009-06-251-9/+9
| | | | | | | | tagged by /* unprivileged */.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-06-111-5/+9
|\|
| * Fix condition propagation across aliasesJosh Stone2009-06-091-5/+9
| | | | | | | | | | | | | | | | | | | | When an instance of an alias has a condition, that condition gets propagated to each of the locations that the alias defines. However, the copy of the location list was not a deep copy, and so all other instances of the alias would also incorrectly receive the condition. This patch makes the location list copy a little deeper, and adds a test case which demonstrates the issue.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-05-111-1/+1
|\| | | | | | | | | | | Conflicts: tapsets.cxx
| * Allow @cast failures to get optimized awayJosh Stone2009-05-081-1/+1
| | | | | | | | | | | | We have the saved_conversion_error field, but I wasn't using it. Now @cast errors are saved in that field, so they're only seen if the optimizer doesn't remove the @cast.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-05-061-4/+12
|\|
| * PR10102: tolerate the failure related to optional probeWenji Huang2009-05-051-4/+12
| | | | | | | | | | | | | | | | | | This patch will make stap silently accept the failure related to optional probe. It puts try/catch around find_and_build which can cover most probe types. The specific treatment for dwarf_derived_probe in commit ed82b7c902d6a2e26452ec51c9cdb9665dbf9e97 is reverted.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-04-301-0/+3
|\|