[ALOY-1627] Breakpoints not working on alloy apps
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-11-01T18:59:11.000+0000 |
Affected Version/s | Alloy 1.13.2 |
Fix Version/s | CLI Release 7.0.8 |
Components | Tooling |
Labels | user_experience |
Reporter | Seth Toda |
Assignee | Feon Sua Xin Miao |
Created | 2015-08-25T22:40:33.000+0000 |
Updated | 2018-11-01T18:59:14.000+0000 |
Description
Sprint noticed their their break points aren't working on conditions in their alloy apps. I've been able to verify this with my own testing on a fresh application. To clarify (➜ == break point):
// This will not pause and the inner block runs
➜ if(true){
console.log("hello Jay!");
}
// This will pause
if(true){
➜ console.log("hello Jay!");
}
Steps to reproduce
1. Create a new alloy app within Appcelerator Studio 2. Add the above if statement with a breakpoint on the conditoin 3. Run in debugging modeExpected
The code pauses on the if statement and doesn't call console.log()Actual
The code is ran as if the breakpoint isn't there.Attachments
File | Date | Size |
---|---|---|
breakpoint2.gif | 2015-08-26T19:28:33.000+0000 | 203315 |
native_android.png | 2015-12-02T00:37:48.000+0000 | 109137 |
native_android2.png | 2015-12-02T00:37:48.000+0000 | 109213 |
Screen Shot 2015-08-25 at 1.18.45 PM.png | 2015-08-25T22:38:19.000+0000 | 414594 |
[~pinnamuri], feel free to let me know if you need anything else from me.
Just found that the breakpoint fails totally on the first build. But the second build works.
[~pinnamuri], any ballpark I could get this scheduled?
[~kkolipaka] Can you take a look into this ?
Looks like we are ignoring the break points for if conditions where condition value is already known at build time. Please find the snippet below for better understanding. And this happens only for alloy projects for iOS applications. It has to be fixed from iOS SDK end.
Hi. The test sample is *not valid*. 1. There's no sensible reason why anyone would do
if(true)
2. I just tested this natively on Xcode. if I write the below native codeand set the breakpoint at
if(YES)
. The behavior is the same, it *does not pause*, and goes toNSLog(@"hello Jay");
Our debugger actually relies on Xcode Objective C behavior, so there's nothing we can do. But as Kondal has explained above, it makes sense that Xcode ignores the break points for if conditions where condition value is already known at build time. The below native code is valid and the breakpoint will pause on the if statement:I'm not sure why in this ticket only alloy sees this behavior, but i think the bigger question is, are we seeing problems hitting breakpoints on if blocks that does not do
if (true)
orif(false)
. If so, please provide a valid reproducible case here.I was able to reproduce this issue i.e: * If I add a breakpoint to
if(true)
orif(false)
in an Alloy app, then the debugger will not hit those breakpoints. * If I add a breakpoint toif(true)
orif(false)
in a *Titanium classic app*, then the debugger *will hit* those breakpoints. * The two stated above behaviors occur with both iOS simulator *and* Android emulator. Given that the bug behavior appears on Android, I tried setting a breakpoint atif(true)
in a native Android project and observed the same behavior that [~cng] saw when debugging in native iOS; see native_android.png and native_android2.png attachments. And to go off of [~cng]'s last comment:Is there a legitimate bug when using debugger with Titanium Classic apps?
Are Alloy apps being debugged properly?
*Tested on:* Appcelerator Studio, build: 4.4.0.201511241829 Appc CLI NPM: 4.2.2 Appc CLI Core: 5.1.0 Arrow: 1.3.22 SDK: 5.1.1.GA Node: v4.2.2 OS: El Capitan (10.11.1) Xcode: 7.1.1 Devices: iphone simulator (9.1), genymotion emulator (4.4.4)Hello [~stoda] , the reason the breakpoint is not hit when placed on the
statement is because if true will always be true. When alloy is ran it generates separate files , so when you're putting a breakpoint studio actually ties it to the equivalent line on the generated files. If something will always be true it won't get added to the files same with any variables that are created but not used. If you put the breakpoint on line underneath on the print statement it will get hit.
PR: https://github.com/appcelerator/alloy/pull/904 Looks like white space between the lines cause source map mismatch.
FR Passed. PR Merged.
Verified the fix in 7.0.7-master.9. Closing.