How to generate gcc debug symbol outside the build target?
来源:互联网 发布:数据江湖txt精校版 编辑:程序博客网 时间:2024/05/16 00:44
You need to use objcopy to separate the debug information:
objcopy --only-keep-debug "${tostripfile}" "${debugdir}/${debugfile}"strip --strip-debug --strip-unneeded "${tostripfile}"objcopy --add-gnu-debuglink="${debugdir}/${debugfile}" "${tostripfile}"
I use the bash script below to separate the debug information into files with a .debug extension in a .debug directory. This way I can tar the libraries and executables in one tar file and the .debug directories in another. If I want to add the debug info later on I simply extract the debug tar file and voila I have symbolic debug information.
This is the bash script:
#!/bin/bashscriptdir=`dirname ${0}`scriptdir=`(cd ${scriptdir}; pwd)`scriptname=`basename ${0}`set -efunction errorexit(){ errorcode=${1} shift echo $@ exit ${errorcode}}function usage(){ echo "USAGE ${scriptname} <tostrip>"}tostripdir=`dirname "$1"`tostripfile=`basename "$1"`if [ -z ${tostripfile} ] ; then usage errorexit 0 "tostrip must be specified"ficd "${tostripdir}"debugdir=.debugdebugfile="${tostripfile}.debug"if [ ! -d "${debugdir}" ] ; then echo "creating dir ${tostripdir}/${debugdir}" mkdir -p "${debugdir}"fiecho "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}"
- How to generate gcc debug symbol outside the build target?
- How to generate gcc debug symbol outside the build target?
- How to generate DLL files by GCC in the MinGW?
- how to debug the gpu on you target
- How to Enable Trace or Debug for APIs executed as SQL Script Outside of the Applications ?
- How to build the GCC-4.3.3 in MinGW?
- How to generate monkeyrunner build-in help?
- How to generate the meta information
- how to generate the javadoc,java sources
- How to build the webkitgtk
- How to debug the exception
- How to debug the SFX
- [MSDN] How to Debug a Release Build
- How to: Debug a Release Build
- [Monkeyrunner]How to generate monkeyrunner build-in help?
- How to compile a kernel module outside the kernel
- How to generate an AR debug log file
- How to generate an AP debug log file
- EJB是基于哪些技术实现的?并说出SessionBean和EntityBean的区别,StatefulBean和StatelessBean的区别。
- 转:C/C++获取当前系统毫秒时间
- android中Handler与Runnable配合实现指定功能模块的定时循环地执行
- rqnoj-305
- jsp页面输出的内容被截断
- How to generate gcc debug symbol outside the build target?
- java之美之常见的几种排序算法 插入 选择 冒泡 快排 堆排
- LIBGDX版NEHE OPENGL- 8. Blend & 加载模型和帖图
- 容灾 RTO和RPO
- 构造螺旋矩阵
- maxnumber
- Android中的HttpsURLConnection连接
- hadoop运维系列笔记之FlumeNG往Hadoop写数据超时
- C/C++中的__FILE__, __LINE__,#line