欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

linux系统oops panic 奔溃问题调查objdump工具使用demo脚本

程序员文章站 2022-07-01 23:25:33
...

 

用法:

./objdump-function.sh vmlinux symbol

symbol指定要找的函数名

vmlinux=$1 
symbol=$2 

#source /opt/poky/1.6.1/environment-setup-cortexa15hf-vfp-neon-poky-linux-gnueabi

if [ -z "$vmlinux" ]; then 
    echo "usage : $0 vmlinux symbol"
    exit 
fi 
 
startaddress=$(nm -n $vmlinux | grep "\w\s$symbol" | awk '{print "0x"$1;exit}') 
endaddress=$(nm -n $vmlinux | grep -A1 "\w\s$symbol" | awk '{getline; print "0x"$1;exit}') 
  
if [ -z "$symbol" ]; then 
    echo "dump all symbol"
    /opt/gcc-linaro-7.1.1-2017.08-i686_aarch64-linux-gnu/bin/aarch64-linux-gnu-objdump -d $vmlinux 
else 
    echo "start-address: $startaddress, end-address: $endaddress" 
    /opt/gcc-linaro-7.1.1-2017.08-i686_aarch64-linux-gnu/bin/aarch64-linux-gnu-objdump -d $vmlinux --start-address=$startaddress --stop-address=$endaddress > $symbol.h
fi