[Laszlo-checkins] r10443 - in openlaszlo/trunk/WEB-INF/lps: lfc lfc/compiler lfc/data lfc/debugger lfc/events server/src/org/openlaszlo/sc

dda@openlaszlo.org dda at openlaszlo.org
Tue Jul 22 14:02:02 PDT 2008


Author: dda
Date: 2008-07-22 14:01:53 -0700 (Tue, 22 Jul 2008)
New Revision: 10443

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/build.xml
   openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzFormatter.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/debugger/LzMemory.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/events/LaszloEvents.lzs
   openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
   openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java
Log:
Change 20080721-dda-7 by dda at lester.local on 2008-07-21 13:55:52 EDT
    in /Users/dda/laszlo/src/svn/openlaszlo/trunk-a
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Enable -debug options for LFC and applications

New Features:

Bugs Fixed: LPP-6686 (create debug lfc for swf9), LPP-6687 (makes sure lzc works properly for swf 9 w/ and w/out debug)

Technical Reviewer: ptw (pending)
QA Reviewer: promanik (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
    Creates a LFC9-debug.swc during LFC build.  Uses this when
    lzc is invoked with -g or --options debug=true or
    when debug attribute used (<canvas debug="true">) or URL ...&debug=true

    Note: The -g/debug option for swf9 means that:
         a special 'debugSWF9' option is turned on internally - this
         causes -debug=true to be given to the external compiler.
         It also turns *off* the sc compiler's typical actions for
         DEBUG and DEBUG_BACKTRACE (that is, generating inline code to
         support a debugging window in the browser).  So debugging on
         SWF9 means using fdb.
    
    lfc/build.xml:
         For swf9, build debug LFC in addition to regular LFC.
         Assume no backtrace library needed for swf9.
    
    lfc/events/LaszloEvents.lzs:
         Declared _dbg_* variables, they are used conditionally
           in this class (when $debug or $profile are on).
    
    lfc/debugger/LzMemory.lzs:
          marked _dbg_name as override.
    
    lfc/data/LzDataElement.lzs:
          '_dbg_name' in a mixin exposes a problem.  If the usage of the
          mixin inherits from LzNode, then the method *must* be declared
          override in the mixin (without some extra compiler smarts).  If
          the usage does not inherit from LzNode, then the method *cannot*
          be declared as override in the mixin.  LzDataElementMixin is
          used in both ways so there is no right way to declare the
          method.  But in this situation (LzDataSet extends LzNode with
          LzDataElementMixin), _dbg_name is overridden again.  Therefore
          this method is not currently even being used.  In case it would
          be used in the future, I renamed it, any user class can override
          _dbg_name and call the renamed method.
    
    lfc/compiler/LzFormatter.lzs
          Changed call from (nonexistent method) this.functionName
          to Debug.functionName().
    
    sc/SWF9External.java
          Use LFC9-debug.swc when appropriate
    
Tests:
   0) Regression:
       smokecheck (swf8,dhtml)
       weather (swf8,dhtml,swf9,swf9)  also swf9 with debug=true
       SWF9 hello (with and without &debug=true)

   1) Small test xx.lzx illustrates lzc and debug option (-g), with fdb.  Note the
   use of -debug=true flag in the external compiler output and the use of LFC9-debug.swc.

    dda at lester$ lzc --runtime=swf9 xx.lzx
    Compiling: xx.lzx to xx.lzr=swf9.swf
    Executing compiler: (cd /tmp/lzswf9/lzgen25931; /Users/clients/laszlo/src/svn/openlaszlo/trunk-a/WEB-INF/bin/mxmlc -compiler.show-actionscript-warnings=false -compiler.source-path+=/tmp/lzswf9/lzgen25931 -output /tmp/lzswf9/lzgen25931/app.swf -default-size 500 400 -library-path+=/Users/clients/laszlo/src/svn/openlaszlo/trunk-a/lps/includes/lfc/LFC9.swc /tmp/lzswf9/lzgen25931/LzApplication.as)
    compiler output:
    Loading configuration file /Users/clients/laszlo/src/svn/openlaszlo/trunk-a/WEB-INF/frameworks/flex-config.xml
    /tmp/lzswf9/lzgen25931/app.swf (93937 bytes)
    
    Done executing compiler
    dda at lester$ lzc -g --runtime=swf9 xx.lzx
    Compiling: xx.lzx to xx.lzr=swf9.swf
    Executing compiler: (cd /tmp/lzswf9/lzgen16082; /Users/clients/laszlo/src/svn/openlaszlo/trunk-a/WEB-INF/bin/mxmlc -compiler.show-actionscript-warnings=false -compiler.source-path+=/tmp/lzswf9/lzgen16082 -debug=true -output /tmp/lzswf9/lzgen16082/app.swf -default-size 500 400 -library-path+=/Users/clients/laszlo/src/svn/openlaszlo/trunk-a/lps/includes/lfc/LFC9-debug.swc /tmp/lzswf9/lzgen16082/LzApplication.as)
    compiler output:
    Loading configuration file /Users/clients/laszlo/src/svn/openlaszlo/trunk-a/WEB-INF/frameworks/flex-config.xml
    /tmp/lzswf9/lzgen16082/app.swf (157592 bytes)
    
    Done executing compiler
    dda at lester$ fdb /tmp/lzswf9/lzgen25931/app.swf
    Adobe fdb (Flash Player Debugger) [build 3.0.0.477]
    Copyright (c) 2004-2007 Adobe, Inc. All rights reserved.
    Attempting to launch and connect to Player using URL
    /tmp/lzswf9/lzgen25931/app.swf
      (DEBUGGER HANGS while program runs)

    dda at lester$ fdb /tmp/lzswf9/lzgen16082/app.swf
    Adobe fdb (Flash Player Debugger) [build 3.0.0.477]
    Copyright (c) 2004-2007 Adobe, Inc. All rights reserved.
    Attempting to launch and connect to Player using URL
    /tmp/lzswf9/lzgen16082/app.swf
    Player connected; session starting.
    Set breakpoints and then type 'continue' to resume the session.
    [SWF] private:tmp:lzswf9:lzgen16082:app.swf - 311,941 bytes after decompression
    (fdb) break LzNode:construct
    Breakpoint 1 at 0x24016: file LzNode.as, line 284
    (fdb) c   
    Breakpoint 1, LzNode.as:284
     284   }}}}}}function construct ($1_parent, $2_args) {
    (fdb) n
     286   this.__LZdelayedSetters = LzNode.__LZdelayedSetters;
    (fdb) p this
    $1 = [Object 27603121, class='LzModeManagerService']
    (fdb) p *this
    $2 = this = [Object 27603121, class='LzModeManagerService']
     $cfn = 0 (0x0)
     $isstate = false
     $lzc$bind_id = null
     $lzc$bind_name = null
     ....

   2) Verified that <canvas debug="true"> also compiles the same way.

   3) In the browser, verified that hello.lzx with &debug=true uses the debug LFC
      by doing 'ls -lu' on lps/includes/lfc, showing the time of access.




