#15 Provide a way of disabling paranoia code


There are various bits of code floating around for debugging purposes or sanity checking. Examples are: PLUS3CHECK, MEM_ACCOUNTING, MUTEX_PARANOID. At the moment, these are all enabled by default, but there should be an easy way of turning them off in one go in order to build a "production" kernel.


  • Brian Ruthven

    Brian Ruthven - 2014-01-13

    The obvious way is to tie them together with a "#ifdef DEBUG" kind of construct, whilst retaining the ability to enable one at a time. Thus, defining "DEBUG" will enable all of them during the build.

  • Brian Ruthven

    Brian Ruthven - 2015-01-08

    A new header file kernel/debug.h is provided which needs to be included in any source file which wants to provide and use a debugging #define.

    There are now three levels of debugging available:
    None: "normal" kernel, minimal sanity checking
    DEBUG: Contains assert and sanity check code
    DEBUG_VERBOSE: Contains DEBUG plus additional stuff printed to the console.

    Also fixed along the way was a stack corruption issue when turning on the debugging in proc.c: The name of the process just loaded was printed along with its load address. However, the name string was in the caller's RAM page which may have just been switched out by proc_alloc(), so we print garbage. If the garbage length is long enough, the sanity check in kprintf() panics, or the system would go on to crash.

  • Brian Ruthven

    Brian Ruthven - 2015-01-08
    • assigned_to: Brian Ruthven
    • Fixed in: --> 464:b1cc127307c5
  • Brian Ruthven

    Brian Ruthven - 2015-01-08
    • status: open --> closed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks