Создать
Код: Выделить всё
main.cppКод: Выделить всё
int main() {
int a = 1;
int b = 2;
int c = a + b;
int d = c % b;
int e = c + d;
return e;
}
Код: Выделить всё
clang++ -g -O0 main.cpp
Код: Выделить всё
dsymutil -s a.out
Код: Выделить всё
----------------------------------------------------------------------
Symbol table for: 'a.out' (arm64)
----------------------------------------------------------------------
Index n_strx n_type n_sect n_desc n_value
======== -------- ------------------ ------ ------ ----------------
[ 0] 00000001 64 (N_SO ) 01 0000 0000000000000000
[ 1] 0000001c 64 (N_SO ) 00 0000 0000000000000000 '/Users//tmp/'
[ 2] 0000002f 64 (N_SO ) 00 0000 0000000000000000 'main.cpp'
[ 3] 00000038 66 (N_OSO ) 00 0001 0000000065ef7009 '/private/var/folders/75/7ln8mr3j3md23mts9rq7jmcw0000gn/T/main-bf85b7.o'
[ 4] 00000001 2e (N_BNSYM ) 01 0000 0000000100003f4c
[ 5] 00000016 24 (N_FUN ) 01 0000 0000000100003f4c '_main'
[ 6] 00000001 24 (N_FUN ) 00 0000 000000000000005c
[ 7] 00000001 4e (N_ENSYM ) 01 0000 0000000100003f4c
[ 8] 00000001 64 (N_SO ) 01 0000 0000000000000000
[ 9] 00000002 0f ( SECT EXT) 01 0010 0000000100000000 '__mh_execute_header'
[ 10] 00000016 0f ( SECT EXT) 01 0000 0000000100003f4c '_main'
Thought about these:
- Maybe the variables are optimized away because the logic in the code is too simple. - But I gave flag which means no optimization.
Код: Выделить всё
-O0 - Maybe the symbol table is never meant to have variable names. - Searched online and it seems variable names is expected to be in symbol tables.
Источник: https://stackoverflow.com/questions/781 ... iable-name