通过查看符号表中是否带有调试信息

1
2
[I] wallace@centos:/m/s/W/p/B/p/B/t/m/lib64_debug-true (dev)> nm --debug-syms libmysqlclient.so|grep "\.debug_info"
0000000000000000 N .debug_info

通过file

not stripped => Debug
stripped => Release

动态库

1
2
[I] wallace@centos:/m/s/W/p/B/p/B/t/m/lib64_debug (dev)> file libmysqlclient.so
libmysqlclient.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0xdb01cca2e0dba437512a3066296c995de3e2db72, not stripped

静态库

1
2
3
4
[I] wallace@centos:/m/s/W/p/B/p/B/t/m/lib64_debug (dev)> ar t libmysqlclient.a client.c.o
[I] wallace@centos:/m/s/W/p/B/p/B/t/m/lib64_debug (dev)> ar x libmysqlclient.a client.c.o
[I] wallace@centos:/m/s/W/p/B/p/B/t/m/lib64_debug (dev)> file client.c.o
client.c.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped

参考

  1. http://unix.stackexchange.com/questions/2969/what-are-stripped-and-not-stripped-executables-in-unix

留言