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).
Josh Stone [Sat, 21 May 2011 01:41:39 +0000 (18:41 -0700)]
PR12770: In loc2c, discontiguify based on total_bytes
The total_bytes number is the part that really matters in determining
whether a given dereference is greater than native size. In particular,
using loc->byte_size from a loc_address was telling us that 4 bytes is
ok (sizeof pointer), even though the pointee was 8 total_bytes.
* loc2c.c (discontiguify::pieces_small_enough): Compare total_bytes to
the platform word size to decide whether to split into pieces.
(discontiguify): For loc_constant, we have nothing to do as they're
always copied byte-wise, but we should truncate the constant block to
total_bytes.
Josh Stone [Fri, 20 May 2011 23:29:21 +0000 (16:29 -0700)]
Let the @sum of an empty aggregate be 0
It's handy to have a defined meaning for the @sum of empty aggregate, so
one doesn't need to check for @count > 0 every time. For example, now a
pattern like "x += y; ... println(x)" can be more directly converted to
aggregates with "x <<< y; ... println(@sum(x))".
* translate.cxx (c_unparser::visit_stat_op): Let the @sum be read even
on empty aggregates, but leaving the old behavior for compatibility.
* testsuite/systemtap.maps/absentstats.exp: Check that both @count and
@sum are allowed by default, and only @count for stap <= 1.4.
* testsuite/systemtap.maps/ix_clear*.stp: Use @min for empty failure.
David Smith [Fri, 20 May 2011 22:17:58 +0000 (17:17 -0500)]
Fixed source_context.stp test.
* testsuite/semko/source_context.stp: Moved from parseko, since this is a
pass 2 test, not a pass 1 test. It was sucessfully failing before, but
only because the shell was trying to execute it instead of systemtap.
David Smith [Wed, 18 May 2011 15:32:56 +0000 (10:32 -0500)]
Fix pipe paths in the logger PMDA.
* pcp/src/pmdas/logger/event.c (event_create): Handle non-blocking reads.
* pcp/src/pmdas/logger/util.c (start_cmd): Close the correct side of the
pipe in the parent process.
Josh Stone [Tue, 17 May 2011 20:38:49 +0000 (13:38 -0700)]
Make sure that sigaction always starts zeroed
On some systems, stapsh's child process was getting automatically
reaped, which caused an error when we tried to waitpid(). This was
because we weren't fully zeroing the sigaction, so sa_flags was
uninitialized (and happened to contain SA_NOCLDWAIT).
This patch sprinkles memset-0 on sigactions throughout.
Frank Ch. Eigler [Tue, 17 May 2011 10:53:34 +0000 (06:53 -0400)]
PR12211: rework testsuite with failed-subtask tolerance
After PR12211, a "stap -c CMD" run where the CMD fails (rc != 0)
now results in an overall stap failure. This is undesirable with
some of the example scripts that use failed CMDs.
* systemtap.examples/general/para-callgraph-verbose.meta (test_installcheck):
Add a "|| true" to the sh -c command string to ensure CMD is deemed to
succeed.
* systemtap.examples/general/para-callgraph.meta: Ditto.
* systemtap.examples/process/noptrace.meta: Ditto.
Frank Ch. Eigler [Tue, 17 May 2011 10:50:45 +0000 (06:50 -0400)]
example: make badname demo work with euid=0
The stap testsuite may be run under euid=0, so make sure the
test triggers the name filtering.
* sysadmin.examples/general/badname.stp: Drop euid()==0 filtering.
Use a more specific file name substring, to prevent accidental
interference with host system during testsuite.
* sysadmin.examples/general/badname.meta: Adjust accordingly.
Frank Ch. Eigler [Sat, 14 May 2011 15:26:17 +0000 (11:26 -0400)]
PR12729: make childprocess spawning/waitpid both -vv verbose
With recent code, -vv was enough to get a "Running ...." message for
child processes of the translator, but not their "Spawn waitpid ..."
return codes. That required -vvv. Make them consistent.
* util.cxx (stap_waitpid): Report at verbosity > 1.
Frank Ch. Eigler [Sat, 14 May 2011 14:50:54 +0000 (10:50 -0400)]
--ldd: turn bad-interpreter findings into warnings
A semantic_error is too heavy. We can just skip the --ldd processing
for these binaries and move on.
* dwflpp.cxx (iterate_over_libraries): Print (suppressible) warning
instead of throwing a semantic_error if the module interpreter is
not in our whitelist.
Frank Ch. Eigler [Sat, 14 May 2011 14:49:43 +0000 (10:49 -0400)]
--ldd: improve error handling
* translate.cxx (add_unwindsym_ldd): Use delete, not free() on c++ object.
(prepare_translate_pss): Add an exception catch around prepare_symbol_data()
Sometimes stuff happens to probe handlers, and they refuse to clean up
cleanly (resetting their contexts to non-busy state). This can cause
module shutdowns to hang with a busy-waiting stapio. This patch lets
a user override the infinite loop with -DSTAP_OVERRIDE_STUCK_CONTEXT
to let the module be cleaned up. Without that set, at least the
infinite loop is made to spin less tightly.
* translate.cxx (c_unparser::emit_module_exit): Hang looser
upon stuck contexts.