home *** CD-ROM | disk | FTP | other *** search
/ IRIS Development Option 6.2 / IRIS_Development_Option_6.2_814-0478-001.iso / dist / gl_dev.idb / usr / sbin / gldebug.z / gldebug
Text File  |  1996-03-14  |  4KB  |  125 lines

  1. #!/bin/sh
  2. #
  3. #**************************************************************************
  4. #*                                                                        *
  5. #*               Copyright (C) 1990,1991 Silicon Graphics, Inc.           *
  6. #*                                                                        *
  7. #*  These coded instructions, statements, and computer programs  contain  *
  8. #*  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
  9. #*  are protected by Federal copyright law.  They  may  not be disclosed  *
  10. #*  to  third  parties  or copied or duplicated in any form, in whole or  *
  11. #*  in part, without the prior written consent of Silicon Graphics, Inc.  *
  12. #*                                                                        *
  13. #**************************************************************************
  14. #
  15. #
  16. #    gldebug - runs a program with the gldebug shared library
  17. #
  18. #    Author: David Mott,Dave Immel
  19. #
  20. #
  21.  
  22. usage()
  23. {
  24.     echo "  gldebug [-hwefcsFCO][-p wait][-i filename][-o filename] application [app-options]"
  25.     echo " "
  26.     echo "        -h         : no history output"
  27.     echo "        -w         : no warning output"
  28.     echo "        -e         : no error output"
  29.     echo "        -f         : no fatal error output"
  30.     echo "        -c         : don't run controller"
  31.     echo "        -s         : don't run state view"
  32.     echo "        -F         : flush output buffer to history after each gl call"
  33.     echo "        -C         : generate C code"
  34.     echo "        -p wait    : profile (output # times each gl func is called)"
  35.     echo "              wait is # of GL calls wait between each profile write to disk"
  36.     echo "        -i filename : ignore debugging the routines listed in filename"
  37.     echo "        -o filename : output history to filename"
  38.     echo "        -O        : output history to stdout (this overrides the -o filename)"
  39.     echo " "
  40.     echo "  note that application options come at the end of the command line"
  41. }
  42.  
  43. # if there are no remaining arguments, output the usage message
  44. if test $# = 0
  45. then
  46.     usage
  47.     exit 1
  48. fi
  49.  
  50.  
  51. # these are all exported below!
  52. # if you add one, make sure it gets exported!
  53. GLDEBUG_NOHISTORY=FALSE
  54. GLDEBUG_NOWARNING=FALSE
  55. GLDEBUG_NOERROR=FALSE
  56. GLDEBUG_NOFATAL=FALSE
  57. GLDEBUG_NOCONTROLLER=FALSE
  58. GLDEBUG_NOSTATEVIEW=FALSE
  59. GLDEBUG_FLUSHEVERYTHING=FALSE
  60. GLDEBUG_IGNOREFILE=""
  61. GLDEBUG_GENERATE_C=FALSE
  62. GLDEBUG_PROFILETIME=""
  63. GLDEBUG_OUTPUTFILE="GLdebug.history"
  64. GLDEUBG_USESTDOUT=FALSE
  65. GLDEBUG_PCS=FALSE
  66.  
  67. #
  68. # -d is an undocumented way for 4Dbug to work with gldebug
  69.  
  70. while getopts hwefcsFCdp:xi:o:O c
  71. do
  72.     case $c in
  73.     h)    GLDEBUG_NOHISTORY=TRUE;;
  74.     w)    GLDEBUG_NOWARNING=TRUE;;
  75.     e)    GLDEBUG_NOERROR=TRUE;;
  76.     f)    GLDEBUG_NOFATAL=TRUE;;
  77.     c)    GLDEBUG_NOCONTROLLER=TRUE;;
  78.     s)    GLDEBUG_NOSTATEVIEW=TRUE;;
  79.     F)    GLDEBUG_FLUSHEVERYTHING=TRUE;;
  80.     C)    GLDEBUG_GENERATE_C=TRUE;;
  81.     d)    GLDEBUG_PCS=TRUE;;
  82.     p)    GLDEBUG_PROFILETIME=$OPTARG;;
  83.     i)    GLDEBUG_IGNOREFILE=$OPTARG;;
  84.     o)    GLDEBUG_OUTPUTFILE=$OPTARG;;
  85.     O)    GLDEBUG_USESTDOUT=TRUE;;
  86.     esac
  87. done
  88.  
  89. shift `expr $OPTIND - 1`
  90.  
  91. #
  92. # convert to debug version
  93. #
  94. appname=$1
  95. fullpath=`which $appname` >/dev/null
  96. file $fullpath | grep "MIPSEB COFF" >/dev/null
  97. if [ $? = "0" ]
  98. then
  99.     echo "Error: The file \""$fullpath"\" is an IRIX 4.x executable (COFF)."
  100.     echo "Error: IRIX 5.x gldebug no longer supports IRIX 4.x executables."
  101.     echo "Error: See the gldebug(1) man page, NOTES section, for more information."
  102.     exit 255
  103. fi
  104.  
  105. shift 1
  106.  
  107. # export all the command line arguments to gldebug
  108. export GLDEBUG_NOHISTORY GLDEBUG_NOWARNING GLDEBUG_NOERROR GLDEBUG_NOFATAL
  109. export GLDEBUG_NOCONTROLLER GLDEBUG_NOSTATEVIEW
  110. export GLDEBUG_FLUSHEVERYTHING GLDEBUG_IGNOREFILE GLDEBUG_GENERATE_C
  111. export GLDEBUG_PROFILETIME GLDEBUG_OUTPUTFILE GLDEBUG_USESTDOUT GLDEBUG_PCS
  112.  
  113. old_RLD_LIST=$_RLD_LIST
  114. _RLD_LIST="DEFAULT:/usr/lib/libgd.so:/usr/lib/libgl.so:$old_RLD_LIST"
  115. export _RLD_LIST
  116.  
  117. $appname $*
  118.  
  119. _RLD_LIST=$old_RLD_LIST
  120. export _RLD_LIST
  121.  
  122. exit 0
  123.  
  124.  
  125.