I'm struggling with the right command to do the following:
find all shared libraries (*.so) that contain a certain symbol.
This is what I've tried:
find -iname '*.so*' -exec nm {} \; | grep -H _ZN6QDebugD1Ev
The above gives some output with symbols found, but doesn't pinpoint the filename that the symbol occurred in. Any flag that I give to grep to tell it to print a filename is lost because grep is being fed from stdin.
(standard input): U _ZN6QDebugD1Ev
(standard input): U _ZN6QDebugD1Ev
(standard input): U _ZN6QDebugD1Ev
(standard input): U _ZN6QDebugD1Ev
(standard input):0015e928 T _ZN6QDebugD1Ev
(standard input): U _ZN6QDebugD1Ev
(standard input): U _ZN6QDebugD1Ev
(standard input): U _ZN6QDebugD1Ev
Another attempt:
find -iname '*.so*' -exec nm {} \; -exec grep _ZN6QDebugD1Ev {} \;
This doesn't work because the two execs are completely independent.
What should I do?
Pass the "-A" option to nm which will prefix its output with the filename. Then just grep for the symbol you're interested in, for example:
find -iname '*.so*' -exec nm -A {} \; | grep _ZN6QDebugD1Ev
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With