I have a library with debug symbols, and I do the following to extract function names:
$ objdump -S -D library_name.so > library_name.asm
$ grep -rn ">:" library_name.asm
This gives me what I want:
3101:0000000000002190 <memset@plt>:
3106:00000000000021a0 <close@plt>:
but seems a bit awkward ... Is there a better way to achieve this?
I think the utility you're looking for is nm
:
It collects all the symbols, both static and dynamic, defined in a library or any ELF file. The output looks like this:
000000ec T main
000003f0 a REG_HID0
000003f1 a REG_HID1
00000ec4 T RSA_bigint_add
000009e0 T RSA_bigint_clear
00000a0c T RSA_bigint_cmp
00000dd8 T RSA_bigint_gen
00000aa4 T RSA_bigint_get_bitlength
000010f4 T RSA_bigint_intmul
00000c20 T RSA_bigint_lshift
00001330 T RSA_bigint_mod
00001470 T RSA_bigint_modexp
0000142c T RSA_bigint_modmul
0000120c T RSA_bigint_mul
00000aec T RSA_bigint_rshift
00001024 T RSA_bigint_sub
00000238 T RSA_check_data_with_certificate
00000180 T RSA_check_signature
000002d0 T RSA_x509_get_field
000003a4 T RSA_x509_get_int
000008f8 T RSA_x509_parse_certificate
0000042c T RSA_x509_parse_PKI
000007d8 T RSA_x509_parse_signature
0000057c T RSA_x509_parse_tbscertificate