[TIMOB-18257] Debugger: In Alloy project, the debugger hits the last line of code twice in Step Over and Step Into
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2019-08-13T17:24:41.000+0000 |
Affected Version/s | Release 3.5.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | engTriage, qe-3.5.0, regression |
Reporter | Satyam Sekhri |
Assignee | Christopher Williams |
Created | 2014-12-18T06:22:03.000+0000 |
Updated | 2019-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).
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.
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.
Investigating
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
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
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
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*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.