udalrich / jdibug

Automatically exported from code.google.com/p/jdibug
17 stars 4 forks source link

Wrong line highlighted when setting breakpoint. #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open JdibugTest.java in emacs.
2. Move the cursor to line 2 (doStuff())
3. Set a breakpoint using jdibug-toggle breakpoint

What is the expected output? What do you see instead?

Observed: Line 3 is highlighted and the cursor moves to line 3.
Expected: Line 2 is highlighted and the cursor stays on line 2.

What version of the product are you using? On what operating system?

GNU Emacs 23.2.1 (x86_64-apple-darwin10.4.0, NS apple-appkit-1038.32)

Please provide any additional information below.

https://gist.github.com/768480#file_jdibug_test.java

Original issue reported on code.google.com by jason.t...@gmail.com on 6 Jan 2011 at 8:13

GoogleCodeExporter commented 9 years ago
Note also that JDEE is not installed.

Original comment by jason.t...@gmail.com on 6 Jan 2011 at 8:15

GoogleCodeExporter commented 9 years ago
As with issue 16, I cannot reproduce this.  However, line 2 is not a valid 
location to create a breakpoint.  If you try to create a breakpoint at line 3 
or 4 (or any other line with source), does it highlight correctly?

Original comment by udalrich.schermer on 9 Jan 2011 at 2:58

GoogleCodeExporter commented 9 years ago
If I try to create a breakpoint at line 3 I see the same behavior - line 4 is 
highlighted and the cursor moves to the beginning of line 4.

Original comment by jason.t...@gmail.com on 9 Jan 2011 at 3:03

GoogleCodeExporter commented 9 years ago
*JDIbug-Breakpoints* indicates, however, that the breakpoint is set on line 3.

Original comment by jason.t...@gmail.com on 9 Jan 2011 at 3:06

GoogleCodeExporter commented 9 years ago
During execution the correct, current line is highlighted blue. The 
*JDIbug-Locals* buffer, however, says "No debug information available"

Original comment by jason.t...@gmail.com on 9 Jan 2011 at 3:08

GoogleCodeExporter commented 9 years ago
Did you compile with javac or javac -g?  I think the default option is to 
compile with debug information turned off.  Or perhaps just lines and source 
turned on, but variable information turned off.  If you recompile with -g, it 
should display the variables.

It is strange that the breakpoints buffer displays the correct line, but the 
wrong one gets highlighted.  If you do M-: (goto-char (point-min)) RET from the 
java buffer, does it go to the first line?  If you then do M-: (forward-line 
(1- 3)) RET, do you then go to line 3? 

That is basically what the code is doing to figure out where to highlight the 
breakpoint.  Although that is also what it does to highlight the current line 
in blue, so I do not know why it would work in one case but not the other.

Original comment by udalrich.schermer on 9 Jan 2011 at 4:16

GoogleCodeExporter commented 9 years ago
Yeah, evaluating the two expressions you indicated correctly goes to line 3. 
Weird. I'll step into the jdibug-toggle-breakpoint function and see if I can 
find what's going wrong.

Original comment by jason.t...@gmail.com on 9 Jan 2011 at 4:41

GoogleCodeExporter commented 9 years ago
Looks like an issue with the 0.4 release vs. trunk. Here's the relevant part of 
my jdibug-breakpoint-update:

(forward-line (or (jdibug-breakpoint-line-number bp) 
(jdibug-get-class-line-number)))

And from trunk:

forward-line (1- (or (jdibug-breakpoint-line-number bp) 
(jdibug-get-class-line-number))))

I'll switch to trunk and see if that resolves my problem.

Thanks!

Original comment by jason.t...@gmail.com on 9 Jan 2011 at 5:52

GoogleCodeExporter commented 9 years ago
Building from trunk fixed this problem for me.

Original comment by jason.t...@gmail.com on 9 Jan 2011 at 11:20

GoogleCodeExporter commented 9 years ago
This is fixed in the 0.5 branch and will be part of 0.5 when released.

The 0.5 branch is intended to contain working code which users could download 
and use, but it should be considered beta code.  The change described in 
comment 8 will also fix the issue.

Original comment by udalrich.schermer on 10 Jan 2011 at 3:45

GoogleCodeExporter commented 9 years ago

Original comment by udalrich.schermer on 12 Apr 2011 at 3:30