Program Terminated By Signal Bus Object Specific Hardware Error
Contents |
von GoogleAnmeldenAusgeblendete FelderNach Gruppen oder Nachrichten suchen
of these signals are indications that your program is seriously broken in some way, and there’s usually no way to continue the computation
Sigill Signal
which encountered the error. Some programs handle program error signals in how to debug bus error order to tidy up before terminating; for example, programs that turn off echoing of terminal input should
Sigfpe Error
handle program error signals in order to turn echoing back on. The handler should end by specifying the default action for the signal that happened and then reraising it; https://groups.google.com/d/topic/comp.unix.solaris/ugGItkA82iw this will cause the program to terminate with that signal, as if it had not had a handler. (See Termination in Handler.) Termination is the sensible ultimate outcome from a program error in most programs. However, programming systems such as Lisp that can load compiled user programs might need to keep executing even if a user program http://www.gnu.org/s/libc/manual/html_node/Program-Error-Signals.html incurs an error. These programs have handlers which use longjmp to return control to the command level. The default action for all of these signals is to cause the process to terminate. If you block or ignore these signals or establish handlers for them that return normally, your program will probably break horribly when such signals happen, unless they are generated by raise or kill instead of a real error. When one of these program error signals terminates a process, it also writes a core dump file which records the state of the process at the time of termination. The core dump file is named core and is written in whichever directory is current in the process at the time. (On GNU/Hurd systems, you can specify the file name for core dumps with the environment variable COREFILE.) The purpose of core dump files is so that you can examine them with a debugger to investigate what caused the error. Macro: int SIGFPE The SIGFPE signal reports a fatal arithmet
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack http://stackoverflow.com/questions/838540/bus-error-vs-segmentation-fault Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Bus error vs Segmentation fault up vote 25 down vote favorite 8 Difference between a bus error and a segmentation fault? Can it happen that a program gives a seg fault and stops for the first time and for the second time it may give a bus error bus error and exit ? c share|improve this question edited May 2 '12 at 12:04 casperOne 58.2k10127202 asked May 8 '09 at 6:56 Thunderboltz 6253915 add a comment| 6 Answers 6 active oldest votes up vote 34 down vote accepted On most architectures I've used, the distinction is that: a SEGV is caused when you access memory you're not meant to (e.g., outside of your address space). a SIGBUS is caused due to alignment issues with the CPU (e.g., trying to read a long from an program terminated by address which isn't a multiple of 4). share|improve this answer answered May 8 '09 at 7:06 paxdiablo 492k1189731422 10 Memory mapped files can also generate SIGBUS. –bk1e May 8 '09 at 16:06 on arm SIGBUS can occur if you read a float from an address that is not 4 byte aligned –shoosh Mar 30 at 7:29 shoosh, I'm pretty certain that's covered by my second bullet point. –paxdiablo Mar 30 at 13:28 add a comment| up vote 11 down vote SIGBUS will also be raised if you mmap() a file and attempt to access part of the mapped buffer that extends past the end of the file, as well as for error conditions such as out of space. If you register a signal handler using sigaction() and you set SA_SIGINFO, it may be possible to have your program examine the faulting memory address and handle only memory mapped file errors. share|improve this answer answered May 8 '09 at 16:04 bk1e 18k43760 add a comment| up vote 5 down vote For instance, a bus error might be caused when your program tries to do something that the hardware bus doesn't support. On SPARCs, for instance, trying to read a multi-byte value (such as an int, 32-bits) from an odd address generated a bus error. Segmentation faults happen for instance when you do an access that violate the segmentation rules, i.e. trying to read or write memory that you don't own. share|improve this answer answered May 8 '09 at 7:04 unwind 255k39332460