首页 > 其他分享 >find function symbol from .a and .so in a directory

find function symbol from .a and .so in a directory

时间:2024-03-14 15:56:25浏览次数:32  
标签:function symbol file directory fi find

I have posted a method to find class symbol from a directory in the previous article. Today i got a question in finding function sysbol. So the fellow script code was created to solve the question.

#!/bin/bash

dotMaxCnt=200
function processLine()
{
	if (( $dotCnt < $dotMaxCnt ));then
		echo -n .
		((dotCnt++))
	else
		cleanLine
	fi
}
function cleanLine()
{
	for((i=0; i<$dotMaxCnt;i++));do
		echo -ne "\b\b\b"
	done
	for((i=0; i<$dotMaxCnt;i++));do
		echo -ne " "
	done
	for((i=0; i<$dotMaxCnt;i++));do
		echo -ne "\b\b\b"
	done

	dotCnt=0

}

function doDir()
{
	findLen=${#2}
	for file in "$1"/*
	do
		if [ -f "$file" ]
		then
			if [[ "$file" =~ .+\.a$ || "$file" =~ .+\.(so)$  ]]
			then
				stringsOutput=( $(strings -n $findLen "$file" | grep $2 ) )
				firstFind=0
				dotCnt=0
				for stringsLine in "${stringsOutput[@]}"
				do
					grepOutput=$(echo $stringsLine | grep $2) 
					if [[ ${grepOutput} != "" ]]
					then

						if [[ $firstFind == 0 ]]
						then
							cleanLine
							echo $file $oFile
							firstFind=1
						fi

						cleanLine
						echo "    ---->" "$grepOutput"

					else
						processLine
					fi
				done
			fi

		elif [ -d "$file" ]
		then
#if "$file" != "." and "$file" != ".."
#			then
				doDir $file $2
#			fi

		fi
	done
}

doDir $1 $2

  

标签:function,symbol,file,directory,fi,find
From: https://www.cnblogs.com/tju1895/p/18073039

相关文章

  • typescript Decorators TypeError: Function expected
    需要启用experimentalDecorators 要启用对装饰器的实验性支持,您必须在命令行或tsconfig.json中启用ExperimentalDecorators编译器选项:commandLine:tsc--targetES5--experimentalDecorators 这个文档说的很有问题,说是要“实验性支持”,而实际上,自ts5之后,启用这个选项实......
  • [计算理论] 1. 图灵机、递归函数与丘奇-图灵论题 Turing Machine, Recursive Function
    图灵机在研究一种自动机时,我们有两种视角语法学(Syntax),描述一个自动机是什么,如分析自动机的组成、结构。语义学(Semantics),描述一个自动机做什么,如分析自动机的语言。换句话说,前者是自动机的视角,后者是形式语言的视角。图灵机的语法图灵机的原始描述如下:一台含......
  • [转]Golang Functional Options Pattern
     原文: https://golang.cafe/blog/golang-functional-options-pattern.html-------------------- GolangFunctionalOptionsPatternTheGo(Golang)FunctionaOptionsPatternisaway,apatternofstructuringyourstructsinGobydesigningaveryexpressivea......
  • 4-3nn.functional和nn.Module
    importtorchimporttorchkerasprint("torch.__version__="+torch.__version__)print("torchkeras.__version__="+torchkeras.__version__)"""torch.__version__=2.1.1+cu118torchkeras.__version__=3.9.4"""1......
  • Bad magic number for central directory
    Badmagicnumberforcentraldirectory运行代码输出如下bug:File"/home/a/Prediction/Predict_Models.py",line153,insave_resultsexisting_df=pd.read_excel(output_file_path)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/home/a......
  • 关于Flask中View function mapping is overwriting an existing endpoint function
    关于Flask中Viewfunctionmappingisoverwritinganexistingendpointfunction首次编辑:24/3/10/11:03最后编辑:24/3/10/11:57引子背景本来是在写个人网站,以前的代码中,几乎每个视图函数都有类似于:@app.route("/")defindex(): try: returnsend_file("index.html") e......
  • Android mount: bad /etc/fstab: No such file or directory
    没有root权限的原因,需要su切换到root用户https://github.com/termux/termux-packages/issues/7256 I/OerrorRMX1901CN:/#mount/dev/block/by-name/abl/mnt/mntablmount:'/dev/block/by-name/abl'->'/mnt/mntabl':I/Oerrorablxbl都会出现I/Oerror,不知道什么原因......
  • linux脚本:/bin/bash^M: bad interpreter: No such file or directory(/bin/sh^M).sh: no
    origin如图,运行一个脚本文件报错: 原因:在执行shell脚本时提示这样的错误主要是由于shell脚本文件是dos格式,即每一行结尾以\r\n来标识,而unix格式的文件行尾则以\n来标识解决方法,用dos2unixfilename命令,,直接把文件转换为unix格式 其他解决方法:(1)使用linux命令dos2unixfi......
  • lua5.1 - function env
    注意:只在lua5.1才支持,后面的lua版本做了改动不再兼容 myEnv.lualocalmyEnv={}myEnv.a=1myEnv.b="one"myEnv.log=printreturnmyEnv Test.lualocalmyEnv=require("myEnv")setfenv(1,myEnv)--调用上面的函数后,print将没法使用因为那是在全局env......
  • What does -> mean in Python function definitions?
    Whatdoes->meaninPythonfunctiondefinitions?InPython,the"->"symbolisusedtoindicatethereturntypeofafunction.ItispartofthefunctiondefinitioninaPython3.5orlater.Forexample,thefollowingcodedefinesafunct......