|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnachos.Debug
public class Debug
This class contains debugging methods for generating user-selectable debugging printout and for placing assertions in the code that terminate execution and print debugging messages when they fail. The user can select which debugging printout will be generated by the command line argument (-d) passed to Nachos. See the comments in this class for a list of the pre-defined debugging flags. You are also encouraged to add your own debugging flags.
Nested Class Summary | |
---|---|
static class |
Debug.AssertException
Exception used to terminate Nachos when an assertion fails. |
Field Summary | |
---|---|
private static java.lang.String |
enableFlags
List of debugging flags for which printing is enabled. |
Constructor Summary | |
---|---|
Debug()
|
Method Summary | |
---|---|
static void |
ASSERT(boolean condition)
Equivalent of the C++ Nachos ASSERT macro. |
static void |
ASSERT(boolean condition,
java.lang.String msg)
An optional form of ASSERT which allows us to print our own message. |
static void |
init(java.lang.String[] args)
Process command-line arguments and initialize the list of debugging flags for which printing is enabled. |
static boolean |
isEnabled(char flag)
Query whether printing is enabled for a specified debugging flag. |
private static void |
kprintn(long l,
int base)
Print an integer value in a specified base. |
static void |
print(char flag,
java.lang.String text)
Print a debugging message if a specified flag is enabled. |
static void |
printf(char flag,
java.lang.String format,
java.lang.Object o1)
Convenience version of printf for printing one object. |
static void |
printf(char flag,
java.lang.String format,
java.lang.Object[] o)
A C-style printing function that uses a format string to control the printing of an array of objects. |
static void |
printf(char flag,
java.lang.String format,
java.lang.Object o1,
java.lang.Object o2)
Convenience version of printf for printing two objects. |
static void |
printf(char flag,
java.lang.String format,
java.lang.Object o1,
java.lang.Object o2,
java.lang.Object o3)
Convenience version of printf for printing three objects. |
static void |
printf(char flag,
java.lang.String format,
java.lang.Object o1,
java.lang.Object o2,
java.lang.Object o3,
java.lang.Object o4)
Convenience version of printf for printing four objects. |
static void |
println(char flag,
java.lang.String text)
Print a debugging message, followed by a newline, if a specified flag is enabled. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static java.lang.String enableFlags
Constructor Detail |
---|
public Debug()
Method Detail |
---|
public static void ASSERT(boolean condition)
condition
- If false, the assertion fails and an exception
is thrown.public static void ASSERT(boolean condition, java.lang.String msg)
condition
- If false, the assertion fails and an exception
is thrown.msg
- The message to be printed in case of failure.public static void init(java.lang.String[] args)
args
- Command-line arguments.public static boolean isEnabled(char flag)
flag
- The flag to be queried.
public static void print(char flag, java.lang.String text)
flag
- The flag.text
- The message.public static void println(char flag, java.lang.String text)
flag
- The flag.text
- The message.public static void printf(char flag, java.lang.String format, java.lang.Object o1)
public static void printf(char flag, java.lang.String format, java.lang.Object o1, java.lang.Object o2)
public static void printf(char flag, java.lang.String format, java.lang.Object o1, java.lang.Object o2, java.lang.Object o3)
public static void printf(char flag, java.lang.String format, java.lang.Object o1, java.lang.Object o2, java.lang.Object o3, java.lang.Object o4)
public static void printf(char flag, java.lang.String format, java.lang.Object[] o)
flag
- If true, then do the printing, otherwise don't.format
- C-style format string.o
- Array of objects to be printed.private static void kprintn(long l, int base)
l
- The value to print.base
- The base in which to print the value.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |