#!/bin/bash # 用法提示 if [ $# -lt 2 ]; then echo "用法: $0 <搜索目录> <函数名>" echo "例如: $0 /vendor/qua/lib FH_SYS_VmmAllocEx64" exit 1 fi SEARCH_DIR="$1" FUNC_NAME="$2" echo "在目录 $SEARCH_DIR 中查找包含函数 $FUNC_NAME 的 .so 文件..." # 遍历所有 .so 文件 find "$SEARCH_DIR" -type f -name "*.so" | while read sofile; do # 使用 nm 检查是否定义了目标函数 if nm -D --defined-only "$sofile" 2>/dev/null | grep -q "$FUNC_NAME"; then echo "✅ 找到函数 $FUNC_NAME 在: $sofile" fi done