1. 程式人生 > >linux 中的除錯符號檔案

linux 中的除錯符號檔案

安裝軟體的時候,經常會發現有一些 -dbg 的包,比如 iceweasel-dbg,軟體包資訊中指出這個包中包含了 iceweasel 的除錯符號資訊。那麼除錯符號資訊是如何生成的呢,生成的除錯符號資訊又如何使用呢?

看了 strip 的 manual,發現有這樣一個功能:

--only-keep-debug    removing contents of any sections that would not be stripped by --strip-debug  and  leaving  the debugging sections intact.

正是生成 debug symbol 的方法,manual 裡面詳細介紹瞭如何製作 debug symbol 檔案,並且將 stripped 的可執行檔案和 debug 檔案關聯起來的辦法。

1.<Link the executable as normal.  Assuming that is is called>
"foo" then...

2.<Run "objcopy --only-keep-debug foo foo.dbg" to>
create a file containing the debugging info.

3.<Run "objcopy --strip-debug foo" to create a>
stripped executable.

4.<Run "objcopy --add-gnu-debuglink=foo.dbg foo">
to add a link to the debugging info into the stripped executable.
閱讀(232) | 評論(0) | 轉發(0) | 給主人留下些什麼吧!~~ 評論熱議