Created
June 2, 2012 15:16
-
-
Save code2k/2858794 to your computer and use it in GitHub Desktop.
Print dependency graph for libcamera.so
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
def get_dependencies(library, indent) | |
if !library.match(/^\w.*\.so$/) || library.match(/^libstdc\+\+.so$/) || | |
library.match(/^libc.so$/) || library.match(/^libdl.so$/) || indent == 4 | |
return | |
end | |
for i in 0..indent-1 | |
print(" ") | |
end | |
puts library | |
`greadelf -d #{library}`.each_line do |line| | |
if match = /^.*NEEDED.*\[(?<slib>.*.so)\]/.match(line) | |
get_dependencies(match['slib'], indent+1) | |
end | |
end | |
return | |
end | |
get_dependencies("libcamera.so", 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment