opened
sarsonj
username_0
Hi,
after upgrade to j2objc 2.x I have problem with stopping of code on breakpoints. When I use symbolic breakpoint to stop on exeption, the xCode stops running and shows Java source code, as expected. But when setting normal breakpoint, the code never stops. It worked with older j2objc (1.x).

Thanks,

Jindrich
Breakpoint is not catch in the xCode
issue
created
tomball
username_1
I'm not sure exactly what you mean by a normal breakpoint, but I just rebuilt the [J2Reversi](https://github.com/username_1/j2objc-sample-reversi) example with [j2objc-2.0.5](https://github.com/google/j2objc/releases/tag/2.0.5), and after clicking on a Java source line to set the breakpoint, it stopped in the debugger at that line.

Xcode's debugger (lldb) has very simple support for source debugging (like gdb): if #line preprocessor directives are added to the source file used to build the .o file, then they take precedence over the generated file's path. So when J2Reversi's Score.java file is translated with -g on my system, the Score.m file has source debugging lines in it:
```
...
#line 1 "/Users/tball/src/j2objc-sample-reversi/Classes/Othello/Engine/Score.java"
...
#line 36
+ (jint)GetOpponentWithInt:(jint)player {
...
#line 58
- (void)ScoreSubtractWithInt:(jint)player
                     withInt:(jint)amount {
...
```
#line directives contain the absolute path of the original source file (directives without paths reuse the last specified path). So there are only two ways the j2objc translator (or any other source generator) can do this incorrectly:

1.  The path is wrong: breakpoints aren't hit, since there's no code associated with a bad path.
1.  The line number is wrong: breakpoints hit on the wrong line, stepping is also off.

It sounds like you are seeing the first problem. Please rebuild your project, check that the problem still exists, then open a j2objc-generated .m file along with its original source (for Xcode projects, I use "find ~/Library/Developer/Xcode/DerivedData/_projectname_* -name '*.m'" to locate generated files). Copy the Java file's path, then verify it exists with the ls command. If not, then the build rule creating the generated file is the problem. Also check that the line numbers match for any methods where breakpoints aren't stopping.
comment
closed
sarsonj
username_0
issue