Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
679 B

  1. #!/bin/bash
  2. OBJCOPY=objcopy
  3. function usage {
  4. echo "$0 /path/to/input/file [-o /path/to/output/file ]"
  5. echo ""
  6. }
  7. if [ $# == 0 ]; then
  8. usage
  9. exit 2
  10. fi
  11. if [ $(basename $1) == $1 ]; then
  12. INFILEDIR=$PWD
  13. else
  14. INFILEDIR=$(cd ${1%/*} && echo $PWD)
  15. fi
  16. INFILE=$(basename $1)
  17. OUTFILEDIR=$INFILEDIR
  18. OUTFILE=$INFILE.dbg
  19. while getopts "o:" opt; do
  20. case $opt in
  21. o)
  22. OUTFILEDIR=$(cd ${OPTARG%/*} && echo $PWD)
  23. OUTFILE=$(basename $OPTARG)
  24. ;;
  25. esac
  26. done
  27. if [ "$OUTFILEDIR" != "$INFILEDIR" ]; then
  28. INFILE=${INFILEDIR}/${INFILE}
  29. OUTFILE=${OUTFILEDIR}/${OUTFILE}
  30. fi
  31. pushd "$INFILEDIR"
  32. $OBJCOPY "$INFILE" "$OUTFILE"
  33. $OBJCOPY --add-gnu-debuglink="$OUTFILE" "$INFILE"
  34. popd