Modified: openlaszlo/trunk/WEB-INF/lps/lfc/build.xml
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/build.xml	2008-07-22 20:14:33 UTC (rev 10442)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/build.xml	2008-07-22 21:01:53 UTC (rev 10443)
@@ -233,18 +233,19 @@
         if (!(new File(plain)).exists()) {
           dobuild(plain, "swf" + v, shlibopt);
         }
-        // TODO: [2008-01-11 dda] when ready, add extra builds for SWF9
-        if (buildDebug && v != 9) {
+        if (buildDebug) {
           var dest = LFCdir + "LFC" + v + "-debug" + ext;
+          var platformopt = ((v == 9) ? "--option debug=true " : "");
           if (!(new File(dest)).exists()) {
             // TODO: [2006-06-07 ptw] (LPP-2034) When the LFC is 'clean' of
             // warnings, the options can be changed to simply --debug
             dobuild(dest,
                     "swf" + v,
+                    platformopt +
                     shlibopt + "--option nameFunctions --option warnGlobalAssignments '-D$debug=true'");
           }
           var dest = LFCdir + "LFC" + v + "-backtrace" + ext;
-          if (!(new File(dest)).exists()) {
+          if (v != 9 && !(new File(dest)).exists()) {
             // TODO: [2006-06-07 ptw] (LPP-2034) When the LFC is 'clean' of
             // warnings, the options can be changed to simply -g3
             dobuild(dest,

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzFormatter.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzFormatter.lzs	2008-07-22 20:14:33 UTC (rev 10442)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/compiler/LzFormatter.lzs	2008-07-22 21:01:53 UTC (rev 10443)
@@ -374,7 +374,7 @@
           var str;
           if (value is Function) {
             if ($debug) {
-              str = this.functionName(value);
+              str = Debug.functionName(value, false);
             }
             if (! str) {
               str =  'function () {...}';

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs	2008-07-22 20:14:33 UTC (rev 10442)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzDataElement.lzs	2008-07-22 21:01:53 UTC (rev 10443)
@@ -579,10 +579,14 @@
 
 if ($debug) {
 /**
-  * For debugging.  Same as serialize, but will abbreviate at printLength.
+  * For debugging, useful to override _dbg_name().
+  * _dbg_name should not be defined here, unless it
+  * can be consistently overridden or not (some runtimes
+  * need an 'override' keyword).
+  * Same as serialize, but will abbreviate at printLength.
   * @access private
   */
-function _dbg_name () :String {
+function dataElementMixin_dbg_name () :String {
     return this.serializeInternal(Debug.printLength);
 }
 }

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/debugger/LzMemory.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/debugger/LzMemory.lzs	2008-07-22 20:14:33 UTC (rev 10442)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/debugger/LzMemory.lzs	2008-07-22 21:01:53 UTC (rev 10443)
@@ -626,7 +626,7 @@
     }
   }
 
-  function _dbg_name () {
+  override function _dbg_name () {
     var leakage = 0;
     var n = this.length;
     for (var i = n - 1; i >=0; i--) {

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/events/LaszloEvents.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/events/LaszloEvents.lzs	2008-07-22 20:14:33 UTC (rev 10442)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/events/LaszloEvents.lzs	2008-07-22 21:01:53 UTC (rev 10443)
@@ -430,6 +430,13 @@
 public final class LzEvent extends LzDeclaredEventClass {
     /** @access private */
     var delegateList:Array = null;
+    if ($debug) {
+      var _dbg_eventSender:*;
+      var _dbg_eventName:String;
+    }
+    if ($profile) {
+      var _dbg_profileName:String;
+    }
 
   /**
    * @param LzEventable eventSender: The owner of this event

Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java	2008-07-22 20:14:33 UTC (rev 10442)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java	2008-07-22 21:01:53 UTC (rev 10443)
@@ -314,6 +314,10 @@
     }
     options.putBoolean(GENERATE_FUNCTION_2, true);
     options.putBoolean(GENERATE_FUNCTION_2_FOR_LZX, true);
+
+    if (options.getBoolean(DEBUG_SWF9)) {
+      options.putBoolean(NAME_FUNCTIONS, true);
+    }
   }
 
   public byte[] compile(String source) {

Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java	2008-07-22 20:14:33 UTC (rev 10442)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java	2008-07-22 21:01:53 UTC (rev 10443)
@@ -568,8 +568,9 @@
   /**
    * Get the file name of the LFC shared library for SWF9.
    */
-  public static String getLFCLibrary() {
-    return LPS.getLFCDirectory() + File.separator + "LFC9.swc";
+  public static String getLFCLibrary(boolean useDebug) {
+    String dbgext = useDebug ? "-debug" : "";
+    return LPS.getLFCDirectory() + File.separator + "LFC9" + dbgext + ".swc";
   }
 
   public static boolean isWindows() {
@@ -615,7 +616,7 @@
       cmd.add("-default-size");
       cmd.add(options.get(Compiler.CANVAS_WIDTH, "800"));
       cmd.add(options.get(Compiler.CANVAS_HEIGHT, "600"));
-      cmd.add("-library-path+=" + getLFCLibrary());
+      cmd.add("-library-path+=" + getLFCLibrary(options.getBoolean(Compiler.DEBUG_SWF9)));
     }
     else {
       // must be last before list of classes to follow.



More information about the Laszlo-checkins mailing list