Differences between version 6 and revision by previous author of CommonProgrammingBugs.
Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History
Newer page: | version 6 | Last edited on Tuesday, September 2, 2003 1:30:23 am | by AristotlePagaltzis | Revert |
Older page: | version 5 | Last edited on Saturday, August 23, 2003 6:03:58 pm | by StuartYeates | Revert |
@@ -1,8 +1,8 @@
!!!My program causes a "[Segmentation Fault|SIGSEGV]" in malloc(3) or new
It's common for a program to cause a "Segmentation Fault" in new or malloc(3) if you have previously corrupted memory by using a pointer incorrectly.
-To diagnose this problem, compile everything with "
-g"
(and probably "
[-Wall]"
as well) and link it all with electric fence ("
-lefence"
).
+To diagnose this problem, compile everything with __
-g__
(and probably [-Wall] as well) and link it all with electric fence (__
-lefence__
).
eg:
[gcc|gcc(1)] -g [-Wall] broken.cc -o broken.o
gcc -lefence broken.o -o broken
@@ -32,6 +32,6 @@
* [mcheck] (part of libc6-dev)
* [MALLOC_CHECK_] environment variable
* [LD_DEBUG] environment variable
* printf(3)
-* catchsegv (prints the backtrace of a program that segfaults) - don't forget to compile with "
-g"
if you want file names and line numbers
-* <add a
neat tool
you know of here>
+* catchsegv (prints the backtrace of a program that segfaults) - don't forget to compile with __
-g__
if you want file names and line numbers
+* AddToMe: any other
neat tools
you know of?