sendbug
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 dbx, a source level symbolic debugger. C programmers can also use codecenter, also known as saber. To learn about dbx or codecenter, you can read the manual pages by using the man command, as in:
man dbxIf 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.
add saber; man codecenter
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:
limit coredumpsize 100to limit your core dump size to 100K for your current login. Be very 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/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 directory.
unlimit coredumpsize