{ "id": "170503", "key": "ALOY-1593", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "19950", "name": "CLI Release 7.0.0", "archived": false, "released": true } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2017-12-07T20:56:23.000+0000", "created": "2017-11-30T10:24:48.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [ { "id": "19970", "name": "Alloy 1.10.8", "archived": false, "released": true, "releaseDate": "2017-11-07" } ], "issuelinks": [], "assignee": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "updated": "2017-12-08T15:21:22.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "13602", "name": "Appcelerator Studio", "description": "Appcelerator Studio specific issues" }, { "id": "12332", "name": "Titanium SDK", "description": "Any integration or issues with the TiSDK" } ], "attachment": [], "flagged": false, "summary": "Android Debugger: Some breakpoints not hit if \"Resume\" is done anytime during debug", "creator": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Mac OS 10.13\r\nAppc Studio: 5.0.0.201711290734\r\nTi SDK: 7.0.0.v20171129100330\r\nAppc CLI: 7.0.0-master.54\r\nNode.js: 8.9.1", "comment": { "comments": [ { "id": "431766", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "We saw this issue during smoke tests. This is the environment:\r\nNode Version: 8.9.1\r\nNPM Version: 5.5.1\r\nMac OS: 10.13.1\r\nAppc CLI: 7.0.0-master.56\r\nAppc CLI NPM: 4.2.11-4\r\nTitanium SDK version: 7.0.0.v20171130091945\r\nAppcelerator Studio RC 5.0.0.201712050945\r\nAndroid 7.1.2\r\n\r\nIn my test case, I created a default alloy app, and placed a breakpoint in the doClick function. When the app was launched, it was stopped at the splash screen. When I clicked \"Resume\", it did not stop at the breakpoint I created.", "updateAuthor": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-12-06T01:50:23.000+0000", "updated": "2017-12-06T01:50:23.000+0000" }, { "id": "431799", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "So to help further tease out the root cause here. I tested an alloy app using Chrome DevTools (as described here: https://wiki.appcelerator.org/display/DB/Debugging+Android+Apps+with+3rd-party+Tools)\r\n\r\nAnd that worked fine. So this is definitely a Studio issue, not an SDK/debugger issue.\r\n\r\nThe next step is to determine if this only affects Alloy apps, or also affects classic apps. If it's Alloy only, then the most likely cause is that Studio is mishandling the source mapping from the original source JS to the generated files from Alloy's compilation process.", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2017-12-06T16:56:14.000+0000", "updated": "2017-12-06T16:56:14.000+0000" }, { "id": "431802", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "I should also note that I see above that this was found on an Android device. It's possible it may not be a classic app vs alloy app issue, but a device vs simulator issue.\r\n\r\nOnce we can login to production again, we should test alloy vs classic on simulators and see if that's the breaking difference (and if not, try simulator vs device).", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2017-12-06T19:16:42.000+0000", "updated": "2017-12-06T19:16:42.000+0000" }, { "id": "431819", "author": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I tested on device and found that the breakpoints are hit with a classic app. The app I used is the following.The breakpoint was in the event listener, which was in the same place as was in the Alloy app.\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n    backgroundColor : 'white'\r\n});\r\n\r\nvar myLabel = Ti.UI.createLabel({\r\n    text : 'Hello World',\r\n    top : 250\r\n});\r\nwin.add(myLabel);\r\n\r\nvar myButton = Ti.UI.createButton({\r\n    title : 'My Button',\r\n    top : 300,\r\n    width : 300,\r\n    left : 10\r\n});\r\nwin.add(myButton);\r\n\r\nmyButton.addEventListener('click', function(e){\r\n    alert('My Button Clicked'); // *** breakpoint is here\r\n});\r\n\r\nwin.open();\r\n{code}\r\n\r\nIt does appear that the issue is with Alloy.", "updateAuthor": { "name": "amukherjee", "key": "amukherjee", "displayName": "Abir Mukherjee", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-12-07T00:17:32.000+0000", "updated": "2017-12-07T00:18:18.000+0000" }, { "id": "431841", "author": { "name": "ppedduri", "key": "ppeduri", "displayName": "Prashanth Pedduri", "active": false, "timeZone": "Asia/Singapore" }, "body": "Production logins seem to work now. \r\nI verified Android debugger using both Alloy and Classic apps., here is what I found.\r\n\r\n|| App || Simulator || Device ||\r\n| Classic | Works | Works |\r\n| Alloy | Does't work | Doesn't work |\r\n\r\nI noticed that, for alloy App, the line numbers for breakpoints being hit are not matching the ones that debugger should hit. Basically, while V8InspectorDebugTarget tries to add a breakpoint, the line numbers are being tweaked to lessen a number (Since JSCore operates on zero based index).\r\n*Source*: https://github.com/appcelerator/titanium_studio/blob/development/plugins/com.axway.inspector/src/com/axway/inspector/model/InspectorDebugTarget.java#L250\r\n\r\n*What could be a probable fix?*\r\nEither within {{InspectorDebugTarget.java}} or within {{V8InspectorDebugTarget.java}} identify if the app is of type alloy and do not reduce line number.\r\n\r\n[~cwilliams], Please let me know your thoughts around this.\r\n\r\n*Edit*: If we have to fix this within {{InspectorDebugTarget.java}}, we need to clearly differentiate between android-alloy and ios-alloy apps and not deduct line number by 1 for only the all breakpoints except the one which starts with $.index.open(). This approach seems tricky and I'm not certain if this is correct way of dealing with android-alloy apps. The mapping seems perfect to me, as the same mapping works fine for iOS apps. ", "updateAuthor": { "name": "ppedduri", "key": "ppeduri", "displayName": "Prashanth Pedduri", "active": false, "timeZone": "Asia/Singapore" }, "created": "2017-12-07T12:31:11.000+0000", "updated": "2017-12-07T14:00:53.000+0000" }, { "id": "431848", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "Are you certain they're all just \"off by one\"? Seems odd to me that we'd be off by one - except for $.index.open(); I suspect that the source mapping is just not right for Alloy apps with Android and that may manifest itself in some cases with being off by one (but is likely off by varying numbers depending on the breakpoint).", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2017-12-07T15:47:42.000+0000", "updated": "2017-12-07T15:47:42.000+0000" }, { "id": "431854", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "So, I see the exact same behavior for Android and iOS with the same app. Looking at the generated source mapping, it's just mis-mapping the results.\r\n\r\nMy input index.js is:\r\n{code:javascript}\r\nvar i = 0;\r\nfunction doClick(e) {\r\n\ti++;\r\n alert($.label.text);\r\n}\r\n\r\n$.index.open();\r\n{code}\r\nI'm setting breakpoints at lines 1, 4, and 7. Lines 1 and 7 map correctly. Line 4 maps to the {{i++;}} line in the generated file.\r\n\r\nI verified that the npm package source-map also reads the map file the same way and gets the same results. So my best guess here is that the generated mappings from Alloy can be incorrect.", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2017-12-07T18:28:51.000+0000", "updated": "2017-12-07T18:28:51.000+0000" }, { "id": "431858", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "https://github.com/appcelerator/alloy/pull/860", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2017-12-07T20:14:03.000+0000", "updated": "2017-12-07T20:14:03.000+0000" }, { "id": "431859", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "Fixed in alloy@1.10.10, CLI 7.0.0-master.57 ", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2017-12-07T20:56:23.000+0000", "updated": "2017-12-07T22:10:27.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }