[shlug] ubuntu 下关于 debug info 的打包

9 views
Skip to first unread message

Gareth

unread,
Sep 16, 2015, 12:48:07 AM9/16/15
to sh...@googlegroups.com
Hi

最近遇到了 debug info 包的结构的问题:

redhat 系下的包,主要是在 spec 文件写好了 --enable-debug=true 之类的,直接把编译好的可带 debug
信息的二进制执行文件打包。但是 ubuntu 下是分成了两个包,比如 mysql-server-5.5 和
mysql-server-5.5-dbgsym,前者的内容自然是可执行的二进制文件,后者是
/usr/lib/debug/.build-id/xx/xxxx.debug 的二进制文件。

对后者感到很不理解,我只要把对应的 *-dbgsym 包装好后(xxxx.debug放到对应位置),原来的 /usr/sbin/mysqld
进程就有 debug info 的能力了?

我遇到的实际问题是把该装好的包都装好了,那些严格对应的 xxxx.debug 也都在,但是 mysqld 还是找不到任何 markers...

有人在 ubuntu 系统上折腾过 *-dbgsym 这些包么?

--
Gareth

Cloud Computing, OpenStack, Distributed Storage, Fitness, Basketball
OpenStack contributor, kun_huang@freenode
My promise: if you find any spelling or grammar mistakes in my email
from Mar 1 2013, notify me
and I'll donate $1 or ¥1 to an open organization you specify.

DaboD

unread,
Sep 17, 2015, 4:08:32 AM9/17/15
to Shanghai Linux User Group
這是我先前準備的小例子, 怎麼將 debug information 抽出, 然後再重新關聯上

/* test.c */
#include <stdlib.h>

int main()
{
    abort();

    return 0;
}

# Makefile
CFLAGS := -ggdb3
OBJCOPY := objcopy
STRIP := strip

test: test.o
        $(CC) -o $@ $< $(CFLAGS)
        $(OBJCOPY) --only-keep-debug $@ $@.debug
        $(STRIP) --strip-debug --strip-unneeded $@
        $(OBJCOPY) --add-gnu-debuglink=$@.debug $@

test.o: test.c

.PHONY: clean
clean:
        rm -rf test test.o test.debug

Ray Song

unread,
Sep 17, 2015, 5:38:21 AM9/17/15
to Shanghai Linux User Group
补充一下

文档参考 info '(gdb) Separate Debug Files'
>--
>-- You received this message because you are subscribed to the Google Groups
>Shanghai Linux User Group group. To post to this group, send email to
>sh...@googlegroups.com. To unsubscribe from this group, send email to
>shlug+un...@googlegroups.com. For more options, visit this group at
>https://groups.google.com/d/forum/shlug?hl=zh-CN
>---
>您收到此邮件是因为您订阅了Google网上论坛上的“Shanghai Linux User Group”群组。
>要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到
>shlug+un...@googlegroups.com
>要查看更多选项,请访问https://groups.google.com/d/optout


--
Ray
http://maskray.me

Gareth

unread,
Sep 17, 2015, 5:53:17 AM9/17/15
to sh...@googlegroups.com
感谢二位,明白些了已经 :)
> --- 您收到此邮件是因为您订阅了 Google 网上论坛的“Shanghai Linux User Group”群组。
>
> 要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到shlug+un...@googlegroups.com
> 要查看更多选项,请访问 https://groups.google.com/d/optout



Reply all
Reply to author
Forward
0 new messages