Nota che not stripped
non implica simboli di debug.
Code Library:
//myshared.c
#include <stdio.h>
void print_from_lib()
{
printf("Printed from shared library\n");
}
Compilare con e senza flag di debug:
gcc -c -Wall -Werror -fpic myshared.c
gcc -shared -o libmyshared.so myshared.o
gcc -g -c -Wall -Werror -fpic myshared.c -o myshared-g.o
gcc -g -shared -o libmyshared-g.so myshared-g.o
Verifica con file
$ file libmyshared.so
libmyshared.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=1ad3b94d5c8a7392c2140a647254753221a152cd, not stripped
$ file libmyshared-g.so
libmyshared-g.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0268eaf97e5a670d2f7e767a011be6f06a83090a, not stripped
Entrambi sostengono che non sono spogliati. Tuttavia, solo libmyshared-g.so
mostra i simboli:
$ objdump --syms libmyshared.so | grep debug
$ objdump --syms libmyshared-g.so | grep debug
0000000000000000 l d .debug_aranges 0000000000000000 .debug_aranges
0000000000000000 l d .debug_info 0000000000000000 .debug_info
0000000000000000 l d .debug_abbrev 0000000000000000 .debug_abbrev
0000000000000000 l d .debug_line 0000000000000000 .debug_line
0000000000000000 l d .debug_str 0000000000000000 .debug_str
nome file nome file -x | grep 'debug' – starrify
possibile duplicato di [Come verificare se il programma è stato compilato con i simboli di debug?] (http://stackoverflow.com/questions/3284112/how-to-check-if-program-was-compiled-with- debug-symbols) –