All Packages  This Package  Class Hierarchy  Class Search  Index

Class edu.utah.janos.nodeos.Debug
java.lang.Object
   |
   +----edu.utah.janos.nodeos.Debug

  Summary

public final class  Debug
     extends java.lang.Object
{
          // Constructors 1
     public Debug();

          // Methods 31
     public static void assertCheck(boolean, String, String, int);
     public static void assertCheck(Object, String, String, int);
     private static void assertFailure(String, String, int);
     public static void checkLocked(Object, String, String, int);
     public static InternalError dPanic(String);
     public static String dbgPacketSummary(byte[], int, int);
     public static String dbgPacketSummary(byte[], int, int, int);
     public static String dbgPacketSummary(Buffer, int);
     public static String dbgPacketSummary(Buffer, int, int);
     public static String dbgPacketSummary(Buffer, int, int, int);
     public static String dbgPacketSummary(BufferHandle);
     public static String dbgPacketSummary(BufferHandle, int);
     public static String dbgPacketSummary(UdpBuffer);
     public static void dumpStats();
     public static void exit();
     public static InternalError fatalException(Throwable, String);
     public static void notImplemented();
     public static InternalError notImplemented(String);
     private static native boolean objLocked(Object);
     public static void otsan();
     public static void otsan(String);
     public static void pTrace(String, int, String);
     public static void print(String);
     public static native void printCharArray(char[], int, int);
     public static native void printIPCOps(byte);
     public static void printInt(int);
     public static native void printIntHex(int);
     private static void printLocation(String, int);
     public static void printStackTrace();
     public static void println(String);
     public static native void threadInfo(Thread);

}

The package-internal debugging infrastructure. XXX Currently this is public for my convenience.

