Timeline for How does a Segmentation Fault work under-the-hood?
Current License: CC BY-SA 3.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 26, 2016 at 14:07 | comment | added | user732 |
@BradenBest - I did the same thing, my code is sloppier than your code. I got no message at all, and my even crappier shell doesn't print a thing. I used waitpid() on each fork/exec, and it returns a different value for processes that have a segmentation fault, than processes that exit with 0 status.
|
|
| Jan 26, 2016 at 4:12 | comment | added | Braden Best |
I was just discussing this with Dietrich Epp. I hacked together a version of crsh that uses execvp and did the test again to find that while the shell still doesn't crash (meaning SIGSEGV is never sent to the shell), it does not print "Segmentation Fault". Nothing is printed at all. This seems to indicate that the shell detects when its child processes get killed and is responsible for printing "Segmentation fault" (or some variant thereof).
|
|
| Jan 25, 2016 at 21:36 | history | edited | user732 | CC BY-SA 3.0 |
Change a qualified sentence to an absolute: I wrote crsh of my own using execve()
|
| Jan 25, 2016 at 20:59 | history | answered | user732 | CC BY-SA 3.0 |