I am debugging a huge c source code, and it has many macro definition. currently there is a segmentation fault is occurring at a macro. I want to be able to debug macro, step in macro definition just like as a function. I tried that
./configure debugflags="-gdwarf-2 -g3"
make
but this is not working, make is failing. without above option it compile correctly, but could not debug macro.
so, how can I debug macro? thanks in advance
You could convert the macro into a static inline
function, e.g. from
#define max(a, b) (a) > (b) ? (a) : (b)
to
static inline max(int a, int b)
{
return a > b ? a : b;
}
This lets the compiler create debugging information for the macro (now function).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With