I haven't yet tested your patch, but it looks promising. Here are my 
notes so far:

- lfc/build.xml: "platformopt" is declared in the backtrace switch, but 
not used.
- lps/components/lztest/xmlequals.lzx needs to be updated, too.
- Did you file the swf8+backtrace finally bug, just in case it's a 
broader issue?
- I think we need to create our own workaround for the as3 
finally+return bug, did/may you file a ticket in our JIRA?
- The "LzBacktrace.lzs" include in lfc/debugger/Library.lzs can be 
simplified, because the AS3 special case is no longer necessary.
- lfc/debugger/platform/swf9/LzBacktrace.as can be removed now, can't it?
- JavascriptGenerator: "Array.prototype.slice(arguments)" instead of 
"Array.prototype.slice(arguments, 0)" for smaller code?
- JavascriptGenerator: rest arguments will create different "backtrace 
arguments" in AS3 compared to DHTML. The rest arguments need to be 
appended to the other arguments, so "[arg_1, arg_2, ..., 
arg_n].concat(arg_rest)" instead of "[arg_1, arg_2, ..., arg_n, arg_rest]".
- CodeGenerator: static functions capture the "this" for backtraces, 
this isn't done for DHTML and for AS3.
- CodeGenerator: The analyzer runs on the backtrace annotations, too. 
Isn't this wrong according to your note?
> Make sure only user variables are transformed, not annotations 
> introduced by the compiler.


Later:

