Skip to content

Instantly share code, notes, and snippets.

@victorchee
Created May 31, 2019 01:44
Show Gist options
  • Save victorchee/799c30dfb3a91d09780840ba27d46bd3 to your computer and use it in GitHub Desktop.
Save victorchee/799c30dfb3a91d09780840ba27d46bd3 to your computer and use it in GitHub Desktop.
Find hot patch in Xcode project.
#!/bin/sh
echo "请输入需要检测的工程路径"
read path
if [ ${#path} = 0 ]
then
echo "请在.sh文件后面添加路径"
exit
fi
cd $path
echo "当前路径为`pwd`"
#搜索目录下面的.a文件
for i in `find . -name *.a`; do
# echo $i
i_=${i##*/}
# echo $i_
i_=${i_%.a}
# echo $i_
nm -n $i >> "$i_.txt"
grep 'dlopen' "$i_.txt" >/dev/null 2>&1 || grep 'dlsym' "$i_.txt" >/dev/null 2>&1
if [[ $? == 0 ]]; then
echo "$i_ 中有dlopen dlsym"
fi
rm $i_.txt
done
#搜索目录下面的framework
for i in `find *.framework/ */*.framework/ -size +100k`; do
# echo $i
i_=${i##*/}
# echo $i_
nm -n $i >> "$i_.txt"
grep 'dlopen' "$i_.txt" >/dev/null 2>&1 || grep 'dlsym' "$i_.txt" >/dev/null 2>&1
if [[ $? == 0 ]]; then
echo "$i_ 中有dlopen dlsym"
fi
rm $i_.txt
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment