第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何在構(gòu)建目標(biāo)之外生成gcc調(diào)試符號(hào)?

如何在構(gòu)建目標(biāo)之外生成gcc調(diào)試符號(hào)?

如何在構(gòu)建目標(biāo)之外生成gcc調(diào)試符號(hào)?我知道我可以使用-g選項(xiàng)生成調(diào)試符號(hào)。但是,符號(hào)將嵌入目標(biāo)文件中。gcc可以在結(jié)果可執(zhí)行文件/庫(kù)之外生成調(diào)試符號(hào)嗎?像Windows VC ++編譯器的.pdb文件一樣。
查看完整描述

3 回答

?
慕沐林林

TA貢獻(xiàn)2016條經(jīng)驗(yàn) 獲得超9個(gè)贊

您需要使用objcopy來分隔調(diào)試信息:

objcopy --only-keep-debug "${tostripfile}" "${debugdir}/${debugfile}"strip --strip-debug --strip-unneeded "${tostripfile}"objcopy --add-gnu-debuglink="${debugdir}/${debugfile}" "${tostripfile}"

我使用下面的bash腳本將調(diào)試信息分離為.debug目錄中帶有.debug擴(kuò)展名的文件。這樣我可以在一個(gè)tar文件和另一個(gè)tar文件中的.debug目錄中tar和庫(kù)和可執(zhí)行文件。如果我想稍后添加調(diào)試信息,我只需提取調(diào)試tar文件,瞧我有符號(hào)調(diào)試信息。

這是bash腳本:

#!/bin/bashscriptdir=`dirname ${0}`scriptdir=`(cd ${scriptdir}; pwd)`scriptname=`basename ${0}`set -e

function 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"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}"


查看完整回答
反對(duì) 回復(fù) 2019-07-31
?
慕尼黑8549860

TA貢獻(xiàn)1818條經(jīng)驗(yàn) 獲得超11個(gè)贊

查看strip命令的“--only-keep-debug”選項(xiàng)。

從鏈接:

目的是將此選項(xiàng)與--add-gnu-debuglink結(jié)合使用以創(chuàng)建兩部分可執(zhí)行文件。一個(gè)剝離的二進(jìn)制文件占用RAM和分布中較少的空間,第二個(gè)是調(diào)試信息文件,僅在需要調(diào)試功能時(shí)才需要。


查看完整回答
反對(duì) 回復(fù) 2019-07-31
  • 3 回答
  • 0 關(guān)注
  • 698 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)