zoukankan      html  css  js  c++  java
  • 简单搭建内核调试环境--N 附录[完善第二个文件系统]

    跳转到目录 点这里 

    pacman -Fl objdump
    pacman -Fy objdump
    pacman -Ql objdump
    yay -S objdump
    yaourt -S objdump
    sudo pacman objdump
    objdump -x xxx.so | grep NEEDED
    objdump -x gdb | grep NEEDED

    根据 objdump 命令查找本地可执行文件依赖库,复制到其它目录

    [hun-hh data]# cat bin.list 
    /usr/bin/gdb
    /usr/bin/gdbserver
    /usr/bin/make
    /usr/bin/gcc
    ---------------
    [hun-hh data]# cat find_so.sh 
    findobjdump_tree()
    {
         rm -rf so.list
         rm -rf so.over
         cat $1 > so.list
         while (($((`cat so.list | wc -l`))!=0))
         do
          cat so.list |sort -k 2n|uniq |while read so
          do  
                objdump -x $so | grep NEEDED |awk '{print $2}'|xargs -i grep {} so.txt >>so.list
                echo $so |sed 's/^.*[/]//g'|xargs -i sed -i "/{}/d" so.list
                echo $so >> so.over
          done  
         done  
         rm -rf so.list
         cat so.over
         rm -rf mk_alldir
         rm -rf cp_allfile
         cat so.over |xargs -i echo mkdir -p /kernel-debug/data/mylib{} |sed 's/[/][^/]*$//g' >> mk_alldir
         cat so.over |xargs -i echo cp -daf {} /kernel-debug/data/mylib{} |sed 's/[/][^/]*$//g' >> cp_allfile
         cat mk_alldir|sort -k 2n|uniq | sh
         cat cp_allfile|sort -k 2n|uniq | sh
         rm -rf mk_alldir
         rm -rf cp_allfile
         rm -rf so.over
    }
    findobjdump_tree $1
    ------
    [hun-hh data]# cat install.sh 
    rm -rf ./mylib
    alias cp='cp'
    find /lib/* /lib64/* /usr/* > /kernel-debug/data/so.txt 
    find /lib/* /lib64/* /usr/* -type d > all_lib
    cat bin.list | sed 's/^.*///g'|xargs -i grep {} all_lib > other_dir
    sh find_so.sh bin.list
    rm -rf cat mk_other_dir
    rm -rf cat cp_other_dir
    cat other_dir   |xargs -i echo  mkdir -p /kernel-debug/data/mylib{} |sed 's/[/][][/][^/]*$//g' >> mk_other_dir
    cat other_dir   |xargs -i echo  cp -daf {} /kernel-debug/data/mylib{} |sed 's/[/][^/]*$//g' >> cp_other_dir
    cat mk_other_dir|sort -k 2n|uniq|sh
    cat cp_other_dir|sort -k 2n|uniq|sh
    rm -rf cat mk_other_dir
    rm -rf cat cp_other_dir
    rm ./all_lib
    rm ./other_dir
    rm ./so.txt
    du -sh ./mylib
    -------------------
  • 相关阅读:
    代码间距的由来和解决方法
    径向渐变
    倒计时原理
    javascript原型模式理解
    倒计时原理和折叠收缩
    highcharts注意事项
    jsp注释前台不可见
    启动Tomcat任何程序都报错
    面试题
    eclipse不自动弹出提示(alt+/快捷键失效)
  • 原文地址:https://www.cnblogs.com/heling/p/14160872.html
Copyright © 2011-2022 走看看