summaryrefslogtreecommitdiffstats
path: root/parse.cxx
Commit message (Collapse)AuthorAgeFilesLines
...
* 2007-05-31 Frank Ch. Eigler <fche@elastic.org>fche2007-05-311-0/+1
| | | | | | PR 3579 From Eugeniy Meshcheryakov <eugen@debian.org> * cache.cxx, parse.cxx: Add #include <cstring> for gcc 4.3.
* 2007-04-18 Frank Ch. Eigler <fche@elastic.org>fche2007-04-181-9/+9
| | | | * parse.cxx (scan_pp): Correct warnings from if/if/else nesting.
* 2007-04-03 Pierre Peiffer <pierre.peiffer@bull.net>fche2007-04-041-32/+96
| | | | | | | | | | | | | | | * parse.cxx, parse.h (lexer::scan): Add $# and @# identifiers. (eval_pp_conditional, scan_pp): Allow the use of $x and @x identifiers. Produce more accurate error messages. * stap.1.in: Document $# and @# identifiers. 2007-04-04 Pierre Peiffer <pierre.peiffer@bull.net> * parseok/fourteen.stp: Add test about $# and @# usage during the preprocessing. * parseko/preprocess10.stp: New test. * parseko/preprocess11.stp: New test. * parseko/preprocess12.stp: New test.
* 2007-04-03 Frank Ch. Eigler <fche@elastic.org>fche2007-04-031-19/+21
| | | | | | | | Improve error messages for underprivileged scripts. * parse.h (parse_error): Add skip_some member, true default. * parse.cxx (parse_embedded_code): Send false on missing -g. * parse.cxx (parser::parse): Respect flag during parse error recovery.
* 2007-03-22 Frank Ch. Eigler <fche@elastic.org>fche2007-03-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | PR 4224. * staptree.h (probe): Add privileged field. * elaborate.cxx, parse.cxx: Pass privileged flag to probes. * tapsets.cxx (dwarf_query): Add has_absolute field. (dwarf_derived_probe ctor): Tolerate it. (register_patterns): Expose it. (dwarf_builder::build): Implement it with no dwfl whatsoever. * NEWS: Document kernel.statement().absolute. * stapprobes.5.in: Ditto. 2007-03-22 Frank Ch. Eigler <fche@elastic.org> PR 4224. * systemtap.base/probefunc.exp: Use kernel.statement().absolute instead with grep-found schedule_tick address. * semko/thirtyseven.stp, thirtyeight.stp: New tests. * buildok/twentyeight.stp: New test. 2007-03-22 Frank Ch. Eigler <fche@elastic.org> * sym.c (_stp_module_relocate): Tolerate empty section string.
* 2007-02-19 Frank Ch. Eigler <fche@elastic.org>fche2007-02-191-1/+1
| | | | | | | | | PR 4078 and more, including patch from Eugeniy Meshcheryakov <eugen@debian.org>: * Makefile.am (AM_CXXFLAGS, AM_CFLAGS): Add -Wextra -Wall -Werror consistently. * Makefile.in: Regenerated. (*): Many minor warning fixes.
* 2006-12-21 Josh Stone <joshua.i.stone@intel.com>jistone2006-12-221-7/+22
| | | | | | | | | | | | | | | | | PR 3671 * parse.cxx (parser::parse_global): Allow a maxsize on global arrays. * staptree.h (struct vardecl): Add the maxsize field. * staptree.cxx (vardecl::vardecl): Init. maxsize. (vardecl::set_arity): Don't allow arity 0 when there's a maxsize. (vardecl::compatible_arity): Ditto. (vardecl::print): Include maxsize in output. (target_symbol::print): Ditto. * translate.cxx (struct mapvar, mapvar::mapvar): Add maxsize. (mapvar::init): Init maps with the given maxsize if specified, else keep using MAXMAPENTRIES. (mapvar::set): Make the error message give the maxsize. (mapvar::add): Ditto, and check for overflow on pmap add. (c_unparser::getmap): Pass the maxsize from the vardecl to mapvar.
* 2006-12-19 Frank Ch. Eigler <fche@redhat.com>fche2006-12-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | PR 3522. * tapsets.cxx (dwflpp::emit_address): Call _stp_module_relocate only once per session. Error message cleanup: duplicate elimination etc. * session.h (saved_errors): Store a set of 'em. (num_errors): Return set size. Remove old numeric field. Update all callers. * elaborate.cxx (systemtap_session::print_errors): Print each encountered message just once. * staptree (semantic_error): Make msg2 writeable. Add a chain field. * tapsets.cxx (*var_expanding*:visit_target_symbol): Set saved semantic_error's chain field. * elaborate.cxx (register_library_aliases, visit_foreach_loop, visit_functioncall, derive_probes): Plop "while: ..." error message prefix/suffix right into the semantic_error message string. * parse.cxx (lexer::scan): Identify erroneous token better in error message for unresolvable $N/@M command line args. * util.h (lex_cast_hex): Use std::hex, not std::ios::hex. 2006-12-19 Frank Ch. Eigler <fche@redhat.com> PR 3522. * buildok/twentyfive.stp: New test for static $var access.
* 2006-12-11 Josh Stone <joshua.i.stone@intel.com>jistone2006-12-111-3/+6
| | | | | * parse.cxx (parse::parse_literal): Enforce the lower bound on negative literals.
* 2006-12-08 Josh Stone <joshua.i.stone@intel.com>jistone2006-12-091-43/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | PR 3681. * staptree.h (struct vardecl): Add a literal 'init' member for the initialization value of globals. * staptree.cxx (vardecl::vardecl): Initialize 'init' to NULL. (vardecl::print): Print global init value during pass-1 output. * main.cxx (printscript): Print global init values during verbose pass-2 output. * parse.cxx (parser::parse_global): Set the initialization literal of global vardecls. * translate.cxx (var::init): Don't unconditionally override the value of numeric globals when the module_param isn't used. (c_unparser::emit_global_param): Write numeric module_params directly into the global variable, as an int64_t instead of long. (c_unparser::emit_global): Add initialization to global declarations. Don't create a temp module_param long for numeric globals anymore. runtime/ * runtime.h (param_set_int64_t, param_get_int64_t, param_check_int64_t): New functions to allow taking module parameters directly as int64_t values. testsuite/ * systemtap.base/global_init.exp, systemtap.base/global_init.stp: New test for checking the timeliness of global initialization.
* 2006-12-07 Josh Stone <joshua.i.stone@intel.com>jistone2006-12-081-17/+29
| | | | | | | | | | | | | | | | | | | | | | | PR 3624. * tapsets.cxx (struct be_derived_probe): Add a new priority parameter for begin/end probes, and a comparison function for sorting. (be_builder::build): Parse the priority & pass it to be_derived_probe. (be_derived_probe_group::emit_module_init, emit_module_exit): Sort the probe list by priority before emitting any code. (register_standard_tapsets): Add new begin/end variants. * parse.cxx (parser::parse_literal): Allow negative numeric literals, by checking for a '-' unary operator right before a number. testsuite/ * systemtap.base/be_order.exp, systemtap.base/be_order.stp, semok/beginend.stp: New tests for begin/end priorities. * lib/stap_run.exp: Anchor OUTPUT_CHECK_STRING to the end of output. * systemtap.base/maxactive.exp: Fix to compare output to the end. * systemtap.base/probefunc.exp: Ditto. * systemtap.samples/ioblocktest.exp: Ditto. * systemtap.samples/ioblocktest.stp: Ditto. * systemtap.samples/tcptest.exp: Ditto.
* 2006-11-06 David Smith <dsmith@redhat.com>dsmith2006-11-061-0/+9
| | | | | | | | | | | | | | | | | | | | | | | Added "limit EXP" support to foreach statements. * translate.cxx (c_tmpcounter::visit_foreach_loop): Handles "limit" member variable. (c_unparser::visit_foreach_loop): Ditto. * staptree.cxx (foreach_loop::print): Prints "limit EXP" addition. (traversing_visitor::visit_foreach_loop): Handles "limit" member variable. (deep_copy_visitor::visit_foreach_loop): Ditto. * staptree.h (struct foreach_loop): Added "limit" member variable. * stap.1.in: Added documentation for the "limit EXP" addition to foreach statement. * parse.cxx (lexer::scan): Added "limit" keyword for foreach statements. (parser::parse_foreach_loop): Parses "limit" keyword for foreach statements. * elaborate.cxx (symresolution_info::visit_foreach_loop): Handles "limit" member variable. (typeresolution_info::visit_foreach_loop): Ditto.
* 2006-09-27 Josh Stone <joshua.i.stone@intel.com>jistone2006-09-281-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * session.h (struct systemtap_session): Add kernel_base_release to store the kernel version without the -NNN suffix. * main.cxx (main): Generate and use kernel_base_release. * parse.cxx (eval_pp_conditional): Use kernel_base_release. * tapsets.cxx (profile_derived_probe::profile_derived_probe): Use kernel_base_release. * tapsets.cxx (timer_builder::build): Support a wide variety of timer varients -- jiffies, s/sec, ms/msec, us/usec, ns/nsec, and hz. Use hrtimers automatically on kernels that have it. (timer_builder::register_patterns): Bind all of the new timer varients in one easy place. (register_standard_tapsets): Call timer_builder::register_patterns. (struct hrtimer_builder): Removed since timer_builder is generic. * stapprobes.5.in: Document new timer.* functionality. * tapsets.cxx (hrtimer_derived_probe_group::emit_probes): Add a shared global for the actual hrtimer resolution, _stp_hrtimer_res. (hrtimer_derived_probe_group::emit_module): Init _stp_hrtimer_res. (hrtimer_derived_probe::emit_interval): Limit intervals at a minimum to the hrtimer's actual resolution. (hrtimer_derived_probe::emit_probe_entries): Forward timers based on previous expiration instead of restarting relative. testsuite/ * buildok/fourteen.stp: Test new timer functionality.
* 2006-09-06 Frank Ch. Eigler <fche@elastic.org>fche2006-09-061-3/+52
| | | | | | | | | | | | | Add basic support for initialized globals. * parse.cxx (parse_global): Parse initialization clause, implement by rewriting to "probe begin { var = value }". * parse.h: Corresponding changes. * stap.1.in: Document optional initialization. 2006-09-06 Frank Ch. Eigler <fche@elastic.org> * parseok/eighteen.stp, semok/twentythree.stp: New files for testing initialized globals.
* 2006-07-13 David Smith <dsmith@redhat.com>dsmith2006-07-131-1/+19
| | | | | | | | | | | | | | * parse.cxx (parser::expect_unknown2): New function that looks for 2 possible token types. * parse.cxx (parser::expect_ident_or_keyword): New function that calls parser::expect_unknown2. * parse.cxx (parser::parse_symbol): Calls parser::expect_ident_or_keyword to allow keywords to appear when expanding target symbols (Bugzilla #2913). * parse.h: Added prototypes for parser::expect_unknown2 and parser::expect_ident_or_keyword. * testsuite/parseok/seventeen.stp: New test to check for allowing keywords when expanding target symbols.
* Revert my former changes to lket_trace_extra() in translator.guanglei2006-06-091-11/+1
| | | | | a new way of allowing user add arbitrary trace data. And also provide a way of letting user write the trace data format.
* 2006-06-02 Frank Ch. Eigler <fche@elastic.org>fche2006-06-021-16/+24
| | | | | | | | | | | | | | PR 2645. * stapprobes.5.in: Document "?" probe point suffix. * parse.cxx (parse_probe_point): Recognize "?" optional suffix. * elaborate.cxx (derive_probes): Observe probe_point->optional. * staptree.h, staptree.cxx: Corresponding changes. * tapsets.cxx (never_derived_probe, never_builder): New classes. (register_standard_tapsets): Support "never" probe point. * testsuite/buildok/six.stp, parseok/five.stp: Modifed tests. * translate.cxx (emit_module_init): Format "-t" (benchmarking) cycle-time reports similarly to "-v" (verbose) times.
* make user able to append extra trace data. The way of logging backtrace is ↵guanglei2006-06-011-1/+12
| | | | | | | | also changed. lket_trace_extra() and lket_backtrace() are introduced for these two purpose. I also modified lket.5.in for the backtrace changes
* 2006-05-25 Josh Stone <joshua.i.stone@intel.com>jistone2006-05-251-14/+27
| | | | | * parse.cxx (parser::scan_pp): Free memory for tokens that are thrown away in the preprocessing stage.
* 2006-05-24 David Smith <dsmith@redhat.com>dsmith2006-05-241-0/+21
| | | | | | | | | | | | | | * elaborate.cxx (isglob): New function. (match_key::globmatch): New function. (match_node::find_and_build): Uses isglob() and match_key::globmatch() to provide support for wildcards such as "kernel.syscall.*read*" (Bugzilla #1928). * elaborate.h (match_key::globmatch): Added function declaration. * parse.cxx (parser::parse_probe_point): Collects one or more tokens into a single probe-point functor string. * testsuite/parseko/twentytwo.stp: New file. * testsuite/parseok/sixteen.stp: New file.
* 2006-05-23 David Smith <dsmith@redhat.com>dsmith2006-05-231-1/+1
| | | | * parse.cxx (parse_for_loop): Corrected error message.
* 2006-05-16 David Smith <dsmith@redhat.com>dsmith2006-05-161-42/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * parse.cxx (parser::parser): Added initializer for 'context' member variable. (tt2str): Added support for new tok_keyword type. (operator <<): Ignores keyword content when outputting error message. (lexer::scan): Recognizes keywords, such as 'probe', 'global', 'function', etc. and classifies them as type 'tok_keyword'. This causes keywords to become reserved so they cannot be used for function names, variable names, etc. (parser::parse): Changed tok_identifier to tok_keyword when looking for "probe", "global", or "function". Also sets context member variable which remembers if we're in probe, global, function, or embedded context. (parser::parse_probe, parser::parse_statement) (parser::parse_global, parser::parse_functiondecl) (parser::parse_if_statement, parser::parse_delete_statement) (parser::parse_break_statement, parser::parse_continue_statement) (parser::parse_for_loop, parser::parse_while_loop) (parser::parse_foreach_loop, parser::parse_array_in): Looks for tok_keyword instead of tok_identifier. (parser::parse_probe_point): Allows keywords as part of a probe name, since "return" and "function" are keywords. (parser::parse_return_statement): Looks for tok_keyword instead of tok_identifier. Make sure we're in function context. (parser::parse_next_statement): Looks for tok_keyword instead of tok_identifier. Make sure we're in probe context. * parse.h: Added parse_context enum. Added 'tok_keyword' to token_type enum. Added parse_context 'context' member variable to parser class. * stap.1.in: Because the string() function has been removed, the 'string()' function reference has been changed to a 'sprint()' function reference. * stapex.5.in: Ditto. * stapfuncs.5.in: The description of the string() and hexstring() functions has been removed. * testsuite/buildok/context_test.stp: Calls to the string() function were converted to sprint() function calls. * testsuite/buildok/fifteen.stp: Ditto. * testsuite/buildok/nineteen.stp: Ditto. * testsuite/buildok/process_test.stp: Ditto. * testsuite/buildok/task_test.stp: Ditto. * testsuite/buildok/timestamp.stp: Ditto. * testsuite/buildok/twentyone.stp: Ditto. * testsuite/semok/args.stp: Ditto. * testsuite/semok/seven.stp: Ditto. * testsuite/buildok/fourteen.stp: Calls to log()/string() were converted to a call to printf(). * testsuite/buildok/sixteen.stp: Ditto. * testsuite/buildok/thirteen.stp: Ditto. * testsuite/buildok/twentythree.stp: Ditto. * testsuite/buildok/twentytwo.stp: Ditto. * testsuite/buildok/seven.stp: Calls to the string() function were converted to sprint() calls. Calls to the hexstring() function were converted to sprintf() calls. * testsuite/semok/eleven.stp: Ditto. * testsuite/buildok/seventeen.stp: Calls to log()/hexstring() were converted to a call to printf(). * testsuite/semko/nineteen.stp: Ditto. * testsuite/parseok/three.stp: Because keywords are reserved, a variable named 'string' was renamed to 'str'. * testsuite/parseok/two.stp: Because keywords are reserved, a variable named 'global' was renamed to 'gbl'. * testsuite/transko/two.stp: Because the parser now checks for 'next' and 'return' statement context, a 'next' statement was removed from a function and a 'return' statement was removed from a probe.
* Print out information to make it easier to determine which probewcohen2006-05-091-3/+11
| | | | in script associated with timing information.
* epilogue mode probe aliases supportguanglei2006-05-081-2/+18
|
* 2006-04-19 Eugene Teo <eteo@redhat.com>fche2006-04-201-4/+2
| | | | | | PR 2014 * parse.cxx (lexer::scan): Added \[0-7]* case to preserve octal escape sequences.
* 2006-03-03 Josh Stone <joshua.i.stone@intel.com>jistone2006-03-031-1/+2
| | | | | | | | | * main.cxx (main): search forward for dashes in the kernel release, to work properly with release names with more than one dash. * parse.cxx (eval_pp_conditional): ditto * tapsets.cxx (profile_derived_probe::profile_derived_probe): ditto * safety/safety.py (StaticSafety::__build_search_suffixes): ditto, and add copyright & GPL tag
* 2006-02-23 Frank Ch. Eigler <fche@elastic.org>fche2006-02-231-5/+30
| | | | | | | | | | | | | | | PR 1304 * parse.cxx (lexer): Take systemtap_session argument. (lexer::scan): Support $1..$NNNN and @1...@NNNN expansion. * stap.1.in: Document this. * testsuite/semok/args.stp: New test. * translate.cxx (var::init, emit_global): Emit code to allow named module parameters to initialize global string/number scalars. * stap.1.in: Don't document this yet. PR 2334 * main.cxx (main): Clarify "-v" option repeatibility. * stap.1.in: Ditto.
* 2006-01-25 Frank Ch. Eigler <fche@elastic.org>fche2006-01-251-1/+1
| | | | | PR 2205, patch from <hiramatu@sdl.hitachi.co.jp>: * parse.cxx (scan): Correct EOF detection for %{ %} case.
* 2006-01-24 Frank Ch. Eigler <fche@elastic.org>fche2006-01-241-23/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR 2060 etc. * tapsets.cxx (visit_target_symbol): Tolerate failed resolution by letting target_symbol instance pass through to optimizer and type checker. * elaborate.cxx (semantic_pass_optimize): New family of functions and associated visitor classes. (visit_for_loop): Tolerate absent init/incr clauses. (semantic_pass): Invoke unless unoptimized (-u) option given. * main.cxx, session.h: Add support for flag. * staptree.cxx (visit_for_loop): Tolerate absent init/incr clauses. (traversing_visitor::visit_arrayindex): Visit the index expressions. (functioncall_traversing_visitor): New class. (varuse_tracking_visitor): New class. * staptree.h: Corresponding changes. * parse.cxx (parse_for_loop): Represent absent init/incr expressions with null statement pointer instead of optimized-out dummy numbers. * stap.1.in: Document optimization. * testsuite/{semko,transko}/*.stp: Added "-u" or other code to many tests to check bad code without optimizer elision. * testsuite/semok/optimize.stp: New test. * elaborate.cxx (unresolved, invalid, mismatch): Standardize error message wording. * stapfuncs.5.in: Tweak print/printf docs. * tapset/logging.stp: Remove redundant "print" auxiliary function, since it's a translator built-in. * testsuite/transok/five.stp: Extend test. * translate.cxx (emit_symbol_data): Put symbol table into a separate temporary header file, to make "-p3" output easier on the eyes. * buildrun.cxx (compile_pass): Eliminate test-mode support throughout. * main.cxx, session.h, translate.cxx: Ditto. * main.cxx (main): For last-pass=2 runs, print post-optimization ASTs.
* 2005-12-12 Frank Ch. Eigler <fche@redhat.com>fche2005-12-121-0/+1
| | | | | | | | | | | | | | | | | Fix parse tree pretty-printer. * staptree.h (print_format): Add raw_components field. * parse.cxx (parse_symbol): Set it. * staptree.cxx (lex_cast_qstring): Copy it here too. (binary_expression::print): Add a space around operator, due to lexical ambiguity (expr % paren-expr) vs %( preprocessor op. (array_in:: foreach_loop:: arrayindex::print): Print base as indexable. (print_format::string_to_components): Use parse_error, not semantic. (print_format::print): Properly quote formatting string. Print histogram argument. * translate.cxx (visit_print_format): Properly quote formatting string. (varlock): Reword lock timeout error message. * testsuite/buildok/printf.stp: Add some quoting troublemakers. * testsuite/parseok/unparser.stp: New file.
* 2005-12-05 Frank Ch. Eigler <fche@elastic.org>fche2005-12-051-0/+1
| | | | * *.cxx: Add <cassert> #include as needed.
* 2005-12-02 Graydon Hoare <graydon@redhat.com>graydon2005-12-021-3/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * elaborate.cxx (mutated_var_collector): Forward traversal portion of calls to base class. (mutated_var_collector::visit_arrayindex): Resolve arrayindex-into-histogram expression as pe_long. (typeresolution_info::visit_print_format): Traverse into histogram if present. * parse.cxx (parse_symbol): Handle parse ambiguity surrounding print(@hist_op(...)[...]). * staptree.cxx (traversing_visitor::visit_arrayindex): Visit base member of arrayindex. * translate.cxx (c_unparser::histogram_index_check): New method. (var::hist): Fix bug. (var::buckets): New method. (stmt_expr::stmt_expr): Print with newline. (c_unparser::load_map_indices): Handle indexing-histogram case. (c_tmpcounter::visit_arrayindex): Likewise. (c_unparser::visit_arrayindex): Likewise. (c_tmpcounter_assignment::visit_arrayindex): Throw error when user attempts to write to histogram bucket. (c_unparser_assignment::visit_arrayindex): Likewise. * testsuite/buildok/print_histogram_entry.stp: New test.
* [ChangeLog]graydon2005-11-291-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-11-28 Graydon Hoare <graydon@redhat.com> * translate.cxx (var::assert_hist_compatible): New method. (var::hist): New method. (c_unparser::load_aggregate): New method. (hist_op_downcaster): Remove, it was a mistake. (expression_is_hist_op): Likewise. (c_tmpcounter::visit_print_format): Implement print(@hist(...)). (c_unparser::visit_print_format): Likewise. * staptree.h (struct print_format): Add optional hist_op* member. * staptree.cxx (traversing_visitor::visit_functioncall): Visit hist_op if present in print_format. (deep_copy_visitor::visit_print_format): Likewise. * parse.cxx (parse_symbol): Special case to consume print(@hist(...)). * elaborate.cxx (typeresolution_info::visit_arrayindex): Fix type inference bug. (typeresolution_info::visit_foreach_loop): Likewise. * testsuite/buildok/print_histograms.stp: New test. [runtime/ChangeLog] 2005-11-28 Graydon Hoare <graydon@redhat.com> * stat-common.c (_stp_stat_print_histogram): Various formatting corrections and aesthetic tweaks. (__stp_stat_add): Correction to linear bucket underflow cases.
* 2005-11-24 Frank Ch. Eigler <fche@redhat.com>fche2005-11-241-41/+64
| | | | | | | | | PR 1903 * parse.cxx (eval_pp_conditional): Support %( arch == "i686" %) form. * stap.1.in: Document it. * testsuite/parseok/fourteen.stp: Test it. * session.h (architecture): New field. * main.cxx (main): Initialize it.
* 2005-11-23 Graydon Hoare <graydon@redhat.com>graydon2005-11-241-36/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * elaborate.h (get_symbol_within_expression): Make visible. * elaborate.cxx (get_symbol_within_expression): Make non-static. (stat_decl_collector): New struct. (semantic_pass_stats): New semantic pass. (semantic_pass): Call it. (semantic_pass_symbols): Remove collection of statistic_decls from files. (visit_stat_op): Only fail if inferred type is not pe_long. * parse.cxx (parser::parse): Don't pass per-file statistic_decl into parse_global. (parser::parse_global): Don't parse global statistic_decls, they're obsolete. * parse.hh (parser::parse_global): Adjust signature to match. * session.h (statistic_decl::operator==): New method. * staptree.h (print_format::is_empty): New method. (stapfile::stat_decls): Remove field. * staptree.cxx (string_to_components): Fix bugs in format-string parser. * translate.cxx (var): Make private fields protected. (var::init): Support HIST_NONE stats. (aggvar): New struct. (mapvar::is_parallel): New method. (mapvar::call_prefix): Use it. (mapvar::calculate_aggregate): New method. (mapvar::fetch_existing_aggregate): New method. (mapvar::get): Support pe_stats. (mapvar::init): Use is_parallel(), and support HIST_NONE. (itervar::itervar): Only fault on pe_unknown. (itervar::start): Use mapvar::is_parallel and mapvar::fetch_existing_aggregate. (emit_map_type_instantiations): Include alloc.c before pmap-gen.c. Include pmap-gen.c for pe_stats maps. (c_unparser::gensym_aggregate): New method. (c_unparser::visit_foreach_loop): Handle mapvar::is_parallel case. (arrayindex_downcaster): New struct. (expression_is_arrayindex): New function. (c_tmpcounter::visit_stat_op): New method. (c_unparser::visit_stat_op): Implement. (c_unparser::visit_hist_op): Add commentary, still not implemented. * testsuite/buildok/stat_{insert,extract}.stp: New tests. * testsuite/semok/ten.stp: Correct for changes to global declarations. * testsuite/semko/*.stp: Likewise.
* 2005-11-13 Graydon Hoare <graydon@redhat.com>graydon2005-11-141-79/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * staptree.h (struct indexable): New struct. (classify_indexable): New function. (classify_const_indexable): New function. (struct symbol): Implement indexable. (struct arrayindex): Take indexable as base. (struct foreach_loop): Take indexable as base. (struct print_format): New struct. (enum stat_component_type): New enum. (struct stat_op): New struct. (enum historgram_type): New enum. (struct hist_op): New struct. (struct visitor) (struct traversing_visitor) (struct throwing_visitor) (struct deep_copy_visitor): Add new visitor methods. (require): Specialize for indexable*. * staptree.cxx (print_format::*) (stat_op::*) (hist_op::*) (indexable::*) (traversing_visitor::*) (throwing_visitor::*) (deep_copy_visitor::*) (classify_indexable) (classify_const_indexable): Implement (deep_copy_visitor::*): Update to use indexables. * parse.h (parser::parse_indexable): New method. (parser::parse_hist_op_or_bare_name): New method. * parse.cxx (lexer::scan): Accept @ in identifiers. (parser::parse_array_in) (parser::parse_foreach_loop): Call parse_indexable. (parser::parse_hist_op_or_bare_name): Implement. (parser::parse_indexable): Implement. (parser::parse_symbol): Accept printf, stat_ops, hist_ops. * elaborate.h (struct typeresolution_info): Add methods for visiting print_format, stat_op, hist_op. * elaborate.cxx (symbol_fetcher): New class. (get_symbol_within_expression): New function. (get_symbol_within_indexable): New function. (mutated_var_collector): Replace mutated_map_collector. (no_var_mutation_during_iteration_check): Replace no_map_mutation_during_iteration_check. (semantic_pass_vars): Replace semantic_pass_maps. (semantic_pass): Update call accordingly. (symresolution_info::*) Add new visitors, teach about indexables (typeresolution_info::*) Likewise. * translate.cxx (c_unparser::getiter): Take symbol, not foreach_loop. (c_unparser::*) Add new visitors, teach about indexables. (c_tmpcounter::*) (delete_statement_operand_visitor::visit_arrayindex) (c_tmpcounter_assignment::*) (c_unparser_assignment::*): Likewise. (hist_op_downcaster): New struct. (expression_is_hist_op): New function. * testsuite/buildok/printf.stp: New test for print_format.
* 2005-11-01 Frank Ch. Eigler <fche@elastic.org>fche2005-11-021-6/+9
| | | | | | | | Sound advice from <drepper@redhat.com>: * configure.ac: Undo last change. * configure.ac: Unregenerated. * parse.cxx: Use glibc strverscmp function instead of rpmlib. * stap.1.in: Update correspondingly.
* 2005-11-01 Frank Ch. Eigler <fche@elastic.org>fche2005-11-011-26/+185
| | | | | | | | | | | | | | | | | | | | PR 1425. * configure.ac: Look for rpm-devel headers and libs. * configure: Regenerated. * session.h: New file to contain systemtap_session decl. * staptree.h: Likewise evict statistics_decl. * elaborate.h: Corresponding changes. * main.cxx (usage): Elaborate. Re-enable "-r RELEASE" option. * parse.cxx (parser): Add systemtap_session& field. Update users. (scan_pp, eval_pp_conditional): New routines for preprocessing. (peek, next): Call it. (lexer::scan): Lex the preprocessor operators. (parser::parse): Include an extra level of exception catching for parse errors that occur during recovery. * parse.h: Corresponding changes. (parse_error): Allow explicit token parameter. * stap.1.in: Document preprocessing. * testsuite/parseok/fourteen.stp: New test.
* 2005-10-20 Graydon Hoare <graydon@redhat.com>graydon2005-10-201-6/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR 917 (incomplete) * staptree.h (struct statistic_decl): New struct. (stapfile::stat_decls): New member. * parse.h, parse.cxx (parser::expect_known): Fix typo. (parser::expect_number): New method. (parser::parse_global): Parse global statistic_decls. * elaborate.h (systemtap_session::stat_decls): New member. * elaborate.cxx (semantic_pass_symbols): Copy per-file stat_decls to session-wide. (typeresolution_info::visit_assignment): Detect some semantic stats errors in type resolution pass. * translate.cxx (var::sd): New private member. (var::var): Initialize it. (var::sdecl): New accessor. (var::init): Handle stats values. (mapvar::mapvar): Pass through statistic_decl to var ctor. (mapvar::get): Test for long explicitly. (mapvar::set): Likewise. (mapvar::init): Handle stats values. (c_unparser::emit_common_header): Remove typedef of stats_t, include stat.c when necessary. (mapvar::key_typename): Typo. (c_unparser::emit_map_type_instantiations): Thinko: value_typename not key_typename. (c_unparser::c_typename): Implementation typename is "Stat", not "stats_t". (c_unparser::c_assign): Fix bad error message. (c_unparser_assignment::c_assignop): Handle operator <<<. (c_unparser::getvar): Feed session statistic_decl into var. (c_unparser::getmap): Likewise. (c_unparser::visit_assignment): Handle operator <<<. (c_tmpcounter_assignment::visit_symbol): Derive type from rvalue when present. (c_unparser_assignment::visit_symbol) (c_tmpcounter_assignment::visit_arrayindex) (c_unparser_assignment::load_map_indices): Likewise. (c_unparser::visit_arrayindex): Likewise, and Prohibit statistic rvalues. (c_unparser_assignment::visit_arrayindex): Handle operator <<<. * testsuite/semko/twentyfour.stp: * testsuite/semko/twentyfive.stp: * testsuite/semko/twentysix.stp: * testsuite/semko/twentyseven.stp: * testsuite/semko/twentyeight.stp: * testsuite/semko/twentynine.stp: * testsuite/semko/thirty.stp: * testsuite/semko/thirtyone.stp: New tests for prohibited statistic contexts. * testsuite/buildok/twentytwo.stp: New test for legal statistic contexts.
* 2005-10-17 Frank Ch. Eigler <fche@elastic.org>fche2005-10-181-33/+25
| | | | | | | | | | | | | | | | | | | | PR 1338. * parse.cx (parse_probe): Unconditionally visit parse_probe_point. (parse_probe_point): Accept "*" as component name. * stapprobes.5.in: Document this. * elaborate.cxx (derive_probes): Rewrite. Make top-level function. (match_node::find_and_build): New function to replace (find_builder): Removed. (match_key operator <): Correct one nasty typo. (match_node::bind): Refuse to bind "*" component names. (derived_probe_builder::build): Remove recursion output param. (alias_expandion_builder::build): Recurse to derive_probes instead. * elaborate.h: Corresponding changes. * tapsets.cxx: Ditto. (query_cu): Elide prologue finding for uninteresting CUs. * testsuite/semok/nineteen.stp: New test. * testsuite/semko/twentythree.stp: New test. * testsuite/semko/twentyone/two.stp: Fix -p2.
* 2005-10-07 Frank Ch. Eigler <fche@elastic.org>fche2005-10-071-1/+24
| | | | | | | | | | | | | | | | PR 1366. * staptree.h (foreach_loop): Add sort_column, sort_direction fields. * parse.cxx (parse_foreach_loop): Parse "+"/"-" suffix operators. * stap.1.in, stapex.5.in: Document them. * staptree.cxx (foreach_loop print, copy): Propagate them. * translate.cxx (visit_foreach_loop): Support them. * testsuite/parseok/fifteen.stp, parseko/thirteen.stp, buildok/twentyone.stp: Test them. 2005-10-07 Frank Ch. Eigler <fche@elastic.org> PR 1366. * systemtap.samples/primes.*: Sort foreach gratuitiously.
* 2005-09-28 Frank Ch. Eigler <fche@elastic.org>fche2005-09-281-0/+2
| | | | | | | | | | | | | | | | PR 1182. * main.cxx (main): Support -D macro-setting option. * stap.1.in: Document it and related macros. * buildrun.cxx (compile_pass): Emit macro definitions. * translate.cxx (translate_pass): Guard limit macros with #ifdef. Eliminate MAXCONCURRENCY macro. * elaborate.h (systemtap_session): Add "macros" field. * parse.cxx (parse_if_statement): Clear "elseblock" if needed. 2005-09-28 Frank Ch. Eigler <fche@elastic.org> PR 1182. * systemtap.samples/control_limits.*: New test.
* 2005-09-03 Frank Ch. Eigler <fche@elastic.org>fche2005-09-031-0/+23
| | | | | | | | | | PR 1292, by popular request. * parse.cxx (parse_functiondecl): Allow optional value/param type declarations. * stap.1.in: Document this. * tapset/*.stp: Convert most functions accordingly. * testsuite/parseok/twelve.stp, semok/seven.stp, semko/twenty.stp: Test this.
* 2005-08-30 Graydon Hoare <graydon@redhat.com>graydon2005-08-311-9/+2
| | | | | | | | | | | | | | * tapsets.cxx (dwflpp::literal_stmt_for_local): Handle dwarf pointer-to-1-byte-means-char case (found in PR 1187) * parse.cxx (parse_symbol): Eliminate use of "." from target symbol parser, conflicting with string concatenation operator. * staptree.h (target_symbol::component_type) Eliminate comp_struct_pointer_member, since . and -> are considered the same now. * staptree.cxx (target_symbol::print): Likewise. * testsuite/buildok/seventeen.stp: Test solution on PR 1191. * testsuite/buildok/six.stp: Test working portion of PR 1155. * testsuite/semko/nineteen.stp: Unresolved portion of PR 1155.
* 2005-08-26 Graydon Hoare <graydon@redhat.com>graydon2005-08-261-2/+26
| | | | | | | | | | | * parse.cxx (scan): Preserve basic C-ish escapes. * translate.cxx (c_tmpcounter::declaring): New flag. (c_tmpcounter::declare_or_init): New helper method. (c_tmpcounter::visit_*): Use declare_or_init. (c_unparser::emit_function): Run a tmpcounter to initialize tmps. (c_unparser::emit_probe): Likewise. (c_unparser::c_strcpy): Use strlcpy. (c_unparser::c_strcat): Use strlcat.
* 2005-08-21 Frank Ch. Eigler <fche@redhat.com>fche2005-08-211-0/+1
| | | | | | | | | | | | | | | | | PR systemtap/1195, systemtap/1193 * elaborate.cxx (alias_expansion_builder): Set new block token. * parse.cxx (parse_symbol): Set new target_symbol token. * runtest.sh: Store more pertinent failure data. * tapsets.cxx (emit_probe_entries): Rewrite error-handling path. * translate.cxx (emit_common_header): Goodbye errorcount, hello last_error & last_stmt. (c_unparser::visit_statement): New "header" for all other stmts. (c_assignop, visit_binary_expression): Adapt to last_error. * tapset/builtin_logging.stp: Adapt to last_error. 2005-08-21 Frank Ch. Eigler <fche@redhat.com> * arith.c (*): Adapt to last_error context variable.
* 2005-08-12 Frank Ch. Eigler <fche@elastic.org>fche2005-08-121-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | PR systemtap/1122 et alii * parse.cxx (parse_literal): Parse and range-limit 64-bit numbers. (parse_unary): Correct precedence glitch. * staptree.h (literal_number): Store an int64_t. * staptree.cxx: Corresponding changes. * translate.cxx (check_dbz): Remove - insufficient. (emit_function): Define CONTEXT macro sibling for THIS. (c_typename): pe_long -> int64_t. (visit_literal_number): Format literal rigorously and uglily. (c_assignop, visit_binary_expression): Handle div/mod via new helper functions in runtime. * tapset/builtin_logging.stp: Add error, exit builtins. * testsuite/buildok/ten,eleven.stp: New tests. * testsuite/parse{ko,ok}/six.stp: Modify for larger numbers. * testsuite/transok/one.stp: Add more ";"s, maybe unnecessarily. 2005-08-12 Frank Ch. Eigler <fche@elastic.org> * arith.c: New file to contain arithmetic helper functions. * builtin_functions.h: Remove, unused. * runtime.h: Include it.
* 2005-08-09 Graydon Hoare <graydon@redhat.com>graydon2005-08-101-51/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * staptree.{cxx,h} (target_symbol): New struct. (*_visitor::visit_target_symbol): Support it. (visitor::active_lvalues) (visitor::is_active_lvalue) (visitor::push_active_lvalue) (visitor::pop_active_lvalue): Support lvalue-detection. (delete_statement::visit) (pre_crement::visit) (post_crement::visit) (assignment::visit): Push and pop lvalue expressions. * elaborate.{cxx,h} (lvalule_aware_traversing_visitor): Remove class. (no_map_mutation_during_iteration_check) (mutated_map_collector): Update lvalue logic. (typeresolution_info::visit_target_symbol): Add, throw error. * parse.{cxx,h} (tt2str) (tok_is) (parser::expect_*) (parser::peek_*): New helpers. (parser::parse_symbol): Rewrite, support target_symbols. * translate.cxx (c_unparser::visit_target_symbol): Implement. * tapsets.cxx (var_expanding_copy_visitor): Update lvalue logic, change visit_symbol to visit_target_symbol.
* 2005-08-03 Frank Ch. Eigler <fche@redhat.com>fche2005-08-031-0/+2
| | | | | | | | * stap.1: More meat, all stub sections filled. * elaborate.cxx (visit_assignment): Add numerous missing cases. * parse.cxx: Parse ".=" operator. * testsuite/semok/sixteen.stp: Check them. * main.cxx (usage): Don't show incompletely supported options.
* 2005-07-28 Frank Ch. Eigler <fche@redhat.com>fche2005-07-281-30/+38
| | | | | | | | | | | | | | | | | | | translator/1120 * main.cxx (main): Preset -R and -I options from environment variables (if set). Pass guru mode flags to parser. * parse.cxx (privileged): New parser operation flag. Update callers. (parse_embeddedcode): Throw an error if !privileged. (parse_functiondecl): Change signature. Prevent duplicates. (parse_globals): Ditto. * parse.h: Corresponding changes. * tapset/*.stp: Beginnings of real tapset library, to replace previous builtins. * tapsets.cxx: Greatly reduce verbose mode output. * Makefile.am: Install & dist it. * runtest.sh: Refer to it. * Makefile.in, aclocal.m4: Regenerated. * testsuite/*/*.stp: Set guru mode via /bin/sh if needed. * testusite/*/*ko.stp: Homogenize shell scripts.