Usually GCC uses dwarf as its main debugging file format, you need to enable dwarf support when building gcc with the flag --with-dwarf2.
While building your compiled object you can use -ggdb instead of -g which is a more specific solution but just for gdb.