Lukas Berk [Tue, 12 Jul 2011 19:06:09 +0000 (15:06 -0400)]
PR12729: Improve stap error message
Now report when the user doesn't have permission to run staprun
or if posix_spawnp is unable to launch the process
remote.cxx - finish now reports failure to launch
trycatch.exp - account for the new warning
util.cxx - report if staprun isn't executable or if stap_waitpid failed
Stan Cox [Tue, 12 Jul 2011 02:25:42 +0000 (22:25 -0400)]
PR6954 Add a used variables set for use by automatic global printing.
* staptree.h (varuse_collecting_visitor::used): New.
* staptree.cxx (varuse_collecting_visitor::visit_symbol): Use previous
method for setting read and write sets. Also set used set.
* elaborate.cxx (add_global_var_display): Use the used set.
* global_end.exp (global_end_var): Initialize to non-zero values.
* global_end.stp (global_end_var): Likewise.
- Use systemtap version number as the client/server protocol version
number.
- Client and Server will both be backward compaible with the other
by policy. i.e. both will adapt when connecting to a down-level
version of the other.
Mark Wielaard [Fri, 8 Jul 2011 14:53:10 +0000 (16:53 +0200)]
unwind.c consolidate sanity checking and cie/fde parsing.
Checking and parsing of FDE and CIE data was done in multiple places in
the code, some things were checked/parsed multiple times. Now is_fde()
and cie_for_fde() do the structural/id/version checking of FDEs
and CIEs. parse_fde_cie() parses the content of and checks the internal
consistency the CIEs and FDEs.
unwind.h: Removed now unused fields of struct unwind_state.
And removed unnecessary static function prototype declarations.
Josh Stone [Fri, 8 Jul 2011 01:26:28 +0000 (18:26 -0700)]
serverd: Fix the locale regex to allow '-' and not a range
[.-=] allows all characters from '.' to '=', 0x2E-0x3D
[.=-] allows exactly the characters '.' '=' '-'
The server_locale.exp test is supposed to check that '-' is allowed,
but its failure was incorrectly masked in commit 16560657. Added a
different disallowed character ';' to test as well.
Josh Stone [Tue, 21 Jun 2011 18:12:36 +0000 (11:12 -0700)]
PR5163: Cache uprobes.ko as we do with everything else
We now build uprobes in our writable tmpdir (rather than directly in
SYSTEMTAP_RUNTIME), and cache the result for reuse. This relieves the
pain of having to rebuild uprobes after every kernel change, and also
makes it possible to provide uprobes for multiple unique targets, as
needed for the compiler server and for remoting.
* buildrun.cxx (make_make_cmd): New, consolidate repeated code.
(compile_pass, make_tracequery, make_typequery_kmod): Use it.
(make_uprobes): Rewrite to build uprobes.ko under the tmpdir, just
using a #include to the main uprobes.c in the runtime.
(get_cached_uprobes, set_cached_uprobes): Read/write uprobes cache.
(uprobes_pass): Try to cache, then build if necessary.
(may_build_uprobes, verify_uprobes_uptodate, copy_uprobes_symbols):
Removed.
* hash.cxx (find_uprobes_hash): Prepare a hashed name for uprobes.
* main.cxx (passes_0_4): If the script was cached, make sure we still
find or build uprobes if needed too.
* stap-serverd.cxx (handleRequest): Get uprobes from the tmpdir rather
than from the runtime path, and sign it directly if needed.
* testsuite/lib/systemtap.exp (uprobes_p): Don't build uprobes here.
* testsuite/systemtap.base/buildid.exp: Launch a dummy pass-5 run, so we
don't have to worry about providing a path to staprun -u.
Stan Cox [Fri, 8 Jul 2011 01:41:14 +0000 (21:41 -0400)]
PR6954 Do automatic global printing for RMW operands.
* staptree.h (current_lvalue_read): New.
* staptree.cxx (varuse_collecting_visitor::visit_symbol): Do not
treat an RMW symbol as read if the value is not a real rvalue.
(varuse_collecting_visitor::visit_print_format): Handle current_lvalue_read.
(varuse_collecting_visitor::visit_assignment): Likewise.
(varuse_collecting_visitor::visit_delete_statement): Likewise.
* global_end.exp (global_end_var): Test RMW cases.
* global_end.stp (global_end_var): Likewise.
Mark Wielaard [Wed, 6 Jul 2011 21:07:51 +0000 (23:07 +0200)]
Silence sys/sdt.h comparison of unsigned expression < 0 is always false.
Some arm g++ setups would complain about the wchar_t "signedness detection":
sys/sdt.h:102: error: comparison of unsigned expression < 0 is always false
jistone said: "((T)(-1) < 1)" would still get the right boolean value,
and shouldn't trigger range errors like "unsigned is never < 0".
William Cohen [Wed, 6 Jul 2011 14:06:42 +0000 (10:06 -0400)]
PR12947 Properly track the creation of probes using hardware breakpoints
The logic for creation of probes using hardware breakpoints was incorrect.
The register_wide_hw_breakpoint() can return error codes in place of the
pointer. The value of the pointer needs to be checked to determine
whether it is the range of values indicating an error. The setup
code also needs to properly track whether the registration was completed
on a probe, so the shutdown code only calls unregister_wide_breakpoint()
for the probes that are actually registered.
Mark Wielaard [Tue, 5 Jul 2011 15:25:23 +0000 (17:25 +0200)]
unwind.c Only do a linear search if there isn't a search header.
There always should be one, we create it in the translator
if it didn't exist. Only if we are using elfutils < 0.142
should these ever be missing. If the binary search fails,
either because the unwind data is bad, or the address isn't
covered, don't fall back to linear searching. Add extra
checks and warning about bad debug frame header.
Mark Wielaard [Fri, 1 Jul 2011 17:33:02 +0000 (19:33 +0200)]
unwind.c fix CIE augmentation parsing.
fde_pointer_type and unwind_frame didn't handle the "S" augmentation
properly. This augmentation doesn't cary any extra data and so does
not need to be preceded by "z". Also added more sanity checking,
plus _stp_warn explanations when things go wrong/doesn't parse.
Mark Wielaard [Thu, 30 Jun 2011 12:14:14 +0000 (14:14 +0200)]
Handle CIE and FDE CFI sequentially in unwind.c instead of recursively.
Another simple unwind.c cleanup to make reasoning about the unwind state
easier, and to remove another (useless) recursive call. Also fixes CIE/FDE
comment mixup.
Mark Wielaard [Wed, 29 Jun 2011 15:20:30 +0000 (17:20 +0200)]
Refactor DW_CFA_remember/restore_state handling in unwind.c.
The old way of handling DW_CFA_restore_state involved recursively
calling processCFI() to replay the whole CFI stream up till the last
DW_CFA_remember_state instruction. This made it hard to reason about
the actual unwind state and could lead to processing the CFI stream
multiple times. In exchange for a little extra memory allocated upfront
to keep a small stack of register states we now just process all CFI in
one go. This change also splits out the unwind_reg_state from the
general unwind_state struct.
William Cohen [Wed, 29 Jun 2011 19:32:41 +0000 (15:32 -0400)]
Properly report the return code (rc) for registered hw breakpoint (PR12947)
In the case of an error, the return code (rc) was not set when
registering a hw breakpoint. This lead to the the SystemTap instrumentation
module trying to unregister a non-existant hw breakpoint and causing a
kernel oops. This patch ensure that the return code (rc) is set
and errors in hw breakpoint registration are handled correctly.
Dave Brolley [Tue, 28 Jun 2011 21:33:48 +0000 (17:33 -0400)]
check_groups cleanup in staprun.
- Remove unused extern "unprivileged_user'
- Correct error messages about which group memberships are necessary.
- Messages did not specify that stapusr is required if not root.
Dave Brolley [Mon, 27 Jun 2011 16:18:58 +0000 (12:18 -0400)]
PR 12917 - Implement Compile-Server/Client Versioning: Part 1
- Client and server both include 'version' file as part of their
request/response.
- Client and server both check that they can deal with the other.
- Currently both the client and the server can deal with all
previous versions of the the other.
- Both will reject an up level request/response from the other.
Chris Meek [Wed, 22 Jun 2011 20:04:40 +0000 (16:04 -0400)]
Fixed NSS object leak causeing failed shutdown
csclient.cxx
If the user's domain name did not match the DNS
name(s) on the server certificate, serverCert
was not being properly destroyed. This resaulted
in an object leak causing NSS to fail in shutting
down properly. Now it is properly destroyed, and NSS
properly shuts down, in this special case.
Chris Meek [Wed, 22 Jun 2011 13:13:48 +0000 (09:13 -0400)]
Added preliminary tests for server localization
testsuite/systemtap.server/server_locale.exp
Added tests for:
Embedded '\n' in Environment Variables
Use of "_.-@=" in Environment Variables
LANG Proper Syntax (english)
LANG Proper Syntax (french)
LANG Bad Syntax (english)
LANG Bad Syntax (french)
LANG Proper Syntax (english, -k)
LANG Proper Syntax (french, -k)
LANG Bad Syntax (english, -k)
LANG Bad Syntax (french, -k)
LC_ALL Proper Syntax (english)
LC_ALL Proper Syntax (french)
LC_ALL Bad Syntax (english)
LC_ALL Bad Syntax (french)
LC_ALL Proper Syntax (english, -k)
LC_ALL Proper Syntax (french, -k)
LC_ALL Bad Syntax (english, -k)
LC_ALL Bad Syntax (french, -k)
Note: Did not add tests yet for other locale variables
because they do not seem to have any effect on the output
David Smith [Fri, 17 Jun 2011 16:04:48 +0000 (11:04 -0500)]
Fixed PR12877 by handling exec properly in the task_finder.
* runtime/task_finder.c (stap_register_task_finder_target): For
"interesting" tasks, add an exec handler.
(__stp_utrace_task_finder_report_exec): When exec happens, let
__stp_utrace_task_finder_target_exec() handle callbacks for the
"original" task.
(__stp_utrace_task_finder_target_exec): Call callbacks for this
"interesting" task.
* testsuite/systemtap.base/proc_exec.exp: New test.
* testsuite/systemtap.base/proc_exec.c: New file.
* testsuite/systemtap.base/proc_fork_exec.c: Ditto.
* testsuite/systemtap.base/proc_thread_exec.c: Ditto.
Chris Meek [Fri, 17 Jun 2011 13:26:04 +0000 (09:26 -0400)]
Added --tmpdir=DIRECTORY option to stap
main.cxx
In remove_temp_dir(), added a check whether the --tmpdir has
been used. If so, it will not remove the directory, and it
will not print out "Keeping temporary directory..".
session.h
Added tmpdir_opt_set boolean value to the session, to keep
track of the use of --tmpdir
session.cxx
Added --tmpdir option, and added tmpdir_opt_set to the
constructor and copy constructor
stap-serverd.cxx
Made the server create the stap tmp directory and pass it to
stap using the --tmpdir option. The server now knows the name,
so there is no need to search through it for the "Keeping
temporary directory..." message, or move the directory to the
server's tmp directory.
Chris Meek [Mon, 13 Jun 2011 18:06:46 +0000 (14:06 -0400)]
PR12580 Added localization functionality to client-server exchange
NOTE: currently only works with English due to "keeping-temporary-directory"
limitation (relies on parsing English message). This will be fixed in a future
update.
csclient.cxx
Wrote add_localization_variables() function to include the client's localization
information in a file sent to the server.
stap-serverd.cxx
Wrote functionality in handleRequest() to unpackage and verify localization
information retrieved from the client.
util.cxx
Wrote localization_variables() function to maintain and return a set of all
the localization variables to transfer between client and server.
Lukas Berk [Fri, 10 Jun 2011 20:06:01 +0000 (16:06 -0400)]
PR12008 map module("foo-bar") to module("foo_bar")
NEWS - updated blurb, also added example to previous commit for
clarity.
tapsets.cxx - remapping done here
num_args.stp - modify some of the module names to account for change
and create testcase
Stan Cox [Wed, 8 Jun 2011 20:34:36 +0000 (16:34 -0400)]
Also allow library wildcards for sdt probes.
tapsets.cxx (query_one_library): Renamed from dwarf_query::query_library.
(dwarf_query::query_library): Call it from here...
(sdt_query::query_library): and here.
library.exp: Also test .mark
library.stp: Likewise.
Lukas Berk [Wed, 8 Jun 2011 15:23:20 +0000 (11:23 -0400)]
PR12427 implied process("...") target for stap -c CMD invocation
NEWS - news blurb
stapprobes.3stap - updated and noted change in functionality
tapsets.cxx - add new probe points to bind to, parse probe point
and assign to parameters and location->components->arg
process_by_cmd.* - test program for testsuite
* buildrun.cxx: Include the new test.
* runtime/autoconf-stacktrace_ops-warning.c: Check the warning field.
* runtime/stack.c: Conditionalize the warning initialization.
David Smith [Fri, 3 Jun 2011 14:03:06 +0000 (09:03 -0500)]
Beter itrace fix for BZ699342.
* tapset-itrace.cxx (itrace_derived_probe_group::emit_module_decls): Pass
the task pointer to find_itrace_info() instead of pid.
* runtime/itrace.c (find_intrace_info): Look up itrace_info structures by
task pointers, instead of by pid.
(remove_usr_itrace_info): Update debug message.
Atsushi Tsuji [Thu, 2 Jun 2011 16:22:12 +0000 (11:22 -0500)]
Improve error handling in __stp_utrace_attach().
utrace_attach_task() returns ESRCH (in current versions of utrace) in
the UTRACE_ATTACH_CREATE case if an error occurs. This patch improves
error checking to correctly ignore processes in "mortally wounded"
state.
Josh Stone [Wed, 1 Jun 2011 00:52:02 +0000 (17:52 -0700)]
dtrace: Clean up gettext initialization
- Provide something callable for the !USE_NLS case
- Use "...".replace directly instead of string.replace()
- Do initialization in a function, so globals aren't polluted.
Josh Stone [Tue, 31 May 2011 21:49:16 +0000 (14:49 -0700)]
staprun: Discriminate errors before retrying module insertion
* runtime/staprun/staprun_funcs.c(insert_module): Copy the saved_errno
back into errno when insertion fails.
* runtime/staprun/staprun.c(init_staprun): When the first insertion
attempt fails, check for EEXIST and then successful module removal
before trying module insertion again.
Dave Brolley [Fri, 27 May 2011 19:29:26 +0000 (15:29 -0400)]
Improve the chances of using the same port when the compile server is restarted.
1) Keep the socket open when the server takes itself down internally in order
to regenerate its certificate.
2) Use PR_SocketOpt_reuseaddr so that a specified port can be reused when the
server is externally halted and restarted.
Lukas Berk [Wed, 25 May 2011 20:51:17 +0000 (16:51 -0400)]
PR12743 stap -L 'process("PATH").syscall' now reports context variables
NEWS - added news comment
tapset-utrace.cxx - added utrace_derived_probe::getargs to push
back the context variables to be listed
David Smith [Mon, 23 May 2011 21:24:17 +0000 (16:24 -0500)]
Avoid some bad testsuite fails becase of unhandled child exit status warnings.
* testsuite/systemtap.base/target_set.exp: Handle warning about child
process exiting with a bad status.
* testsuite/systemtap.context/uprobe_stmt_num.exp: Ditto.
* testsuite/systemtap.context/uprobe_uaddr.exp: Ditto.
* testsuite/systemtap.context/usymbols.c: Explicitly exit with a status of
0 (to avoid warnings about bad child exit status).