Modified source engine (2017) developed by valve and leaked in 2020. Not for commercial purporses
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

#!/bin/bash
OBJCOPY=objcopy
function usage {
echo "$0 /path/to/input/file [-o /path/to/output/file ]"
echo ""
}
if [ $# == 0 ]; then
usage
exit 2
fi
if [ $(basename $1) == $1 ]; then
INFILEDIR=$PWD
else
INFILEDIR=$(cd ${1%/*} && echo $PWD)
fi
INFILE=$(basename $1)
OUTFILEDIR=$INFILEDIR
OUTFILE=$INFILE.dbg
while getopts "o:" opt; do
case $opt in
o)
OUTFILEDIR=$(cd ${OPTARG%/*} && echo $PWD)
OUTFILE=$(basename $OPTARG)
;;
esac
done
if [ "$OUTFILEDIR" != "$INFILEDIR" ]; then
INFILE=${INFILEDIR}/${INFILE}
OUTFILE=${OUTFILEDIR}/${OUTFILE}
fi
pushd "$INFILEDIR"
$OBJCOPY "$INFILE" "$OUTFILE"
$OBJCOPY --add-gnu-debuglink="$OUTFILE" "$INFILE"
popd