Categories Displayed in Flash

Flash: SOS Max, the best Flash trace() output debugger on the planet

PowerFlasher has released a new verison of the best trace output debugger on the planet (IMO). Called SOS Max. Though the new version was released just a month ago, and it's not even Halloween, It's feels just like Christmas to me!

Here's why SOS rocks.

  • It's cross plaform, written in Java.
  • It's fast, small...kinda like Flash
  • It's can use RegExp to search through the logs.
  • It can talk birectionally to the content, and react.
  • It can read the trace logs of the debug player...even when compiling normally in Flash
  • It has colorizing and folding of messages.

Here's my favorite reason. Normally when using Flash you have to compile in order to see the trace output. But sometimes debugging it's trying different things, and you don't really need to recompile, just retest different things. Often in more complicated projects, compiling, with all the fonts and assets takes a long time.  With Flash's trace output, you can't see it unless you compile again. With SOS setup to view the trace log ...you can.

Since it's socket based, it can help with a swf running from anywhere. But for using the socket debugger you need help.

There are a few AS libaries to make SOS more friendly.   This FDT post covers one of them.

The troyworks framework has an TraceAdapter which I prefer and use. It's pretty easy to use, in fact it's injectable and can be turned back to the normal trace with a single commenting of a line.

A test case which shows all the features it supports is here

What it does is introspect the string passed to the trace to look for certain fields. One of my favorite is the ability for SOS to color highlight lines.

  1.  
  2.       public function traceOutputTests():void{
  3.                 trace("number " + 1);
  4.                 trace("string" +  new String("HelloWorld"));
  5.                 trace("error " +  "error message"); //won't work
  6.                 trace("ERROR " +  "error message2"); //will work
  7.                 trace("WARNING " +  "warning message");
  8.                 trace("INFO " +  "info message");
  9.                 trace("HIGHLIGHT " +  "highlight message");
  10.                 trace("\\\\\\\\\\\\\\\\ " +  "start section message");
  11.                                 var _ary : Array = ["A","B","C","D"];
  12.                 trace("array1 " + _ary);
  13.                 trace("array2 " + util.Trace.me(_ary, "Array2", true)); //shows code folding
  14.                 trace("////////////////// " +  "end section message");
  15.                
  16.         }
  17.  

Getting setup with SOS is pretty easy, just download and start it up (if you have java installed), but to get it to work with the normal trace() output you may have to follow these instructions primarily getting the flash debugger installed and coordinating where the debug log is created.

Using TraceAdapter with SOS
Past that you have to override the trace function. You can do it at a class level like

  1.  
  2. public var trace:Function = TraceAdapter.SOSTracer;
  3.  

Then to set it back do

  1.  
  2. public var trace:Function = TraceAdapter.NormalTracer;
  3.  

or

  1.  
  2. //public var trace:Function = TraceAdapter.SOSTracer;
  3.  

I prefer setting it once early on like

  1.  
  2. TraceAdapter.CurrentTracer = TraceAdapter.SOSTracer;
  3.  

And then have other classes use that reference, which centralizes configuration, during initiailzation. (Though will not update all references a 2nd time)

  1.  
  2. public var trace:Function = TraceAdapter.SOSTracer;
  3.  

The only thing I've found using it, is that it does seem (along with Eclipse) to need lots of RAM and CPU. Periodically I assume to memory leaks or fragmentation in garbage collection I find I have to cose down both SOS and Eclipse. Also if I'm not doing lots of debugging I find that SOS consumes significant CPU when it's idling, waiting for connections, so I shut it down.

2 responses to 'Flash: SOS Max, the best Flash trace() output debugger on the planet'

[...] SOS is a Java based Debugger that is much faster than the one built into Flash CS3, it offers regexp for filtering, searching, line coloring, collapsing. It’s fast, and it’s XMLSocket based so can be used pretty much anywhere. It has some neat features that allow you to create menus that issue commands, so your app can ‘talk’ to the SOS, creating menu items to callback to run different tests. Here’s a long post covering how to use it. [...]

[...] in to an interesting, where the trace utility SOS Max stopped working. For a bit I thought it was something about setting up Flash 10 debug version. It [...]

Add a Comment: