1 #!/usr/bin/bash
   2 #
   3 # We need to run ctfconvert on all the .o files in qemu. However, some of these
   4 # .o files contain some snippets that are going to cause ctfconvert to fail. If
   5 # ctfconvert is run with the -i option, it will delete the .o file. This is bad.
   6 # Instead we end up using a temporary file and move over it. 
   7 #
   8 # This file gets invoked from inside the x86-64_softmmu directory, hence the
   9 # extra .. in the path below. That's kind of ugly, and I almost apologize.
  10 #
  11 
  12 sh_arg0=$(basename $0)
  13 ctf_bin=$(pwd)/../../../illumos/usr/src/tools/proto/root_i386-nd/opt/onbld/bin/i386/ctfconvert
  14 
  15 function fail
  16 {
  17         local msg="$*"
  18         [[ -z "$msg" ]] && msg="failed"
  19         echo "$sh_arg0: $msg" >&2
  20         exit 1
  21 }
  22 
  23 
  24 [[ $# -eq 1 ]] || fail "missing arguments"
  25 
  26 echo "Converting $1"
  27 $ctf_bin -L VERSION -o $1.ctf $1
  28 [[ $? -ne 0 ]] && exit 1
  29 mv $1.ctf $1
  30 exit 0