Debugging OpenLaszlo SWF runtime applications and the Laszlo Foundation Classes (LFC) with Flash Builder

六月ゝ 毕业季﹏ 提交于 2019-12-07 23:40:14

问题


I just learned how to profile OpenLaszlo applications using Flash Builder. The approach mentioned in that discussion means that an OpenLaszlo application is compiled into an SWF file with the debug option enabled for the Flex compiler. The generated SWF file can then be profiled using Flash Builder.

It would be much more powerful if we could use the full power of the Flash Builder debugger to debug an OpenLaszlo SWF11 runtime application. I'm specifically looking for a way to

  1. be able to set breakpoints in the generated ActionScript 3 code of my application (the cross-compiled LZX code), and step through the code.
  2. The ability to step through methods of the Laszlo Foundation Classes, especially the SWF runtime kernel.

Since the error messages delivered by the OpenLaszlo compiler are not always that helpful, for a developer with ActionScript 3 knowledge it would be much more effective to be able to step through the ActionScript code directly, inspecting objects and vars in Flash Builder.

To achieve these goals it would be necessary to

  1. Have a way to generated the ActionScript 3 code out of the my application LZX code.
  2. Have access to the generated ActionScript 3 code which is used to compile the LFC SWC library file $LPS_HOME/lps/includes/lfc/LFC11.swc. The ActionScript code must be generated as part of the OpenLaszlo Subversion build process. Unfortunately I don't understand the build process well enough to see where and how the source code for the LFC is generated.

Has anyone been able to debug and step through both the ActionScript3 code of the application, and the LFC classes?


回答1:


I have created a project on Github containing an Ant build script and the required files to profile and debug an OpenLaszlo application with Flash Builder 4.6 on either Windows or Mac.

Here is a screenshot of an OpenLaszlo application running in the profiler:

The project files contain a PDF with a detailed tutorial showing how to debug and profile OpenLaszlo SWF11 runtime applications, including the SWF11 LFC classes. Here is the link to the document titled "Profiling OpenLaszlo Applications with Flash Builder".




回答2:


It is possible to do both. It is relatively easy to retrieve the generated ActionScript3 source code of your OpenLaszlo application. When the OpenLaszlo compiler compiles the LZX code, the generated ActionScript 3 code of the application is written to the Java temp folder.

The same is true when the SWF runtime LFC classes are compiled into SWC files. The OpenLaszlo source code (when doing the Subversion build) contains a shell script which is used to compile the SWC files. If you have checked out the code, the build script can be found in

$LPS_HOME/WEB-INF/lps/lfc/

For the flex4.6 branch, if you execute the command

cd $LPS_HOME/WEB-INF/lps/lfc/; ./buildlfc --runtime=swf11

you will find the generated ActionScript classes in your Java or system temp folder, e.g.

/tmp/lzswf9/lzgen6382925936717905460/

on my Linux system. If you empty the /tmp/lzswf9 folder before running the shell script, you should only see one subfolder, beginning with the letters lzgen* in that folder, containing all the ActionScript classes which are compiled into the SWC file.

This whole operation is relatively complex, I've created a JIRA long ago and suggested that the OpenLaszlo server should be shipped for the ActionScript3 source code for the LFC/kernel SWC library files: http://jira.openlaszlo.org/jira/browse/LPP-9424

Unfortunately that was never implemented.



来源:https://stackoverflow.com/questions/11984083/debugging-openlaszlo-swf-runtime-applications-and-the-laszlo-foundation-classes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!