All Packages  This Package  Class Hierarchy  Class Search  Index

Class utah.npm.core.Debug
java.lang.Object
   |
   +----utah.npm.core.Debug

  Summary

final class  Debug
     extends java.lang.Object
{
          // Fields 3
     static final int DBG_IPC_OPS;
     static final int DBG_LOCKS;
     private static int traceFlags_;

          // Constructors 1
     public Debug();

          // Methods 19
     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 native void debugExit();
     public static void debugPanic(String);
     public static native void debugPrint(String);
     public static native void debugPrintCharArray(char[], int, int);
     public static native void debugPrintInt(int);
     public static native void debugPrintIntHex(int);
     public static native void debugPrintln(String);
     public static boolean doTrace(int);
     public static void dumpStats();
     public static void notImplemented();
     public static void notImplemented(String);
     public static void otsan();
     public static void otsan(String);
     public static void print(String);
     public static native void printStackTrace();
     public static native void threadInfo(Thread);

}

The package-internal debugging infrastructure. 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 with 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.

Version:
NPMJava 0.5.0 April, 1998
Author:
Patrick Tullmann tullmann@cs.utah.edu




  Fields

· DBG_IPC_OPS

Summary  |  Top

   static final int DBG_IPC_OPS


· DBG_LOCKS

Summary  |  Top
   static final int DBG_LOCKS


· traceFlags_

Summary  |  Top
   private static int traceFlags_


  Constructors

· Debug

Summary  |  Top

   public Debug() 

Default constructor



  Methods

· 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



· 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.)



· print

Summary  |  Top
   public static void print(String str) 

A simple print primitive goes straight to the VM and does not require any of the basic Java classes.

Parameter Description
str The string to print



· debugPrintln

Summary  |  Top
   public static native void debugPrintln(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



· debugPrint

Summary  |  Top
   public static native void debugPrint(String str) 

A native print routine that doesn't require the basic Java classes.

Parameter Description
str The string to print



· debugPrintInt

Summary  |  Top
   public static native void debugPrintInt(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



· debugPrintIntHex

Summary  |  Top
   public static native void debugPrintIntHex(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



· debugPrintCharArray

Summary  |  Top
   public static native void debugPrintCharArray(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



· debugExit

Summary  |  Top
   public static native void debugExit() 

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



· 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 native void printStackTrace() 

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



· doTrace

Summary  |  Top
   public static boolean doTrace(int flag) 

Check if flag flag is set in the trace flags.

Parameter Description
the flag (or bitwise-OR'd set of flags) to check

Returns:
true if all the specified flags are set.


· 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 void 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.



· debugPanic

Summary  |  Top
   public static void debugPanic(String str) 

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

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