Debugging thrown exceptions can be tricky, because the backtrace at the point where an exception is caught often provides little information on where the exception was thrown. To get around this, you simply run K-3D in the debugger, and set a “catchpoint” (a kind of specialized breakpoint) that will stop execution whenever any exception is thrown. See the gdb documentation at http://sourceware.org/gdb/current/onlinedocs/gdb/Set-Catchpoints.html#Set-Catchpoints for details.