[TIMOB-17629] Debugger does not stop at the correct breakpoint/position
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-09-15T18:02:43.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 3.4.0, Release 3.5.0 |
Components | iOS |
Labels | TCSupportTriage |
Reporter | Ivo |
Assignee | Pedro Enrique |
Created | 2014-08-04T14:46:30.000+0000 |
Updated | 2014-11-21T20:29:49.000+0000 |
Description
When I debug my application, I need to place the breakpoint exactly one line below the one I want to debug at. This is very frustrating and makes debugging really unpleasant.
The only exception is file app.js for which breakpoints seems to be handled corectly.
The following code illustrates the problem:
if (Ti.version < 1.8) {
alert('Sorry - this application template requires Titanium Mobile SDK 1.8 or later');
}
var myVar = 5;
var yourVar = 6;
var thirdVar = myVar + yourVar;
var my = require("MyDir/MyThing").MyThing();
my.invoke();
Putting a break point behaves correctly for above file (app.js).
exports.MyThing = function() {
var Me = this;
var first = 35;
var second = false;
function myFunc() {
var a = 5 + 3;
return a + 2 + 3;
}
this.invoke = function() {
var b = 7;
return myFunc();
};
return this;
};
However for the second file, if I need to stop at line 9 I will need to place the breakpoint at line 10. More over, if I need to stop at line 10 I need to put the breakpoint at line 11 which really does not make sence.
Attached is a sample project.
Attachments
File | Date | Size |
---|---|---|
SDK320Test.zip | 2014-08-04T14:46:30.000+0000 | 2457512 |
I can not reproduce the reported problem. The breakpoints always suspend at the line number that I have expected in MyThing.js file. I'm not sure whether there is a caching issue with source maps that is causing the issue on your machine. Can you clean the project and re-run the debugger ?
Cleaning the project did not help. I also tried to create a new workspace and imported the project. Issue is still there. Noticed that the misplaced suspension of the debugger happens only on the source files that are required as commonJS modules. For example, if I include a file using "Titanium.include" the debugger seems to suspend on the right place. Perhaps that explains why it works correctly in app.js. Each member in the team (team of 7) working on our project has this same issue. It is strange that no one else has experienced/reported this.
I have the same error while debugging using 3.3.0 GA, the debugger doesn't stop at the right position, always on the next line and is very annoying. If I use the previous version (3.2.3 GA) the debugger stops in the right position where I have placed the breakpoints. I have tried to clean and also create a new project, but has not solved the problem
I also have this problem; cleaning does not correct the problem. Ti Studio version 3.3.0.201407100905 OS X 10.9.4. XCode Version 5.1.1 (5B1008) My project is comprised entirely of CommonJS modules (with the exception of app.js, of course). Breakpoints work properly in app.js, but nowhere else. Please fix this; it makes my brain hurt to debug this way!
Chris, could you please investigate? Not sure where we need to fix the issue (but I'm guessing somewhere in source map generation)
[~pec1985] I believe this may actually be related to TIMOB-16004.
PR pending: https://github.com/appcelerator/titanium_mobile/pull/6021
Back port for 3.4.x https://github.com/appcelerator/titanium_mobile/pull/6081
Verified fix on: Mac OSX 10.9.4 Appcelerator Studio, build: 3.4.0.201409131030 Titanium SDK build: 3.4.0.v20140915105910 Titanium CLI, build: 3.4.0-rc3 Alloy: 1.5.0-beta2 Xcode6 GM Seed iPhone Device 5 (8.0 GM Seed) Using the test case provided by Satyam I ran the code in debug mode. The breakpoints were correctly hit and the expression value for mything_thirdVar was changed to 11 in the expected place on line 11. Closing ticket.