Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find function from lib .so files?

I can print list of exported function of one *.so file like

nm -C lib/libopencv_ml.so

and then find my function like

nm -C lib/libopencv_ml.so | grep myfunction

but when I want to find function from all .so files how to determine which .so contain my function?

This just print all entries of function but I need to know from which .so file it appear.

nm -C lib/*.so | grep cvSetZero

Seems -H option also not helped. -H, --with-filename print the file name for each match

nm -C lib/*.so | grep -Hn cvSetZero

Generate output like:

(standard input):98:                 U cvSetZero
(standard input):796:                 U cvSetZero
(standard input):2564:00000000000b2540 T cvSetZero
(standard input):8673:                 U cvSetZero
(standard input):12233:                 U cvSetZero
(standard input):15503:                 U cvSetZero
(standard input):17460:                 U cvSetZero
(standard input):18727:                 U cvSetZero
(standard input):20865:                 U cvSetZero
like image 218
mrgloom Avatar asked Aug 24 '16 08:08

mrgloom


1 Answers

I found solution

nm -C -A lib/*.so | grep cvSetZero

It produce this kind of output:

lib/libopencv_calib3d.so:                 U cvSetZero
lib/libopencv_contrib.so:                 U cvSetZero
lib/libopencv_core.so:00000000000b2540 T cvSetZero
lib/libopencv_highgui.so:                 U cvSetZero
lib/libopencv_imgproc.so:                 U cvSetZero
lib/libopencv_legacy.so:                 U cvSetZero
lib/libopencv_ml.so:                 U cvSetZero
lib/libopencv_objdetect.so:                 U cvSetZero
lib/libopencv_video.so:                 U cvSetZero
like image 89
mrgloom Avatar answered Oct 06 '22 09:10

mrgloom