* tapset/context.stp: Add function target().
* stapfuncs.5.in (target): Document it.
* elaborate.h (struct systemtap_session): Add cmd and target_pid to
the struct.
* main.cxx (usage): Add secriptions of "-c" and "-x" options.
(main): Set s.cmd and s.target_pid.
* buildrun.cxx (stringify): Copy this utility func here too.
(run_pass): Add new options to set cmd and pid to the stpd
command line.
* librelay.c: Remove all USE_PROCFS ifdefs.
(sig_usr): Signal handler for SIGUSR1.
(start_cmd): New function to handle "-c" option, forks()
off a new process then waits for SIGUSR1 to exec it.
(init_stp): Call start_cmd().
(stp_main_loop): Set a signal handler for SIGCHLD.
* stpd.c (main): Add "-t" and "-c" options.
(usage): Update with new options.
PR 1289
* translate.cxx (lex_cast_qstring): Correct "cast" of object
to string containing more than one word.
* tapset.cxx (lex_cast_qstring): Ditto.
(dwarf_derived_module::emit_probe_entries): Emit and use
a generic fault_handler.
PR 1172.
* staptree.h, staptree.cxx: Make all ::print*(), operator<<
functions take const staptree objects.
(literal_string::print): \-prefix double-quotes.
* translate.cxx (emit_common_header): Add context probe_point field.
Switch to atomic_t busy flags.
(emit_module_exit): Use atomic operations for busy flag.
(visit_*): Use lex_cast_qstring for last_stmt strings.
* tapsets.cxx (lex_cast_quoted): \-prefix double-quotes too.
(*::emit_probe_entries): Populate probe_point. Use atomic operations
for busy flag.
* tapset/context.stp (pp): New function.
* stapfuncs.5.in: Document it.
* testsuite/buildok/context_test.stp: Test it.
* translate.cxx (varlock): Use trylock only for write locks.
(translate_pass): Remove read_trylock macro hack.
(visit_foreach_loop): Remove protective read lock, until PR 1275.
(visit_*): Added many more "last_stmt"-setting expressions in the
output, to improve last_error message locality.
* translate.cxx (emit_probe): Add a call to _stp_print_flush
at the end of each probe.
(translate_pass): Define STP_NUM_STRINGS to be 1 for
a scratch string. Include current.c and stack.c. Don't
define KALLSYMS_LOOKUP_NAME or KALLSYMS_LOOKUP. Remove
references to next_fmt() and stp_dbug().
PR systemtap/1258
* tapsets.cxx (dwflpp::literal_stmt_for_local):
Support DW_TAG_enumeration_type tag as synonymous with
DW_TAG_base_type.
* loc2c.c (base_byte_size): Likewise.
* testsuite/buildok/seven.stp: Adjust to work on UP kernels.
fche [Wed, 31 Aug 2005 19:29:55 +0000 (19:29 +0000)]
2005-08-31 Frank Ch. Eigler <fche@redhat.com>
* translate.cxx (visit_array_in, visit_arrayindex): Use write locks
even for array reads, until PR 1275.
(translate_pass): Add read_trylock -> write_trylock escalation.
hunt [Wed, 31 Aug 2005 18:24:26 +0000 (18:24 +0000)]
2005-08-31 Martin Hunt <hunt@redhat.com>
* sym.c (_stp_kallsyms_lookup): Moved to runtime.h.
* stack.c (_stp_kta): Moved to runtime.h.
* runtime.h (init_module): Initialize _stp_kallsyms_lookup
and _stp_kta.
* probes.c (_stp_lookup_name): Replaced by kallsyms_lookup_name().
roland [Wed, 31 Aug 2005 03:14:16 +0000 (03:14 +0000)]
2005-08-30 Roland McGrath <roland@redhat.com>
* loc2c-runtime.h (fetch_register, store_register): Rewritten to pass
REGS to dwarf_register_<N> as a macro argument.
[__i386__, __x86_64__]: Update dwarf_register_* macros.
[__i386__] (dwarf_register_4): Define special case for stack pointer.
graydon [Wed, 31 Aug 2005 03:05:39 +0000 (03:05 +0000)]
2005-08-30 Graydon Hoare <graydon@redhat.com>
* 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.
fche [Tue, 30 Aug 2005 01:54:44 +0000 (01:54 +0000)]
2005-08-29 Frank Ch. Eigler <fche@redhat.com>
* stapprobes.5.in, stapfuncs.5.in, stapex.5.in: New man pages.
* stap.1.in: Moved some content out.
* Makefile.am (man_MANS): Add new man pages.
* configure.ac (AC_CONFIG_FILES): Add them.
* systemtap.spec.in: Package them.
* Makefile.in, configure: Regenerated.
* buildrun.cxx (run_pass): Pass "-r" to stpd.
* translate.cxx (emit_common_header): Wrap try/catch around
variable decls, to improve exception particularity.
(visit_literal_number): Emit as unsigned literal, which is
actually a subtle correctness issue.
fche [Sun, 28 Aug 2005 15:21:00 +0000 (15:21 +0000)]
2005-08-28 Frank Ch. Eigler <fche@redhat.com>
* translate.cxx (visit_target): Make target variable exceptions
more informative.
(literal_stmt_for_local): Improve bad-type exception message.
* translate.cxx (emit_module_init): Include probe point in comments.
graydon [Fri, 26 Aug 2005 19:41:31 +0000 (19:41 +0000)]
2005-08-26 Graydon Hoare <graydon@redhat.com>
* 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.
fche [Wed, 24 Aug 2005 17:01:52 +0000 (17:01 +0000)]
2005-08-24 Frank Ch. Eigler <fche@elastic.org>
* tapsets.cxx (*::emit_probe_entries): Treat NULL and "" last_errors
both as clean early returns, not errors.
* translate.cxx: Revamp last_error handling logic. Remove all
"goto out" paths from expression context.
(visit_statement): Handle last_error exit one nesting level at a time.
(visit_return_statement, visit_functioncall): Set/reset last_error="".
(c_tmpcounter::visit_for_loop): New routine.
(c_unparser::visit_foreach, visit_for_loop): Rewrite to properly
support continue/breaks, non-local exits, (foreach) locks.
(emit_global): Emit lock variable.
(varlock ctor, dtor): Lock/unlock global variable.
(varlock_w, varlock_r): New concrete subclasses. Update all users.
* tapset/builtin_logging.stp (exit): Don't set last_error.
* src/testsuite/buildok/sixteen.stp: New test.
* tapsets.cxx: Temporarily rolled back graydon's changes.
hunt [Wed, 24 Aug 2005 16:27:35 +0000 (16:27 +0000)]
2005-08-24 Martin Hunt <hunt@redhat.com>
* librelay.c (sigproc): Reestablish signal handler so
impatient people don't hit ^C twice and terminate the
program before it saves the data and removes the module.
Also print a message to stderr that it is exiting.
(stp_main_loop): Write OOB data (warnings, errors, etc)
to stderr instead of stdout.
* librelay.h: Write debug info to stderr.
* Makefile: add librelay.h to dependencies.
fche [Mon, 22 Aug 2005 19:14:35 +0000 (19:14 +0000)]
2005-08-22 Frank Ch. Eigler <fche@elastic.org>
PR systemtap/1134
* elaborate.h (module_fds): New member in systemtap_session.
* tapsets.cxx (dwarf_derived_probe ctor): Open /sys/module/$MOD/.text
for the duration of a systemtap session, to lock module in memory.
fche [Sun, 21 Aug 2005 12:11:41 +0000 (12:11 +0000)]
2005-08-21 Frank Ch. Eigler <fche@redhat.com>
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.
hunt [Fri, 19 Aug 2005 18:29:21 +0000 (18:29 +0000)]
2005-08-19 Martin Hunt <hunt@redhat.com>
* transport.c (_stp_cmd_handler): Remove. This was used by
stp-control.
* procfs.c (_stp_proc_write_cmd): Call schedule_work() instead
of running _stp_exit_handler immediately. Fixes a problem where
the module couldn't exit if all the output buffers were full.
Set .owner for the filesystem entries.