diff options
author | Ben Pfaff <blp@nicira.com> | 2012-06-14 17:09:30 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2012-06-15 09:36:20 -0700 |
commit | d0c060994ae6c03ce18ee4f7be32795e85e892c2 (patch) | |
tree | 706376ec856f7081b92ac09753b40145f0fe1b1f /utilities/ovs-lib.in | |
parent | 7bb8f953527f8150dd5c2e50353a50ecd15e4427 (diff) | |
download | openvswitch-d0c060994ae6c03ce18ee4f7be32795e85e892c2.tar.gz |
ovs-ctl: Add support for running daemons under valgrind or strace.
This is occasionally useful for debugging.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'utilities/ovs-lib.in')
-rw-r--r-- | utilities/ovs-lib.in | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in index b8dc060a3..50a595094 100644 --- a/utilities/ovs-lib.in +++ b/utilities/ovs-lib.in @@ -88,7 +88,8 @@ pid_exists () { start_daemon () { priority=$1 - shift + wrapper=$2 + shift; shift daemon=$1 # drop core files in a sensible place @@ -105,6 +106,30 @@ start_daemon () { set "$@" --pidfile="$rundir/$daemon.pid" set "$@" --detach --monitor + # wrapper + case $wrapper in + valgrind) + if (valgrind --version) > /dev/null 2>&1; then + set valgrind -q --leak-check=full \ + --log-file="$logdir/$daemon.valgrind.log.%p" "$@" + else + log_failure_msg "valgrind not installed, running $daemon without it" + fi + ;; + strace) + if (strace -V) > /dev/null 2>&1; then + set strace -D -ff -o "$logdir/$daemon.strace.log" "$@" + else + log_failure_msg "strace not installed, running $daemon without it" + fi + ;; + '') + ;; + *) + log_failure_msg "unknown wrapper $wrapper, running $daemon without it" + ;; + esac + # priority if test X"$priority" != X; then set nice -n "$priority" "$@" |