如何在 linux 中使用 objdump 和 bash 函数在共享对象文件中找到函数?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9357930/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How I can find function in shared object files using objdump and bash functions in linux?
提问by G-71
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:
例如,以下示例是func1
在 mylib.so 中找到的 me 函数:
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 终端命令。
采纳答案by ugoren
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
打印文件名。
回答by Deepak
You can use also use,
您也可以使用,
find <path> -name "*.so" -exec nm {} \; | grep func1