Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18257] Debugger: In Alloy project, the debugger hits the last line of code twice in Step Over and Step Into

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2019-08-13T17:24:41.000+0000
Affected Version/sRelease 3.5.0
Fix Version/sn/a
ComponentsiOS
LabelsengTriage, qe-3.5.0, regression
ReporterSatyam Sekhri
AssigneeChristopher Williams
Created2014-12-18T06:22:03.000+0000
Updated2019-08-13T17:24:47.000+0000

Description

This is a Regression as the issue does not occur with 3.4.1.GA SDK. The issue happens on both iOS and Android for Alloy project. For Classic project it works fine. Steps to Reproduce: 1. Create a default alloy project and add following code to index.js
function doClick(e) {
    alert($.label.text);
    Ti.API.info("Testing Debug");
}
$.index.open();
2. Put a breakpoint at line 2 3. Debug the project for iOS device. In the app click on the label The breakpoint at line 2 is hit 4. Click on Step Over or Step Into. The alert is shown in the app and the debug execution now suspends at line 3. 5. Again click on Step Over or Step Into. The console shows the info "Testing Debug" Actual Result: The debugger still remains suspended at line 3 instead of finishing. Clicking again on Step Over or Step Into finishes the debug execution. (i.e. we need to perform Step Over twice on the last line).

Comments

  1. Pedro Enrique 2014-12-18

    This comment {quote} The issue happens on both iOS and Android for Alloy project. For Classic project it works fine {quote} The fact that this happens on Android as well, which has not been changes, makes me think that this is not a debugger issue, but an Alloy issue.
  2. Tim Poulsen 2014-12-18

    While I can confirm the behavior described in this ticket, Alloy has not changed for 3.5.0. We're shipping 1.5.1 with both SDK 3.4.1.GA and 3.5.0. Besides, all Alloy does is create the source map files used by Studio to enable the actual debugging. I'm not sure how this could be an Alloy issue.
  3. Pedro Enrique 2014-12-18

    Investigating
  4. Pedro Enrique 2014-12-18

    Ah! this is actually intended, even if this feature did not exist in the older debugger. This "pause reason" is called "beforeReturn", and this allows you to inspect the all variables of that function, even if there is a variable declaration at the very last line of the function body. I have removed this feature from iOS to make it work like it did back in 3.4.x
  5. Federico Casali 2014-12-19

    Tested on iOS (iPhone 6 + , iOS 8.1) I could reproduce the issue but noticed a slight difference between first launch and subsequent ones. Refer to the code in the bug description: 1. launch a. click on the label Result: breakpoint at line 2 is hit b. click on StepInto or StepOver Result: execution stops at line 3 (and alert is displayed) c. click on StepInto or StepOver again Result: execution is still stopped at line 3 (no alert is displayed) d. click once again StepIinto or StepOver Result: execution ends, therefore as reported in the bug, a further step clicking on stepInto or stepOver is required 2. Subsequent runs behave in this way: a. click on the label Result: execution stops, but this time it stops at line 1, on the function() b. click on StepInto or StepOver Result: execution stops now at line 2 c. click on StepInto or StepOver again Result: execution now stops at line 3 and alert is displayed d. click once again StepIinto or StepOver Result: Result: execution ends, therefore as reported in the bug, a further step clicking on stepInto or stepOver is required
  6. Ewan Harris 2015-05-04

    Reopening ticket, using: Mac OSX 10.10.3 Appc Studio: 4.0.1.201505020103 Titanium SDK build: 4.0.0.v20150430090209 Appc CLI (NPM): 0.3.55 Appc CLI (Registry): 0.2.279 Using the code in the description with the following line numbers
       1 function doClick(e) {
       2     alert($.label.text);
       3    Ti.API.info("Testing Debug");
       4 }
       5 $.index.open();
       
    As per Federicos comment I see the following behavior in the following scenarios:

    First attempt

    1. Launch the app 2. Press 'Hello, World' label on the app - *execution stops at line 2* 3. Click on Step Into or Step Over - *Alert is shown, execution stops at line 3* 4. Click on Step Into or Step Over - *Execution stays stopped at line 3* 5. Click on Step Into or Step Over - *Debugging stops*

    Subsequent attempts

    1. Press 'Hello, World' label on the app - *execution stops at line 1* 2. Click on Step Into or Step Over - *Execution stops at line 2* 3. Click on Step Into or Step Over - *Alert is shown, execution stops at line 3* 4. Click on Step Into or Step Over - *Execution stays stopped at line 3* 5. Click on Step Into or Step Over - *Debugging stops*
  7. Satyam Sekhri 2019-08-13

    The issue is no more reproducible with the latest builds. The debug execution does not remain suspended on the same line, if not relevant, after step into or step over. Verified on: Mac OS 10.14.6 Ti SDK: 8.1.0.v20190812112926 Appc CLI: 7.1.0 Node: 10.5.0 JDK: 10.0.2 Xcode: 10.3 Studio: 5.1.3.201907112159 Hence closing the issue.

JSON Source