Why aren't debug symbols added to the output file?

I am trying to compile a project to run on an ARM board that I have. To use the debugger, I have to put the debugging symbols in the resulting .elf file.

I configured everything and ran my make file, which gave the following results:

arm-elf-gcc -x assembler-with-cpp -c -mcpu=arm7tdmi-s -g -gdwarf-2 -Wa,-amhls=src/crt.lst   src/crt.S -o src/crt.o
arm-elf-gcc -c -mcpu=arm7tdmi-s -O0 -g -gdwarf-2 -mthumb-interwork -fomit-frame-pointer -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=src/main.lst    -MD -MP -MF     .dep/main.o.d -I . -I./inc src/main.c -o src/main.o
arm-elf-gcc -c -mcpu=arm7tdmi-s -O0 -g -gdwarf-2 -mthumb-interwork -fomit-frame-pointer -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=library/md5.lst    -MD -MP -MF .dep/md5.o.d -I . -I./inc library/md5.c -o library/md5.o
arm-elf-gcc -c -mcpu=arm7tdmi-s -O0 -g -gdwarf-2 -mthumb-interwork -fomit-frame-pointer -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=library/bignum.lst    -MD -MP -MF .dep/bignum.o.d -I . -I./inc library/bignum.c -o library/bignum.o

arm-elf-gcc ./src/crt.o ./src/main.o ./library/md5.o ./library/bignum.o -mcpu=arm7tdmi-s -g -nostartfiles -T./prj/LPC2138_flash.ld -Wl,-Map=testFLASH.map,--cref,--no-warn-mismatch -nostdlib -L. -Wl,-static -ffunction-sections -Wl,--gc-sections -Wl,-s -fdata-sections  -lc -lg -lnosys -o testFLASH.elf

I put flags in -g, but when I try to find debugging characters, I only get:

C:\Users\stkerr\Code\EclipseWorkspace\LibraryWork>objdump -g testFLASH.elf

testFLASH.elf:     file format elf32-little

This is confirmed again, when I try to open the .elf file in my debugger, I get an error when the file does not have debugging symbols.

Can someone point out an error in my calls to arm-elf-gcc or a flag that I am missing?

+3
source share
1 answer

, , -Wl, -s - .

, .

+2

Source: https://habr.com/ru/post/1741485/


All Articles