To avoid dependencies on classes that are not automagically loaded into all spaces, I have to jump through several hoops to make sure that non-critical classes are not used. (In particular, I have avoided the '"string" + String' syntax to avoid implicitly referencing java/lang/StringBuffer.

The majority of routines in this file deal with printing directly to stdout/stderr through VM facilities. See the corresponding native layer for the details on where that output is directed.

There are three basic facilities provided by this class, first the assert() methods which really aren't very useful without a pre-processor pass. Second, the primitive print functions and object print functions, because we all love printf-debugging. Third, the flag-based trace primitive for dynamically adjusting the printing of various parts of the Java system.

Technically, this class should be final so that folks don't go around sub-classing to. Too bad. This is much easier. :)

Author:
Janos Ministry of Development




  Constructors

· Debug

Summary  |  Top

   public Debug() 

Default constructor



  Methods

· printLocation

Summary  |  Top
   private static void printLocation(String file, 
                                     int line) 

Print a file:line location. Used for asserts and trace macros.

Trims the filename down to just the base file name...

Parameter Description
file a file name
line a line number



· assertFailure

Summary  |  Top
   private static void assertFailure(String str, 
                                     String file, 
                                     int line) 

If an assert fails, this routine is called to print the file and line number information, along with the string representation of the failed expression, and a backtrace to the failure.

Parameter Description
str the string representation of the expression
file the name of the file in which the assert failed
line the line number on which the assert failed in file



· assertCheck

Summary  |  Top
   public static void assertCheck(boolean expr, 
                                  String exprStr, 
                                  String file, 
                                  int line) 

Check that the boolean expression is true. Calls assertFailure() if not.

Parameter Description
expr the expression to check
exprStr the string representation of the expression
file the name of the file the assert is in
line the line number of the file the assert is in

See Also: assertFailure



· assertCheck

Summary  |  Top
   public static void assertCheck(Object ref, 
                                  String exprStr, 
                                  String file, 
                                  int line) 

Check that the given object reference is non-null. Calls assertFailure() if the reference is null.

Parameter Description
expr the expression to check
exprStr the string representation of the expression
file the name of the file the assert is in
line the line number of the file the assert is in

See Also: assertFailure



· pTrace

Summary  |  Top
   public static void pTrace(String file, 
                             int line, 
                             String msg) 

Print a trace message.

Parameter Description
file the name of the file the TRACE is in
line the line number of the file the TRACE is in
msg the trace message to print



· checkLocked

Summary  |  Top
   public static void checkLocked(Object obj, 
                                  String exprStr, 
                                  String file, 
                                  int line) 

Assert that the given object is locked (synchronized).

Parameter Description
obj the object to check for lock status.



· objLocked

Summary  |  Top
   private static native boolean objLocked(Object obj) 

Test that the given object is locked.



· dumpStats

Summary  |  Top
   public static void dumpStats() 

Dump various stats about the state of the system. This method is primarily called by the VM thread system when it runs out of useful threads to allocate (i.e., something is deadlocked.)



· println

Summary  |  Top
   public static void println(String str) 

A native print routine that doesn't require the basic Java classes. Prints a trailing newline.

Parameter Description
str The string to print



· print

Summary  |  Top
   public static void print(String str) 

A native print routine that doesn't require the basic Java classes. Does not print a trailing newline.

Parameter Description
str The string to print



· printInt

Summary  |  Top
   public static void printInt(int i) 

A native print routine that doesn't require the basic Java classes. Prints the given integer as a string (in base 10).

Parameter Description
i the integer to print



· printIntHex

Summary  |  Top
   public static native void printIntHex(int i) 

A native print routine that doesn't require the basic Java classes. Prints the given integer as a string (in hex).

Parameter Description
i the integer to print



· printIPCOps

Summary  |  Top
   public static native void printIPCOps(byte ops) 

A native print routines that doesn't require the basic Java clases. Prints the IPC stages encoded in the given byte. Doesn't print a newline.

Parameter Description
ops the IPC stages byte to print.



· printCharArray

Summary  |  Top
   public static native void printCharArray(char[] array, 
                                            int start, 
                                            int end) 

A native print routine that doesn't require the basic Java classes. Prints the given char array as a sequence of characters.

Parameter Description
array the char array to print
start the first element of the char array to print
end the last element of the char array to print



· exit

Summary  |  Top
   public static void exit() 

A direct exit. Do not pass Go; do not collect two hundred dollars. TODO: Rather dangerous to leave around.



· dbgPacketSummary

Summary  |  Top
   public static String dbgPacketSummary(BufferHandle bufh) 


· dbgPacketSummary

Summary  |  Top
   public static String dbgPacketSummary(BufferHandle bufh, 
                                         int maxDump) 


· dbgPacketSummary

Summary  |  Top
   public static String dbgPacketSummary(UdpBuffer b) 


· dbgPacketSummary

Summary  |  Top
   public static String dbgPacketSummary(Buffer b, 
                                         int len) 


· dbgPacketSummary

Summary  |  Top
   public static String dbgPacketSummary(Buffer b, 
                                         int offset, 
                                         int len) 


· dbgPacketSummary

Summary  |  Top
   public static String dbgPacketSummary(Buffer b, 
                                         int offset, 
                                         int len, 
                                         int maxDump) 


· dbgPacketSummary

Summary  |  Top
   public static String dbgPacketSummary(byte[] b, 
                                         int offset, 
                                         int len) 


· dbgPacketSummary

Summary  |  Top
   public static String dbgPacketSummary(byte[] b, 
                                         int offset, 
                                         int len, 
                                         int maxDump) 


· threadInfo

Summary  |  Top
   public static native void threadInfo(Thread th) 

A native routine to print pertinent information about the given thread.

Parameter Description
th a Thread object to print information about.



· printStackTrace

Summary  |  Top
   public static void printStackTrace() 

Print the stack trace to the current point of execution in the current thread.



· fatalException

Summary  |  Top
   public static InternalError fatalException(Throwable t, 
                                              String msg) 


· otsan

Summary  |  Top
   public static void otsan() 

Off-the-straight-and-narrow. Sort of a tacky "panic()". Prints "Off the straight and narrow!" and kills the VM.

See Also: otsan



· otsan

Summary  |  Top
   public static void otsan(String str) 

Off-the-straight-and-narrow. Prints the provided string and kills the VM. Also prints a stack trace of the current thread.

Parameter Description
str the string to print before dying.



· notImplemented

Summary  |  Top
   public static void notImplemented() 

A generic not-implemented print-and-die function. Prints a stack trace before dying.



· notImplemented

Summary  |  Top
   public static InternalError notImplemented(String expl) 

A less generic not-implemented print-and-die fucntion. Prints the provided string and a backtrace before killing the VM.

Parameter Description
expl the explaination for this rude behavior.



· dPanic

Summary  |  Top
   public static InternalError dPanic(String str) 

A generic panic() function. Prints the provided string, a backtrace, and then kills the VM.

Whee! This returns an InternalError so that the caller might throw the result giving the compiler the impression that dPanic() will never return. Hehehe.

Parameter Description
str The panic message to use as an excuse for killing the machine.



All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7