Is it possible for GDB to recognize preprocessor characters?

I have many, many C #define preprocessors that simplify C programming. However, when debugging with GDB, preprocessor "tags" are not taken into account in the character list.

Is there a way to recognize GDB tags #define d?

+6
source share
2 answers

You can try compiling with g3 as described here .

 gcc -gdwarf-2 -g3 

We pass the -gdwarf-2 and -g3 flags to make sure that the compiler includes information about the preprocessor macros in the debug information.

Or you can try -ggdb .

+9
source

#define characters are usually not included as part of debugging information. const variables (or built-in functions for macros like functions ) are usually a better idea for many reasons than this (e.g. type of security, multiple evaluations, etc.). I recommend using them in favor of preprocessor characters whenever you can.

+3
source

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


All Articles