My project is developed in C and call functions written in CPP. With the following option: OPTS = -g I can debug only my C programs. How to allow gdb debugger to step into the CPP programs.
Best,
CodePudding user response:
Here you find the options of compiler :
# Different options to CPUH and CPUL builds
# Other apsects of tool chain set here
# These should be made available appropriately to the builds
ifeq ($(MACHINE),BIT64)
ifeq ($(COVERAGE),1)
CC =gcc -m64 --coverage
else
CC =gcc -m64
endif
CC_STRIP =strip --strip-all
CC_LINKER =gcc -m64
CCPP =g -m64
CCPP_LINKER =g -m64
else
CC =gcc -m32
CC_STRIP =strip --strip-all
CC_LINKER =gcc -m32
CCPP =g -m32
CCPP_LINKER =g -m32
endif
#Allow debugging or not
#add option DEBUG=1 for project debug
ifeq ($(DEBUG),1)
OPTS = -g
endif
# End allow debugging
CC1= $(CC)
CCPP1= $(CCPP)
CodePudding user response:
With GCC and Clang compilers both C flags and C flags are separate, I suspect your -g is only being passed to the c files and not the cpp files. Ensure you set both CFLAGS
and CXXFLAGS
with -g. See here for a example https://stackoverflow.com/a/23407800/2729443