4

libdwarf 安装使用

 3 years ago
source link: http://abcdxyzk.github.io/blog/2014/10/15/debug-libdwarf/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

libdwarf 安装使用

2014-10-15 18:16:00

下载http://www.prevanders.net/dwarf.html

依赖http://directory.fsf.org/wiki/Libelf

dwarf格式文档http://www.dwarfstd.org/Home.php

直接./configure,make就好。

./configure
make

比较新的版本要替换 optind 和 opterr ,因为会和libc.a冲突

find . -name '*.[c|h]' -exec sed -i -e 's/optind/optind_kk/g' {} \;
find . -name '*.[c|h]' -exec sed -i -e 's/opterr/opterr_kk/g' {} \;

先动态编译,为了生成libdwarf/libdwarf.a

./configure
make
rm -rf dwarfdump/dwarfdump
make CFLAGS+="-static -I`pwd`/libdwarf -I`pwd`/dwarfdump" LDFLAGS+="-static -L`pwd`/libdwarf -ldwarf -lelf"
./dwarfdump/dwarfdump -Wc -S match=dev_queue_xmit /tmp/vmlinux

获取vmlinux中dev_queue_xmit函数的.debug信息

Posted by kk

2014-10-15 18:16:00debug, dwarf

« Win7下硬盘安装Ubuntu系统 extern关键字详解 »


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK