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.
So I'm out of guesses. Also tried to search stackoverflow for similar questions, didn't see any on the first page of search results. Sorry if this is a dupe.
Создать[code]main.cpp[/code] like this: [code]int main() { int a = 1; int b = 2; int c = a + b; int d = c % b; int e = c + d; return e; } [/code] Compile it: [code]clang++ -g -O0 main.cpp [/code] Then try to see the symbol table: [code]dsymutil -s a.out [/code] Output looks like this: [code]---------------------------------------------------------------------- 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' [/code] None of the variables are in the symbol table. I wonder why. Thought about these: [list] [*]Maybe the variables are optimized away because the logic in the code is too simple. - But I gave [code]-O0[/code] flag which means no optimization. [*]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. [/list] So I'm out of guesses. Also tried to search stackoverflow for similar questions, didn't see any on the first page of search results. Sorry if this is a dupe.