Reputation: 47553
I have a library I am using (which is critical to my work) that I am suspecting may have a bug. Unfortunately, the owner of the library is not so responsive as to trying out my sample codes. I am about to try debugging it myself.
To be more honest, it's not just a library, it's a library plus a set of kernel modules and the crash happens at kernel level (pretty nasty) and indeed would be hard to spot for the owner of the code too.
Sometimes that I get lucky, I get a kernel oops, that if I could build his code with -g option, I can find which line the error occurs (which greatly help, since I have just started facing huge amounts of his code with pretty much no clue).
Now the GNUmakefiles of the project are built with automake (I believe). My question is How can I tell make
to add -g
to CFLAGS
throught the WHOLE build?
I remember reading something along the lines of how to write Makefiles so that "external" options can be added etc, but I neither know whether these makefiles would be generated with that ability (which should because it's automake), or how those external options are given anyway!
I am guessing something like this:
make CFLAGS=-g
should do it, but honestly have no idea.
Edit: Note that, I am actually interested in the -g
flag to be included when the kernel modules are being built. I cannot use try and error (for example with my command above) to see if works or not, as the kernel build just prints [CC] ...
without showing any options!
Edit: Well actually I did try, but gdb ./module.ko
still claims there are no debug symbols.
Upvotes: 3
Views: 189
Reputation: 57910
Is there a configure
script? If so, was it created by autoconf? (Probably.) Then you can do
./configure CFLAGS='-g -O0'
make clean
make
to rebuild the whole thing with debugging on and optimization off.
Otherwise, no-one can really help you unless you provide a relevant excerpt of the makefile.
Upvotes: 1