[Gloucs] make gcc switch

Adam Langley gloucs at mailman.lug.org.uk
Sun Nov 24 16:15:01 2002


On Sun, Nov 24, 2002 at 02:25:46PM +0000, Guy Edwards wrote:
> But how do I apply that to a larger project that uses ./configure and
> make?

export CFLAGS="-pedantic ..."

is worth a shot, as is editing the generated Makefile and searching for
a line starting "CFLAGS = " and editing that.

> Also would anyone on Tuesday be able to run through simple tools for
> checking your code with and a rough overview of how they work (eg
> electricfence checks for memory problems I believe?)

Put "-lefence" as the first argument to ld/gcc, when linking your
program and run it in gdb. Any overruns will cause SIGSEGV during the
memory write.

After that you can run with $EF_PROTECT_FREE=1 to cause a segv when
writing to free()ed areas of memory and $EF_PROTECT_BELOW=1 to catch
underruns (but not overruns).

Just be warned that it uses up huge amounts of memory and the core files
can be hundreds of megs if you don't run it in gdb.


-- 
Adam Langley                                      agl@imperialviolet.org
http://www.imperialviolet.org                       (+44) (0)7986 296753
PGP: 9113   256A   CC0F   71A6   4C84   5087   CDA5   52DF   2CB6   3D60