Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A stack overflow is a segmentation fault. As in you've broken the given bounds of memory that the you were initially allocated. The stack of of finite size, and you have exceeded it. You can read more about it at <a href="http://en.wikipedia.org/wiki/Segmentation_fault" rel="noreferrer">wikipedia</a></p> <p>Additionally, one thing I've done for projects in the past is write my own signal handler to segfault (look at man page signal (2)). I usually caught the signal and wrote out "Fatal error has occured" to the console. I did some further stuff with checkpoint flags, and debugging. </p> <p>In order to debug segfaults you can run a program in GDB. For example, the following C program will segfault: #segfault.c #include #include </p> <pre><code>int main() { printf("Starting\n"); void *foo=malloc(1000); memcpy(foo, 0, 100); //this line will segfault exit(0); } </code></pre> <p>If I compile it like so:</p> <pre><code>gcc -g -o segfault segfault.c </code></pre> <p>and then run it like so:</p> <pre><code>$ gdb ./segfault GNU gdb 6.7.1 Copyright (C) 2007 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt; This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"... Using host libthread_db library "/lib/libthread_db.so.1". (gdb) run Starting program: /tmp/segfault Starting Program received signal SIGSEGV, Segmentation fault. 0x4ea43cbc in memcpy () from /lib/libc.so.6 (gdb) bt #0 0x4ea43cbc in memcpy () from /lib/libc.so.6 #1 0x080484cb in main () at segfault.c:8 (gdb) </code></pre> <p>I find out from GDB that there was a segmentation fault on line 8. Of course there are more complex ways of handling stack overflows and other memory errors, but this will suffice.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload