如何在linux中使用objdump和bash函数在共享对象文件中找到函数?

时间:2022-04-20 04:29:03

I've got a folder in linux, which is contained several shared object files (*.so). How I can find function in shared object files using objdump and bash functions in linux?

我在linux中有一个文件夹,其中包含几个共享对象文件(* .so)。如何在linux中使用objdump和bash函数在共享对象文件中找到函数?

For instance, the following example is found me function func1 in mylib.so:

例如,以下示例在mylib.so中找到函数func1:

objdump -d mylib.so | grep func1

But i want to find func1 in folder which is contained shared object files. I don't know bash language and how to combinate linux terminal commands.

但我想在文件夹中找到包含共享对象文件的func1。我不知道bash语言以及如何组合linux终端命令。

2 个解决方案

#1


24  

nm is simpler than objdump, for this task.
nm -A *.so | grep func should work. The -A flag tells nm to print the file name.

对于此任务,nm比objdump更简单。 nm -A * .so | grep func应该工作。 -A标志告诉nm打印文件名。

#2


2  

You can use also use,

你也可以用,

find <path> -name "*.so" -exec nm {} \; | grep func1

#1


24  

nm is simpler than objdump, for this task.
nm -A *.so | grep func should work. The -A flag tells nm to print the file name.

对于此任务,nm比objdump更简单。 nm -A * .so | grep func应该工作。 -A标志告诉nm打印文件名。

#2


2  

You can use also use,

你也可以用,

find <path> -name "*.so" -exec nm {} \; | grep func1