diff options
author | Jeff Morriss <jeff.morriss@ulticom.com> | 2011-10-27 02:32:32 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss@ulticom.com> | 2011-10-27 02:32:32 +0000 |
commit | 4de661bb9fc1783ea6b1b480758ba8314375b867 (patch) | |
tree | 5728f4eaceba5c9efed97e8b82136c751ed5608a /tools/valgrind-wireshark.sh | |
parent | 3c622f7b80f62fa2261b199e07098628bea7bb0c (diff) |
Add a little shell script to export the appropriate variables necessary for
running valgrind and then run it on either tshark or (if the user is very
patient) Wireshark.
svn path=/trunk/; revision=39627
Diffstat (limited to 'tools/valgrind-wireshark.sh')
-rwxr-xr-x | tools/valgrind-wireshark.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tools/valgrind-wireshark.sh b/tools/valgrind-wireshark.sh new file mode 100755 index 0000000000..1599bad99e --- /dev/null +++ b/tools/valgrind-wireshark.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# $Id$ +# +# A small script to export some variables and run tshark or wireshark in +# valgrind on a given capture file. + +# Directory containing tshark or wireshark. Default current directory. +BIN_DIR=. + +# Use tshark by default +COMMAND=tshark +COMMAND_ARGS="-nVxr" + +while getopts ":b:lw" OPTCHAR ; do + case $OPTCHAR in + b) BIN_DIR=$OPTARG ;; + l) LEAK_CHECK="--leak-check=full" ;; + w) COMMAND=wireshark + COMMAND_ARGS="-nr" ;; + esac +done +shift $(($OPTIND - 1)) + +if [ $# -ne 1 ] +then + printf "Usage: $0 [-b bin_dir] [-l] [-w] /path/to/file.pcap\n" + exit 1 +fi + +if [ "$BIN_DIR" = "." ]; then + export WIRESHARK_RUN_FROM_BUILD_DIRECTORY= +fi + +export WIRESHARK_DEBUG_EP_NO_CHUNKS= +export WIRESHARK_DEBUG_SE_NO_CHUNKS= +export G_SLICE=always-malloc # or debug-blocks + +libtool --mode=execute valgrind $LEAK_CHECK $BIN_DIR/$COMMAND $COMMAND_ARGS $1 > /dev/null |