All Packages  This Package  Class Hierarchy  Class Search  Index

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

  Summary

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

          // Methods 22
     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(BufferHandle);
     public static String dbgPacketSummary(BufferHandle, int);
     public static String dbgPacketSummary(BufferHandle, int, int);
     public static String dbgPacketSummary(pj_BufferHandle);
     public static String dbgPacketSummary(pj_BufferHandle, int);
     public static String dbgPacketSummary(pj_BufferHandle, int, int);
     public static void exit();
     public static InternalError fatalException(Throwable, String);
     public static InternalError notImplemented(String);
     public static void pTrace(String, int, String);
     public static void print(String);
     public static void printCharArray(char[], int, int);
     public static void printInt(int);
     public static void printIntHex(int);
     private static void printLocation(String, int);
     public static void printStackTrace();
     public static void println(String);

}

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.

This class is not final. However the only subclass Debug is final.

Author:
Janos Ministry of Development

See Also: Debug


  Cross Reference

Extended By:
Debug





  Constructors

· pj_Debug

Summary  |  Top
   public pj_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.



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



· printCharArray

Summary  |  Top
   public static 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) 

Get a string of the given Buffer.



· dbgPacketSummary

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

Get a string of maxDump bytes from the given Buffer.



· dbgPacketSummary

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

Get a string of a subsequence of the bytes in the given packet.



· dbgPacketSummary

Summary  |  Top
   public static String dbgPacketSummary(pj_BufferHandle b) 


· dbgPacketSummary

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


· dbgPacketSummary

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


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


· 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