- JavaGenerator: this is a snippet from test/lpp-8222.lzx in 
debug+backtrace+swf10:
> var $lzsc$d_$3 = Debug;
> var $lzsc$s_$4 = $lzsc$d_$3.backtraceStack;
> try {
> if ($lzsc$s_$4) {
> var $lzsc$a_$5 = [$lzc$ignore_$1];
> $lzsc$a_$5.callee = "handle oninit";
> $lzsc$a_$5["this"] = this;
> $lzsc$a_$5.filename = "lpp-8222.lzx";
> $lzsc$a_$5.lineno = 22;
> $lzsc$s_$4.push($lzsc$a_$5);
The annotations are still transformed, isn't this wrong?


I've used test/lpp-8222.lzx for testing in debug+backtrace+swf10 
(there's a bug which prevents the application from compiling in swf10, 
I'm going to fix it) and encountered the following issues:
- the initial debug-info: "Ignore the next error" didn't show up
- debug eval doesn't work in all cases, e.g. 'mytest.testCatchErrors()' 
fails with a VerifyError because of a stack underflow
- clicking on "throw uncaught error" and then inspecting the backtrace 
gives different results in swf10 compared to dhtml.
DHTML: last two entries shouldn't appear, should they?
---
0: LzSprite.prototype.__clickDispatcher @lfc/kernel/dhtml/LzSprite.js#1353
1: LzSprite.prototype.__mouseEvent @lfc/kernel/dhtml/LzSprite.js#1502
2: kernel/dhtml/LzMouseKernel.js#95/19 
@lfc/kernel/dhtml/LzMouseKernel.js#102
3: rawMouseEvent @lfc/services/LzModeManager.lzs#298
4: handleMouseEvent @lfc/services/LzModeManager.lzs#210
5: mouseevent @lfc/views/LaszloView.lzs#2637
6: sendEvent @lfc/events/LaszloEvents.lzs#547
7: handle onclick @lpp-8222.lzx#98
8: throwHow @lpp-8222.lzx#146
9: throwValue @lpp-8222.lzx#148
10: compiler/LzBootstrapDebugService.lzs#564/24 
@lfc/compiler/LzBootstrapDebugService.lzs#569
11: debugger/LzCompiler.lzs#27/28 @lfc/debugger/LzCompiler.lzs#29
---

SWF10: last entry shouldn't appear, should it?:
---
  0: handleMouseEvent @lfc/kernel/swf9/LzMouseKernel.as#29
  1: rawMouseEvent @lfc/services/LzModeManager.lzs#298
  2: handleMouseEvent @lfc/services/LzModeManager.lzs#210
  3: mouseevent @lfc/views/LaszloView.lzs#2637
  4: sendEvent @lfc/events/LaszloEvents.lzs#547
  5: handle onclick @lpp-8222.lzx#98
  6: throwHow @lpp-8222.lzx#146
  7: throwValue @lpp-8222.lzx#148
  8: LzError @lfc/debugger/LzMessage.lzs#440
---

On 10/4/2009 1:15 AM, P T Withington wrote:
> [Really ready for review now.  Backtraces work in swf9/10!]
>
> Change 20090929-ptw-y by [email protected] on 2009-09-29 18:01:59 EDT
>     in /Users/ptw/OpenLaszlo/trunk
>     for http://svn.openlaszlo.org/openlaszlo/trunk
>
> Summary: A cut at getting backtracing to work in swf9
>
> Bugs Fixed:
> LPP-1933 Compiler does not scope #pragma to compile-time conditional 
> block
> LPP-8479 Debug.evalCarefully not necessary after LPP-8222?
> [I got carried away trying to make the line numbering in the debugger
> more accurate...]
>
> Technical Reviewer: hminsky (pending)
> QA Reviewer: [email protected] (pending)
>
> Release Notes:
>    The debugger indicates when the file/line information on a debugger
>    message is not accurate.  If the location information is coming
>    from the view associated with the error, rather than @file it will
>    print %file.  If the line number is only approximate (backtracing
>    is not enabled), rather than #line it will print ~line.
>
> Details:
>
>     regression, lzunit: Update to return from for-in (to work around
>     AS3 bug in backtrace compiles.  arrayEquals and xmlequals are more
>     accurate now.
>
>     lztext:  Split the tests so as not to overflow the swf8 compiler
>     block size in backtrace compiles.
>
>     lzunit-test:  Correct arg defaults so you don't get a bogus file
>     name in string runtimes.
>
>     LzPreloader, LzApplication, SWF9Writer, eval: Disable backtraces
>     with a pragma.
>
>     LzMessage, LzMonitor, LzTrace: Make file and line prefixes
>     private, remove as3 clause now that backtraces are available
>     there, remove handling of uncaught errors now that they can't
>     happen.  Improve heuristication of file/line from arguments.
>     Indicate accuracy of file/line annotations (per release notes).
>
>     LzDebug.*, LzDebugStub, LZBootstrapDebugService: Adjust for
>     debugger being instantiated at load time in as3 (vs. incrementally
>     in js1).  Add kludges for nested try/finally not working in swf8.
>     Work around return from for-in bug in as3.  Move stackOverlow and
>     backtrace methods here, rather than trying to add them
>     dynamically.
>
>     Library, LzBacktrace: Rewrite as classes, include in all runtimes.
>     Had to rename stackframe `function` and `this` attributes to
>     `callee` and `context`.  Simplified debug and string methods.
>
>     build: Make it so you can build a backtrace lfc independently of a
>     debug lfc.
>
>     CompilationManager, TopLevelCompiler, info-response: fix to
>     calculate LFC size correctly
>
>     CodeGenerator, JavascriptGenerator: Treat a compile-time
>     conditional clause as a directive block scope per LPP-1933.
>     Enable backtracing in swf9.  Simplify transformation of <script>
>     functions.  Make sure only user variables are transformed, not
>     annotations introduced by the compiler.  Adjust backtrace
>     annotation to work in as3 compiler.  Move function name/line
>     information to backtrace annotation from function object.
>
>     SWF9External:  Use LPS methods to compute LFC names, consider the
>     backtrace flag.
>
>     SWF9Generator:  Force public members for NAME_FUNCTIONS
>
>     SWF9ParseTreePrinter:  Compensate for flex compiler not
>     understanding comma expressions in [].
>
>     Compiler:  Clean up option defaulting so that debug LFC is
>     compiled in debug mode.
>
>     build-properties:  Stop building swf7 and swf9.
>
> Tests:
>     More stuff works, still failing for swf9+debug+bactrace
>
> Files:
> M      test/smoke/regression.lzl
> M      test/smoke/lztext.lzl
> M      test/smoke/lzunit-test.lzl
> M      WEB-INF/lps/lfc/kernel/swf9/LzPreloader.as
> M      WEB-INF/lps/lfc/kernel/swf9/LFCApplication.as
> M      WEB-INF/lps/lfc/debugger/LzMessage.lzs
> M      WEB-INF/lps/lfc/debugger/LzDebug.lzs
> M      WEB-INF/lps/lfc/debugger/platform/swf9/LzDebug.as
> M      WEB-INF/lps/lfc/debugger/LzMonitor.lzs
> M      WEB-INF/lps/lfc/debugger/Library.lzs
> M      WEB-INF/lps/lfc/debugger/LzTrace.lzs
> M      WEB-INF/lps/lfc/debugger/LzBacktrace.lzs
> M      WEB-INF/lps/lfc/build.xml
> M      WEB-INF/lps/lfc/compiler/LzDebugStub.lzs
> M      WEB-INF/lps/lfc/compiler/LzBootstrapDebugService.lzs
> M      WEB-INF/lps/server/src/org/openlaszlo/cm/CompilationManager.java
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/JavascriptGenerator.java
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9ParseTreePrinter.java
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
> M      WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
> M      
> WEB-INF/lps/server/src/org/openlaszlo/compiler/ToplevelCompiler.java
> M      WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java
> M      WEB-INF/lps/templates/info-response.xslt
> M      build.properties
> M      lps/components/debugger/platform/swf9/eval.lzs
> M      lps/components/lzunit/lzunit.lzx
>
> Changeset: 
> http://svn.openlaszlo.org/openlaszlo/patches/20090929-ptw-y.tar
>
_______________________________________________
Laszlo-reviews mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-reviews

Reply via email to