Skip to content

Instantly share code, notes, and snippets.

@pasko
Created March 7, 2017 13:37
Show Gist options
  • Save pasko/820f4d6e16304c4485aa552634c2cf2d to your computer and use it in GitHub Desktop.
Save pasko/820f4d6e16304c4485aa552634c2cf2d to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Outputs to stdout a CSV with one line per function in libchrome.so.
# Should run in <10 seconds.
BINARY=gn_android/ReleaseOfficial/lib.unstripped/libchrome.so
TOOLCHAIN_PREFIX=third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi
echo 'size_in_bytes,demangled_function_name'
"$TOOLCHAIN_PREFIX-nm" --print-size --size-sort --reverse-sort "$BINARY" | \
grep " t " | perl -p -e 'my @s = split(" ", $_); $_ = hex($s[1]) . ",$s[3]\n";' | \
"$TOOLCHAIN_PREFIX-c++filt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment