Calling the Debugger

Submitted by:Christoph Elek, Cool IBM Support Dude

Some of you may have seen the following, I am just adding a tip for the others.

You can call the debugger during the runtime with this method:

com.ibm.uvm.tools.DebugSupport.halt();

which is the same as the self.halt()of Smalltalk.

I use it at the beginning of a try...catch block and I step over and into to check what line raises my exception.

Take a look at this package, you may find interesting stuff

Note from Scott:

You probably want to call it using reflection.  Note that I haven't tested this code yet so it may contain a typo...

  try {

    Class debugSupport = Class.forName("com.ibm.uvm.tools.DebugSupport");

    Method halt = debugSupport.getMethod("halt", null);

    halt.invoke(null, null);

  }

  catch (Exception ignoreMe) {}     

This allows you to compile it and run outside of VisualAge.  If run inside VisualAge (where the uvm classes live) it will invoke the debugger.  When run outside, it will not find the class (don't export the uvm stuff...) and drop into the empty exception handler.