Access Keys:
Skip to content (Access Key - 0)

What does "Bus Error" or "Segmentation Fault" mean?

These statements mean that there's a bug in the program. If you're able to consistently reproduce this bug in a piece of supported software, please submit a bug report using the "sendbug" command.

If you're interested in learning more details and how to debug your own programs, read on.

These errors often mean that the program was trying to access a memory location outside its address space. The computer detected this problem and sent a signal to your program, which caused it to abort.

Things that cause bus errors and segmentation violations are typically out-of-bounds array references and/or references through uninitialized or mangled pointers. Look very closely in your program for bizarre things like that. A common example is:

	int c;
	scanf("%d", c);

instead of the correct version:

	int c;
	scanf("%d", &c);

There are a number of methods for finding out where the program went out of bounds. One method is to use printf() statements to determine how far the program is getting before it crashes, and to print out the contents of interesting variables. A more sophisticated method is using a debugger, such as "gdb".

If you need to debug your program, you may want to enable a core dump. Usually, those two messages above would also have "(core dumped)" by them, indicating that the program wrote an image of its current memory into a file called "core" in that directory. Athena turned this off by default, since for most people "core" is just a waste of disk space.

If you want to turn it back on again, type 'quota -v' and find out how many blocks (kilobytes) you have available in your quota. Then you can type, say:

limit coredumpsize 100

.. to limit your core dump size to 100K for your current login. BE CAREFUL not to let yourself go over quota, as you would then not be able to create or edit files. You should delete the "core" file when you don't need it any more.

To allow core dumps and still not have quota worries, you can make a symbolic link from the name core into the /tmp directory. Core dumps created this way will not take up quota, and they will automatically vanish when you log out.The dump will also occur more quickly since it doesn't have to go over the network to your directory. To set up a core link in a directory:

ln -s /tmp/core.project ./core
unlimit coredumpsize

/tmp/core.project in the first line is the name that the core file is really called; the "ln -s" command creates a symbolic link from the filename "core" in the current directory, to a file named "core.project" in the /tmp direcory.

IS&T Contributions

Documentation and information provided by IS&T staff members


Last Modified:

February 25, 2009

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
Labels:
olc-unix olc-unix Delete
error error Delete
segmentation segmentation Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Feedback
This product/service is:
Easy to use
Average
Difficult to use

This article is:
Helpful
Inaccurate
Obsolete
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki