bug 532962: allow run-mozilla.sh to accept debugger arguments. r=luser
authorChris Jones <jones.chris.g@gmail.com>
Mon, 07 Dec 2009 01:10:46 -0600
changeset 36167 69b012e64a77ba52aa35488cbdd27dbbdb5e2e95
parent 36166 c77da7450ba1d2f26df0d5f9c32a912c0ca9ac97
child 36168 4bc50caad8902e1113b72b25564500de23ced3ff
push idunknown
push userunknown
push dateunknown
reviewersluser
bugs532962
milestone1.9.3a1pre
bug 532962: allow run-mozilla.sh to accept debugger arguments. r=luser
build/unix/run-mozilla.sh
--- a/build/unix/run-mozilla.sh
+++ b/build/unix/run-mozilla.sh
@@ -54,26 +54,33 @@ echo ""
 echo "  options:"
 echo ""
 echo "    -g                   Run in debugger."
 echo "    --debug"
 echo ""
 echo "    -d debugger          Debugger to use."
 echo "    --debugger debugger"
 echo ""
+echo "    -a debugger_args     Arguments passed to [debugger]."
+echo "    --debugger-args debugger_args"
+echo ""
 echo "  Examples:"
 echo ""
 echo "  Run the mozilla-bin binary"
 echo ""
 echo "    ${cmdname} mozilla-bin"
 echo ""
 echo "  Debug the mozilla-bin binary in gdb"
 echo ""
 echo "    ${cmdname} -g mozilla-bin -d gdb"
 echo ""
+echo "  Run mozilla-bin under valgrind with arguments"
+echo ""
+echo "    ${cmdname} -g -d valgrind -a '--tool=memcheck --leak-check=full' mozilla-bin"
+echo ""
 	return 0
 }
 ##########################################################################
 moz_bail()
 {
 	message=$1
 	echo
 	echo "$cmdname: $message"
@@ -157,39 +164,40 @@ moz_debug_program()
 	else
 		debugger=`moz_get_debugger`
 	fi
     if [ -x "$debugger" ] 
     then
 # If you are not using ddd, gdb and know of a way to convey the arguments 
 # over to the prog then add that here- Gagan Saksena 03/15/00
         case `basename $debugger` in
-            gdb) echo "$debugger --args $prog" ${1+"$@"}
-                exec "$debugger" --args "$prog" ${1+"$@"}
+            gdb) echo "$debugger $moz_debugger_args --args $prog" ${1+"$@"}
+                exec "$debugger" $moz_debugger_args --args "$prog" ${1+"$@"}
 		exitcode=$?
                 ;;
-            ddd) echo "$debugger --gdb -- --args $prog" ${1+"$@"}
-		exec "$debugger" --gdb -- --args "$prog" ${1+"$@"}
+            ddd) echo "$debugger $moz_debugger_args --gdb -- --args $prog" ${1+"$@"}
+		exec "$debugger" $moz_debugger_args --gdb -- --args "$prog" ${1+"$@"}
 		exitcode=$?
                 ;;
-            *) echo "$debugger $prog ${1+"$@"}"
-                exec $debugger "$prog" ${1+"$@"}
+            *) echo "$debugger $moz_debugger_args $prog ${1+"$@"}"
+                exec $debugger $moz_debugger_args "$prog" ${1+"$@"}
 		exitcode=$?
                 ;;
         esac
     else
         moz_bail "Could not find a debugger on your system."
     fi
 }
 ##########################################################################
 ##
 ## Command line arg defaults
 ##
 moz_debug=0
 moz_debugger=""
+moz_debugger_args=""
 #
 ##
 ## Parse the command line
 ##
 while [ $# -gt 0 ]
 do
   case $1 in
     -g | --debug)
@@ -200,16 +208,25 @@ do
       moz_debugger=$2;
       if [ "${moz_debugger}" != "" ]; then
 	shift 2
       else
         echo "-d requires an argument"
         exit 1
       fi
       ;;
+    -a | --debugger-args)
+      moz_debugger_args=$2;
+      if [ "${moz_debugger_args}" != "" ]; then
+	shift 2
+      else
+        echo "-a requires an argument"
+        exit 1
+      fi
+      ;;
     *)
       break;
       ;;
   esac
 done
 #
 ##
 ## Program name given in $1
@@ -358,16 +375,17 @@ then
   echo "     LIBRARY_PATH=$LIBRARY_PATH"
   echo "       SHLIB_PATH=$SHLIB_PATH"
   echo "          LIBPATH=$LIBPATH"
   echo "       ADDON_PATH=$ADDON_PATH"
   echo "      MOZ_PROGRAM=$MOZ_PROGRAM"
   echo "      MOZ_TOOLKIT=$MOZ_TOOLKIT"
   echo "        moz_debug=$moz_debug"
   echo "     moz_debugger=$moz_debugger"
+  echo "moz_debugger_args=$moz_debugger_args"
 fi
 #
 export MOZILLA_FIVE_HOME LD_LIBRARY_PATH
 export SHLIB_PATH LIBPATH LIBRARY_PATH ADDON_PATH DYLD_LIBRARY_PATH
 
 if [ $moz_debug -eq 1 ]
 then
 	moz_debug_program ${1+"$@"}