• Oran Agra's avatar
    Assertion and panic, print crash log without generating SIGSEGV · 90b717e7
    Oran Agra authored
    This makes it possible to add tests that generate assertions, and run
    them with valgrind, making sure that there are no memory violations
    prior to the assertion.
    
    New config options:
    - crash-log-enabled - can be disabled for cleaner core dumps
    - crash-memcheck-enabled - useful for faster termination after a crash
    - use-exit-on-panic - to be used by the test suite so that valgrind can
      detect leaks and memory corruptions
    
    Other changes:
    - Crash log is printed even on system that dont HAVE_BACKTRACE, i.e. in
      both SIGSEGV and assert / panic
    - Assertion and panic won't print registers and code around EIP (which
      was useless), but will do fast memory test (which may still indicate
      that the assertion was due to memory corrpution)
    
    I had to reshuffle code in order to re-use it, so i extracted come code
    into function without actually doing any changes to the code:
    - logServerInfo
    - logModulesInfo
    - doFastMemoryTest (with the exception of it being conditional)
    - dumpCodeAroundEIP
    
    changes to the crash report on segfault:
    - logRegisters is called right after the stack trace (before info) done
      just in order to have more re-usable code
    - stack trace skips the first two items on the stack (the crash log and
      signal handler functions)
    90b717e7
debug.c 68.1 KB