symbol.sh ~~查詢 Symbol 的好用工具
先來看一下何謂 Symbol Table (以下來源: Wiki)
In computer science, a symbol table is a data structure used by a language translator such as a compiler or interpreter, where each identifier in a program's source code is associated with information relating to its declaration or appearance in the source, such as its type, scope level and sometimes its location.
在 Linux 下,我們可以使用 nm 這個指令來列出 Object 裡面 Symbol Table 的內容。
下面這隻 Script 可以快速查出特定的 Symbol 出現在哪一個 Object 裡面
感謝原作者 parrot 大方提供。
#!/bin/bash
if [ $# == 0 ]; then
@@@@echo "Usage: $0"
@@@@echo "@@@@@ : $0 "
@@@@echo ""
@@@@exit
fi
dir=.
if [ $# == 2 ]; then
@@@@dir=$2
fi
echo "--------------------------------------------------------------------------------"
echo "Processing ..."
echo ""
list=`find $dir -regex ".*\.o" -or -regex ".*\.a" -or -regex ".*\.sa" -or -regex ".*\.so" -or -regex ".*\.ko"`
for x in $list
do
@@@@nm -A $x 2> /dev/null | grep --color -w $1
done
echo "--------------------------------------------------------------------------------"
In computer science, a symbol table is a data structure used by a language translator such as a compiler or interpreter, where each identifier in a program's source code is associated with information relating to its declaration or appearance in the source, such as its type, scope level and sometimes its location.
在 Linux 下,我們可以使用 nm 這個指令來列出 Object 裡面 Symbol Table 的內容。
下面這隻 Script 可以快速查出特定的 Symbol 出現在哪一個 Object 裡面
感謝原作者 parrot 大方提供。
#!/bin/bash
if [ $# == 0 ]; then
@@@@echo "Usage: $0
fi
dir=.
if [ $# == 2 ]; then
fi
echo "--------------------------------------------------------------------------------"
echo "Processing ..."
echo ""
list=`find $dir -regex ".*\.o" -or -regex ".*\.a" -or -regex ".*\.sa" -or -regex ".*\.so" -or -regex ".*\.ko"`
for x in $list
do
done
echo "--------------------------------------------------------------------------------"
留言
張貼留言