Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2186992
  • 博文数量: 230
  • 博客积分: 9346
  • 博客等级: 中将
  • 技术积分: 3418
  • 用 户 组: 普通用户
  • 注册时间: 2006-01-26 01:58
文章分类

全部博文(230)

文章存档

2015年(30)

2014年(7)

2013年(12)

2012年(2)

2011年(3)

2010年(42)

2009年(9)

2008年(15)

2007年(74)

2006年(36)

分类: LINUX

2010-06-19 23:39:36

#!/bin/bash

scriptdir
=`dirname ${0}`
scriptdir
=`(cd ${scriptdir}; pwd)`
scriptname
=`basename ${0}`

set -e

function errorexit()
{
  errorcode
=${1}
  shift
  echo $@
 
exit ${errorcode}
}

function usage()
{
  echo
"USAGE ${scriptname} "
}

tostripdir
=`dirname "$1"`
tostripfile
=`basename "$1"`


if [ -z ${tostripfile} ] ; then
  usage
  errorexit
0 "tostrip must be specified"
fi

cd
"${tostripdir}"

debugdir
=.debug
debugfile
="${tostripfile}.debug"

if [ ! -d "${debugdir}" ] ; then
  echo
"creating dir ${tostripdir}/${debugdir}"
  mkdir
-p "${debugdir}"
fi
echo
"stripping ${tostripfile}, putting debug info into ${debugfile}"
objcopy
--only-keep-debug "${tostripfile}" "${debugdir}/${debugfile}"
strip
--strip-debug --strip-unneeded "${tostripfile}"
objcopy
--add-gnu-debuglink="${debugdir}/${debugfile}" "${tostripfile}"
chmod
-x "${debugdir}/${debugfile}"

相关连接:
http://blogs.sun.com/dbx/entry/creating_separate_debug_info

阅读(1401) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~