Search code examples
c++nachos

What does the DEBUG statement do?


I am studying nachos for a university project and can't understand what the DEBUG(...) statement in the below code is doing.

void
ThreadTest1()
{
   DEBUG('t', "Entering ThreadTest1");
   Thread *t = new Thread("forked thread");
   t->Fork(SimpleThread, 1);
   SimpleThread(0);
}

Can someone please help ?


Solution

  • DEBUG is a conditional print statement that is activated when you run your code with "-d" option, as in $nachos -d ti. There are a few debug flags, for example "t" enables printing (debugging) of thread events, which you think you're after by your code snippet.