| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
Inspired by the Python equivalents, these new utility functions just
make it a little cleaner to match at the beginning or end of a string.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
The operand of a unary may be yet another unary. This is useful for
things like boolean normalization, !!x.
* parse.cxx (parser::parse_unary): Recurse the operand.
* testsuite/parseok/eleven.stp: Add chained unary operators.
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* '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
|
| |
| |
| |
| | |
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.
|
|
|
|
|
| |
* parse.cxx (lexer::scan): Glue adjacent strings together.
* testsuite/parseko/twentyseven.stp, semok/thirtyfive.stp: New tests.
|
|
|
|
|
|
|
| |
* parse.cxx (eval_pp_conditional): If rhs and lhs are both CONFIG_...
identifiers try to convert them both to numbers or otherwise threat
them both as strings for eval_comparison.
* testsuite/semok/config_config.stp: New test.
|
|
|
|
|
|
| |
* parse.cxx (eval_pp_conditional): Handle r->type == tok_number when
l->type == tok_identifier.
* testsuite/semok/config_number.stp: New test.
|
|
|
|
|
|
|
|
|
|
|
| |
Our existing protection only made sure that the first token in a
substitution wasn't a nested substitution. That's not sufficient when
there could be multiple tokens involved. This patch makes sure that no
nested tokens are ever allowed to be argument substitutions.
This also adds a cursor_suspended_line/column and resets the main
cursor_line/column to the beginning of the substitution, so errors will
point a little closer to the right place.
|
|
|
|
|
| |
* parse.cxx (scan_pp): Match '%(' and '%?'.
* testsuite/semko/conditional.stp: New test.
|
|
|
|
|
|
| |
* parse.cxx (parser::parse_statement): Squash semicolon after non-block-like
statements.
* testsuite/buildok/semicolon.stp: New test.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
* parse.cxx (parser::parse_symbol): Add sprint[ln] to @hist_* hack.
* runtime/stat-common.c: Replace reprint with new reprint_buf, add more
generic _stp_stat_print_histogram_buf and call it from the older one.
Also correct some formatting issues.
* translate.cxx (c_unparser::visit_print_format): Add sprint case.
|
|
|
|
| |
* parse.cxx (eval_pp_conditional): Flip rhs and lhs args for fnmatch().
|
|
|
|
|
|
|
|
| |
* session.h (kernel_config[]): New session field.
* main.cxx (parse_kernel_config): Populate it.
* parse.cxx (eval_comparison): Use it.
* testsuite/buildok/utrace.stp, testsuite/parseok/kconfig.stp: New tests.
* NEWS, stap.1.in, doc/langref.tex: Mention it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
* parse.cxx (parser::scan_pp): Add || and &&.
* stap.1.in: Document || and && in PREPROCESSING.
* testsuite/parseok/twenty.stp: Test case.
* testsuite/parseko/preprocess14.stp: Ditto.
* testsuite/parseko/preprocess15.stp: Ditto.
Signed-off-by: Josh Stone <jistone@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
The components were being parsed for both target_symbols and cast_ops,
so this change refactors that code into a single function.
* parse.cxx (parser::parse_target_symbol_components): New.
(parser::parse_symbol): Use the new function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
* parse.cxx (operator << (ostream&,const source_loc&)): Add loc.file->name.
|
|
|
|
|
| |
The location already has a pointer to a stapfile with the filename, so
there's no need to keep an extra copy.
|
|
|
|
|
| |
This speeds up the parsing stage >2x, mostly by minimizing string
construction and comparison where char comparison will do.
|
|
|
|
|
| |
* parse.cxx (parser::parse_symbol): Strip off "struct " or "union "
from cop->type.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2008-02-25 Frank Ch. Eigler <fche@elastic.org>
PR5792.
* parse.cxx (eval_pp_conditional): Support wildcards in
%( kernel_v/kernel_vr/arch ==/!= "*foo?" %) operands.
* NEWS, stap.1.in: Document this.
2008-02-25 Frank Ch. Eigler <fche@elastic.org>
PR5792.
* systemtap.base/preprocessor.exp: New test.
|
|
|
|
|
| |
PR 5470
* parse.cxx (parser::parse_probe_point): Add checking pointer t.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PR 5376
* parse.cxx (lexer::scan): Treat '*' as an alphabet if the wildcard
flag is true.
(parser::parse_probe_point): Call parser::next() with wildcard = true.
(parser::scan_pp): Add wildcard flag and pass it to lexer::scan.
(parser::next): Ditto.
(parser::peek): Ditto.
* parse.h : Ditto.
* testsuites/perseko/twentytwo.stp: Change testcase to the wildcarded
probe points with spaces.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
* parse.cxx (parse_symbol): Accept println(@hist*()).
2007-09-12 Frank Ch. Eigler <fche@elastic.org>
* buildok/print_histograms.stp: Test println(@hist*()).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PR 5019
* elaborate.cxx (visit_hist_op): Remove log histogram param.
* translate.cxx (assert_hist_compatible): Ditto.
* staptree.cxx (hist_op::print): Ditto.
* session.h (statistic_decl): Ditto.
* parse.cxx (expect_number): Allow negative numbers.
Also validate that input is really numeric. This is used
by histograms to get the parameters.
(parse_hist_op_or_bare_name): Remove code to get parameter
for log histograms.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PR 4591
* parse.cxx (parser::parse_symbol): Tweak 'print' matching to allow
all the new variants with printd and println.
* staptree.h (struct print_format): Add fields for the new print
variants, and parse_print() to help matching.
* staptree.cxx (print_format::parse_print): New static method to
match the print variants and determine their properties.
(print_format::print): Handle the new print types.
(deep_copy_visitor::visit_print_format): Copy the new fields.
* translate.cxx (c_unparser::visit_print_format): Insert delims and
newlines where appropriate for new print functions.
* stap1.in: Document the new print functions.
testsuite/
* lib/stap_run.exp: Make sure to match the entire output, in case
there are multiple pass/fail messages.
* buildok/printf.stp: Add lines for new print variants.
* parseko/printd01.stp: Make sure that bad printd calls are handled.
* parseko/printd02.stp: Ditto.
* parseko/printd03.stp: Ditto.
* parseko/printd04.stp: Ditto.
* systemtap.base/print.stp: Try a bunch of different print calls.
* systemtap.base/print.exp: Driver for above.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PR 4846
* parse.cxx (input_put): New function, sort of like stdio ungetc.
(input_get): Skip cursor position changing for input_put strings.
(scan): Rework $.../@... substitution into character pasting.
* parse.h: Corresponding changes.
* util.h (lex_cast_qstring): Octal-quote unprintable characters.
* stap.1.in, NEWS: Document new behaviour.
2007-08-07 Frank Ch. Eigler <fche@redhat.com>
PR 4846
* parseko/preprocess13.stp, parseok/nineteen.stp,
semok/twentyfive.stp: New tests.
|
|
|
|
|
|
| |
PR 3579
From Eugeniy Meshcheryakov <eugen@debian.org>
* cache.cxx, parse.cxx: Add #include <cstring> for gcc 4.3.
|