summaryrefslogtreecommitdiffstats
path: root/staptree.cxx
Commit message (Collapse)AuthorAgeFilesLines
* PR9958: Let embedded-C assert guru modeJosh Stone2010-04-011-0/+5
| | | | | * staptree.cxx (varuse_collecting_visitor::visit_embeddedcode): Don't allow calling /* guru */ functions unless guru mode is active.
* Remove probe_point code duplicationJosh Stone2010-03-251-14/+1
| | | | * staptree.cxx (probe_point::str): Don't duplicate ::print -- reuse it.
* Print probepoint addresses in hexJosh Stone2010-03-251-1/+6
| | | | | | | | | | * staptree.h (literal_number): Add a bool "print_hex". * staptree.cxx (literal_number::print): Switch to hex if needed. * tapsets.cxx (dwarf_derived_probe::dwarf_derived_probe): Write the statement number component with a hex literal_number. (sdt_query::convert_location): Ditto (kprobe_derived_probe::kprobe_derived_probe): Ditto. (hwbkpt_derived_probe::hwbkpt_derived_probe): Ditto for data addr.
* PR11004: try / catch error-handling script syntaxFrank Ch. Eigler2010-03-031-1/+68
| | | | | | | | | | | | | | | * 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.
* 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.
* PR11005: @defined part 2: clarify/standardize internal handling of ↵Frank Ch. Eigler2010-02-251-0/+8
| | | | | | | | | | | | | | | | | unresolvable $variables * staptree.cxx (target_symbol::chain): New function. * staptree.h: Declare it. * (*): Use it instead of hand-chaining to target_symbol->saved_conversion_error. * tapset-mark.cxx (*::visit_target_symbol): Chain resolution error object, do not throw. * tapset-procfs.cxx (*::visit_target_symbol): Ditto. * tapset-utrace.cxx (*::visit_target_symbol): Ditto. * tapsets.cxx (*::visit_target_symbol): Ditto. (*::visit_defined_op): Explain & enforce the above. * testsuite/semok/thirtysix.stp: Expand. * testsuite/systemtap.base/sdt_misc.exp: Bonus fix: make work with blddir != srcdir.
* Merge branch 'master' of ssh://sources.redhat.com/git/systemtapFrank Ch. Eigler2010-02-231-0/+12
|\ | | | | | | | | | | | | | | | | | | | | | | * '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
| * Simplify null_statement constructionJosh Stone2010-02-231-0/+12
| | | | | | | | It only needs a token*, so build that into the constructor.
* | PR11005: @defined($tvar) predicate, part 1Frank Ch. Eigler2010-02-231-0/+49
|/ | | | | | | | | | | | | | | | | | * 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.
* PR6954: make ++/-- operation trigger automatic global printingWenji Huang2010-01-281-6/+8
| | | | | | | * staptree.cxx (varuse_collecting_visitor::visit_arrayindex): Regard operations as pure writes. * testsuite/systemtap.base/global_end.exp: Add test case. * testsuite/systemtap.base/global_end.stp: Ditto.
* PR10877: Give token* to each component instead of each probe_pointCharley Wang2009-11-101-5/+4
|
* Consolidate print_format creationJosh Stone2009-10-131-31/+35
| | | | | | | | | | | | | | | | | | 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.
* Unify lex_cast* and avoid string copiesJosh Stone2009-09-021-1/+1
| | | | | | | | | | | | | | | 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.
* Remove unnecessary static membersJosh Stone2009-08-261-1/+1
| | | | | | | | | When a static class member is only used by a single method, it's more concise to use a static local variable instead. * staptree.cxx (probe::probe): Make last_probeidx a static local. * tapset-perfmon.cxx (perfmon_derived_probe::perfmon_derived_probe): Make probes_allocated a static local.
* Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-08-041-68/+119
|\ | | | | | | | | | | Conflicts: cache.cxx
| * Add update_visitor::replaceJosh Stone2009-08-031-43/+43
| | | | | | | | | | | | | | | | | | | | | | | | 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.
| * Strengthen the template types in update_visitorJosh Stone2009-08-031-1/+1
| | | | | | | | | | * staptree.h (update_visitor::require, provide): Make the parameters and return values a T*, to make it explicit that we want pointer types.
| * PR2049: support arbitrary $target-array indexingJosh Stone2009-08-031-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-22/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * Drop a couple of unnecessary std:: qualifiersJosh Stone2009-07-311-2/+2
| | | | | | | | | | * staptree.cxx (target_symbol::print): Drop std:: from parameter o. (cast_op::print): Ditto.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-07-161-0/+4
|\|
| * PR5930: Address-op for $target and @cast membersJosh Stone2009-07-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Disallow embedded C in tapset functions ifor unprivileged users unless ↵Dave Brolley2009-06-251-1/+9
|/ | | | tagged by /* unprivileged */.
* Bump copyright years to 2009Josh Stone2009-02-181-1/+1
|
* Add high-level support for @cast()ingJosh Stone2009-02-181-0/+64
| | | | | | | | | | | | | | | | | | This handles all of the parsing, traversal, and optimization. It doesn't actually resolve the cast yet though. * staptree.h (struct cast_op, visitor::visit_cast_op): New. * staptree.cxx (cast_op::print/visit, various visitor::visit_cast_op's): Incorporate cast_op into the basic tree operations. * parse.cxx (parser::parse_symbol): Parse @cast operator with an expression operand, type string, and optional module string. * translate.cxx (c_unparser::visit_cast_op): Error out if a @cast survives to translation. * elaborate.cxx (typeresolution_info::visit_cast_op): Error out if a @cast survives to type resolution. (symbol_fetcher::visit_cast_op): treat @casts as a symbol target (void_statement_reducer::visit_cast_op): unused @casts can be discarded, but the operand should still be evaluated.
* Simplify dead_stmtexpr_removerJosh Stone2009-02-101-2/+2
| | | | | | * staptree.h (update_visitor::require): Add a clearok parameter for optimizing traversers to signal that they're ready for NULL back. * elaborate.cxx (dead_stmtexpr_remover): Convert to an update_visitor.
* Create update_visitor for modifying treesJosh Stone2009-02-101-197/+301
| | | | | | | | | | | | | * staptree.h (update_visitor): A new visitor to make it easier to rewrite parts of a probe or function without making a full copy. * staptree.cxx (update_visitor::*): Each child is recursed with a require() call, and then the parent returns itself with provide(). * staptree.h (deep_copy_visitor): Inherit from update_visitor to get the recursive descent while updating nodes. * staptree.cxx (deep_copy_visitor::*): Use the implicit copy constructors to copy all fields, then defer to update_visitor for the recursion. Referents are still cleared from the copies of symbols and function calls.
* Simplify require() and provide()Josh Stone2009-02-101-135/+82
| | | | | | | * staptree.h (require, provide): Simplify stack operations with less pointer magic, and move to be deep_copy_visitor members. * staptree.h (deep_copy_visitor::deep_copy): Templatize * staptree.cxx, tapsets.cxx: Refactor require/provide callers
* Add Vim modelines for GNU style in stapJosh Stone2009-01-281-0/+1
|
* First attempt at printf kernel memory hex dumpElliott Baron2008-12-191-0/+8
|
* PR7051: Remove broken printf %n directive supportroot2008-12-051-8/+0
|
* PR6851: Added support for %c printf conversion specifier [trying again]Elliott Baron2008-10-201-1/+9
|
* trailing whitespace removal, as approved by emacsFrank Ch. Eigler2008-08-281-68/+68
| | | | (add-hook 'before-save-hook 'delete-trailing-whitespace)
* PR6538: fix treatment of initialized globalsFrank Ch. Eigler2008-05-211-1/+6
|
* PR6538: warn about read-only variablesFrank Ch. Eigler2008-05-201-3/+30
|
* PR6466: broad side-effect free statement elisionFrank Ch. Eigler2008-04-291-0/+8
|
* 2008-03-12 Dave Brolley <brolley@redhat.com>brolley2008-03-121-0/+7
| | | | | | PR5897 * staptree.cxx (probe::printsig): If this probe was derived from an alias, call the printsig method of the alias.
* PR5516: assignment to $pointersfche2008-03-031-0/+11
| | | | | | | | | | | | | | | | | | | | | 2008-03-03 Frank Ch. Eigler <fche@elastic.org> PR5516 * elaborate.cxx (symbol_fetcher, dead_assignment_remover): Support unresolved $target lvalues. Propagate pretty error messages. * staptree.cxx (varuse_collecting_visitor target_symbol): Ditto. * staptree.h: Corresponding decl. * loc2c.c: c_translate_pointer_store: New function. * loc2c.h: Corresponding decl. * tapsets.cxx (dwflpp::translate_final_fetch_or_store): Call it for $target pointer assignments. 2008-03-03 Frank Ch. Eigler <fche@elastic.org> PR5516 * buildok/twentynine.stp: New test.
* 2008-02-21 Dave Brolley <brolley@redhat.com>brolley2008-02-271-9/+45
| | | | | | | | | | | | | | | | | | | | | | PR5189 * staptree.h (print_format::conv_memory): New enumerator. (print_format::width_type): New enumeration. (print_format::precision_type): New enumeration. (format_component::widthtype): New member. (format_component::prectype): New member. (format_component::is_empty): Test widthtype and prectype. (format_component::clear): Clear widthtype and prectype. * staptree.cxx (print_format::components_to_string): Handle dynamic width and precision. Handle conv_memory. (print_format::string_to_components): Parse dynamic width and precision specifiers. Set widthtype and prectype. Parse %m format specifier. * elaborate.h (typeresolution_info::check_arg_type): New method. * elaborate.cxx (typeresolution_info::visit_print_format): Account for dynamic width and precision when computing the expected number of arguments. Check the types of arguments for dynamic width and precision. Use check_arg_type to check the types of all arguments. Handle print_format::conv_memory. (typeresolution_info::check_arg_type): New method. * NEWS: Describe the enhancements above.
* 2008-02-13 Dave Brolley <brolley@redhat.com>brolley2008-02-131-2/+2
| | | | | | | | | | | | | | | | | PR5609 * staptree.h (probe::collect_derivation_chain): Now takes vector<probe*>. (probe::get_alias): New virtual method. * elaborate.h (derived_probe::collect_derivation_chain): Now takes vector<probe*>. * staptree.cxx (probe::collect_derivation_chain): Now takes vector<probe*>. Don't cast 'this' to (derived_probe*). * elaborate.cxx (derived_probe::collect_derivation_chain): Now takes vector<probe*>. (alias_derived_probe::get_alias): New virtual method. (alias_derived_probe::alias): New member. (alias_expansion_builder::build): Call checkForRecursiveExpansion and emit a diagnostic if recursion is detected. Pass alias to constructor of alias_derived_probe. (alias_expansion_builder::checkForRecursiveExpansion): New method. * coveragedb.cxx: Pass vector<probe*> on all calls to collect_derivation_chain.
* update copyright years for recent checkinsfche2008-01-281-1/+1
|
* PR 5672: fix generated dwarf probe point names from wildcardsfche2008-01-251-0/+8
| | | | | | | | | | 2008-01-25 Frank Ch. Eigler <fche@elastic.org> PR 5672. * staptree.cxx (probe_point copy ctor): New function. * staptree.h: Declare it. * tapsets.cxx (dwarf_derived_probe ctor): Call it to shallow-copy incoming base probe location before recomputing/overwriting it.
* 2008-01-24 Dave Brolley <brolley@redhat.com>brolley2008-01-241-0/+28
| | | | | | | | PR 5017. * staptree.cxx (<cstring>): #include it. (required <indexable *>): Remove 'static' from instantiation and move instantiation to here from... * staptree.h: ...here.
* PR 4936: probe pont conditions part 2; reorg in prep for full rewritingfche2008-01-181-21/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2008-01-17 Frank Ch. Eigler <fche@elastic.org> PR 4935. Reorganize probe condition implementation. * elaborate.cxx (add_condition): New function. (derived_probe): Remove condition member. (derived_probe ctors): Assert non-null incoming probe/location ptrs. (insert_condition_statement): Remove; turn into ... (semantic_pass_conditions): New pass-2 subpass. (semantic_pass_symbols, visit_symbol, visit_functioncall, find_var): Detect some condition-related error cases. (match_key): Change type to exp_type from tok_type. Update callers. (alias_expansion_builder): Propagate probe conditions. * staptree.cxx (probe): Remove condition field and related functions. * tapsets.cxx (dwarf_derived_probe ctor): Compute replacement wildcard-expanded probe_point preserving more of the original location. (mark_derived_probe ctor): Make similar to others - take location rather than condition parameters. * translate.cxx (emit_common_header): Tweak ordering of tmpcounter traversal and hashkey expression generation. * elaborate.h: Corresponding changes. 2008-01-17 Frank Ch. Eigler <fche@elastic.org> PR 4935. * semko/forty.stp, fortyone.stp, fortytwo.stp: New tests. * semok/twentynine.stp: Weaken test since condition expressions have become more tightly constrained.
* PR5017: gcc4.3 build fixesfche2007-12-111-0/+1
| | | | | | | 2007-12-11 Frank Ch. Eigler <fche@elastic.org> * staptree.cxx, staptree.h: More GCC 4.3 build fixes from Eugeniy Meshcheryakov <eugen@debian.org>.
* * conditional probe thinko fix cont'dfche2007-11-261-3/+3
|
* 2007-11-20 Masami Hiramatsu <mhiramat@redhat.com>hiramatu2007-11-201-2/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | PR 4935. * parse.cxx (parser::parse_probe_point): Parse "if" condition following probe point. * staptree.h (probe_point): Add "condition" field. (probe): Add "condition" field and "add_condition" method. (deep_copy_visitor): Add "deep_copy" method for the expression. * staptree.cxx (probe_point::probe_point): Initalize it. (probe::add_condition): Implement it. (probe::print): Output "condition" field. (probe::str): Ditto. (deep_copy_visitor::deep_copy): Implement it. * elaborate.h (derived_probe): Add "insert_condition_statement" method. * elaborate.cxx (derived_probe::derived_probe): Initialize "condition" field, and insert a condition check routine on the top of body. (derived_probe::insert_condition_statement): Implement it. (alias_expansion_builder::build): Pass the condition from the alias referer to new alias. * tapsets.cxx (be_derived_probe): Remove unused constructor. (dwarf_derived_probe::dwarf_derived_probe): Insert a condition check routine on the top of body. (mark_derived_probe::mark_derived_probe): Ditto. (mark_builder::build): Pass the base location to mark_derived_probe.
* PR 3887: sufficient+optional probe pointsfche2007-11-201-6/+10
| | | | | | | | | | | | | | | | 2007-11-19 Frank Ch. Eigler <fche@elastic.org> PR 3887. * staptree.h (probe_point): Add "sufficient" field. * staptree.cxx: Initialize it, print it. * parse.cxx (parse_probe_point): Parse it. * elaborate.cxx (derive_probes): Implement it. * stapprobes.5.in: Document it. * NEWS: Gloat about it. * parseok/five.stp, semok/twentyseven.stp: Test "!" probe point flag. * iostat-scsi.stp: Adopt "!" probe point flag.
* 2007-11-12 Martin Hunt <hunt@redhat.com>hunt2007-11-121-2/+9
| | | | | | | | | | | | | * translate.cxx (visit_print_format): Strings without a format or formatted with "%s" or "%s\n" should be printed with calls to _stp_print(). Call _stp_print_char() if printing a char. * staptree.cxx (parse_print): Check for "print_char". * staptree.h (struct print_format): Add print_char. (parse_print): Update prototype. * parse.cxx (parse_symbol): Set print_char bool in print_format.