Inject DebugLog() Function Call
Available since ASV 2015/06.25

Inject DebugLog() Function Call dialog lets you inject a specific function call to an AS3 method at the exact point you specify.

The function call injected is com.buraks.ASVDebugLog.DebugLog(). This function lets you trace values of primitive data types and qualified class names of objects. You select which variables to trace at run-time, by passing to this function, then the trace itself can be performed within the Flash authoring tool or in a browser.

To open Inject DebugLog() Function Call dialog. first select a script in Actionscripts tab of an AS3 SWF window. Then select a method from the 'Script Information' tree:

Run Inject DebugLog() Function command, either from Actionscript menu or context menu of the method item. (If this command is disabled for any method, it means the method does not have a 'body', which happens with interface or native methods).




Click Close to close the dialog without doing any changes (injection) to the method.

Actions
P-code (bytecode/disassembly) is shown at the top, decompiled actionscript (high level AS3) is shown at the bottom. You will notice both contain action index values (start with @ prefix).

Click on a line that starts with an action index to get the value to Injection Index edit field.

Double click a line in decompiled actionscript that starts with an action index to scroll the p-code to that index (or make the coressponding code visible).

Click Maximize Actions >> (ALT+S) or << Restore Actions (ALT+S) to maximize or restore actions panel. This button also works while previewing the injection.

Injection Index
This is the action index that injection will be made. Index values are shown with @ prefix in actions panel. Valid range is displayed beside the text field.

The function call will be inserted at the specified index, existing actions will be pushed down. You can click on actions to get an index into the edit box when there is an index at the start of the action line and when not previewing the injection.

Debug ID
Debug ID, the first argument to the DebugLog() function, is an arbitrary integer you can use to identify the origin of the function call.

Variables to pass
Variables that are accessible in this method are listed here, grouped by scope. Checked variables will be passed to the DebugLog() function in an object (associative array) as the second (and final) argument.

Often, you would want to trace local variables (arguments and local registers). If the method uses activation/slots, these local variables will have names. The special item 'Stack top item' is useful for tracing stack, however care should be taken since it does not check for stack underflow.

An injected function call to DebugLog() will look like similar to the following:
	ASVDebugLog.DebugLog(100, {
                "_local_1":_local_1,
                "_local_2":_local_2
	    });


Click Preview to see injected DebugLog() function call in actions panel. Preview button will be replaced with two buttons:

Click Reject to go back to original actions, if you find the preview to be not as you intended.

Click Accept&Close to make the injection and close the the dialog. Only one injection per dialog can be done. If you need to inject more than one call to a method, you can repeat the injection process on the same method.

If you make an injection, ASV will also inject the com.buraks.ASVDebugLog class when you save the SWF.
  • You can see/get the source of the class by opening the saved SWF file with ASV.
  • If you need specific or custom capability, you can replace this class with a custom one, using AS3 Class Replacer add-on tool which is included with ASV.
When saving an injected SWF, ASV will optionally save a sample HTML file to trace the values passed to the DebugLog() funtion.

To trace the values and see debug output in Flash authoring application, just open the SWF file with Flash.


Online URL for this page is http://www.buraks.com/asv/help/en/index.html?p=1200.html