| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
* elaborate.cxx (const_folder::visit_if_statement, visit_binary_expression,
visit_ternary_expression): Print constant value in -vvv diagnostics.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
* elaborate.cxx (add_global_var_display): Assign a few token*s.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
We can concat literal strings directly and discard empty strings.
* elaborate.cxx (const_folder::visit_concatenation): Implement.
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* '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
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| | |
It only needs a token*, so build that into the constructor.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
| |
probe points.
|
|
|
|
|
|
|
| |
- 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.
|
|
|
|
| |
Part 2]
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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".
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
* elaborate.cxx (semantic_pass_opt2): Use "never-assigned" instead
of "read-only".
(dead_stmtexpr_remover::visit_expr_statement): Ditto.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
| |
* elaborate.cxx (semantic_pass): Don't add "no probes found" if session
already had other errors.
|
|\
| |
| |
| |
| |
| | |
Conflicts:
cache.cxx
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\| |
|
| |
| |
| |
| |
| | |
The location already has a pointer to a stapfile with the filename, so
there's no need to keep an extra copy.
|
| |
| |
| |
| | |
tagged by /* unprivileged */.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\|
| |
| |
| |
| |
| | |
Conflicts:
tapsets.cxx
|
| |
| |
| |
| |
| |
| | |
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.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\| |
|