This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 205774 - Incorrect annotation marks
Summary: Incorrect annotation marks
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Hints & Annotations (show other bugs)
Version: 7.1
Hardware: PC All
: P2 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2011-12-01 13:26 UTC by Alexander Pepin
Modified: 2011-12-05 14:06 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
proposed patch (1.96 KB, text/plain)
2011-12-01 16:52 UTC, Egor Ushakov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pepin 2011-12-01 13:26:09 UTC
It's regression introduced in 7.1 on all platforms. This bug was originally interpreted as a part of Bug #200196 but now it's clear that they are different.
Steps to reproduce:
- create Welcome project
- set 2 breakpoints in welcome.cc in lines 38 and 45
- do step into project, OK
- do step over several times
Result: Step Over works fine until the first BP is reached after that next Step
Over moves the green cursor to the second breakpoint. At the same time "Source Location" in "Call Stack" shows "welcome.cc:39".  

gdb log is:
~"GNU gdb 6.8.0.20080328-cvs (cygwin-special)\n"
~"Copyright (C) 2008 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>\n"
~"This is free software: you are free to change and redistribute it.\n"
~"There is NO WARRANTY, to the extent permitted by law.  Type \"show
copying\"\n"
~"and \"show warranty\" for details.\n"
~"This GDB was configured as \"i686-pc-cygwin\".\n"
&"C:\\\\Users\\\\ap153252/.gdbinit: No such file or directory.\n"
(gdb) 
2-list-features
3-gdb-set print repeat 0
4-gdb-set backtrace limit 1024
5-gdb-set print elements 0
6-file-symbol-file
"C:/Users/ap153252/Documents/NetBeansProjects/Welcome_47/dist/Debug/Cygwin_4.x-Windows/welcome_47"
7-file-exec-and-symbols 
"C:\\Users\\ap153252\\Documents\\NetBeansProjects\\Welcome_47\\dist\\Debug\\Cygwin_4.x-Windows\\welcome_47"
2^done,features=["frozen-varobjs","pending-breakpoints"]
(gdb) 
3^done
(gdb) 
4^done
(gdb) 
5^done
(gdb) 
6^done
(gdb) 
7^done
(gdb) 
8-file-list-exec-source-file
9cd C:\Users\ap153252\Documents\NetBeansProjects\Welcome_47
10-exec-arguments "arg 1" "arg 2" "arg 3" "arg 4"
11set environment
Path=C:\cygwin\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program
Files\Java\jdk1.6.0_21\bin\;C:\Program Files
(x86)\QuickTime\QTSystem\;C:\cygwin\bin;C:\Program Files (x86)\Calibre2\
12-break-insert -f
"/cygdrive/C/Users/ap153252/Documents/NetBeansProjects/Welcome_47/welcome.cc:38"
13-break-insert -f
"/cygdrive/C/Users/ap153252/Documents/NetBeansProjects/Welcome_47/welcome.cc:45"
14-break-insert -t main
15-exec-run
8^done,line="24",file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_47/welcome.cc",macro-info="0"
(gdb) 
&"cd C:\\Users\\ap153252\\Documents\\NetBeansProjects\\Welcome_47\n"
~"Working directory
/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_47.\n"
9^done
(gdb) 
10^done
(gdb) 
&"set environment
Path=C:\\cygwin\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program
Files\\Java\\jdk1.6.0_21\\bin\\;C:\\Program Files
(x86)\\QuickTime\\QTSystem\\;C:\\cygwin\\bin;C:\\Program Files
(x86)\\Calibre2\\\n"
11^done
(gdb) 
12^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00401254",func="main",file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_47/welcome.cc",line="38",times="0"}
(gdb) 
13^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x004012f8",func="main",file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_47/welcome.cc",line="45",times="0"}
(gdb) 
14^done,bkpt={number="3",type="breakpoint",disp="del",enabled="y",addr="0x0040122b",func="main",file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_47/welcome.cc",line="33",times="0"}
(gdb) 
15^running
(gdb) 
~"[New thread 4928.0x6e8]\n"
&"Error: dll starting at 0x76aa0000 not found.\n"
&"Error: dll starting at 0x74a60000 not found.\n"
&"Error: dll starting at 0x76aa0000 not found.\n"
&"Error: dll starting at 0x76bc0000 not found.\n"
~"[New thread 4928.0x1a0c]\n"
15*stopped,thread-id="1",frame={addr="0x0040122b",func="main",args=[{name="argc",value="5"},{name="argv",value="0xdb9560"}],file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_47/welcome.cc",line="33"}
(gdb) 
16info threads
17-stack-list-frames
&"info threads\n"
~"  2 thread 4928.0x1a0c  0x76ebf8f5 in ntdll!RtlUpdateClonedSRWLock ()\n"
~"   from /cygdrive/c/Windows/system32/ntdll.dll\n"
~"* 1 thread 4928.0x6e8  main (argc=5, argv=0xdb9560) at welcome.cc:33\n"
16^done
(gdb) 
17^done,stack=[frame={level="0",addr="0x0040122b",func="main",file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_47/welcome.cc",line="33"}]
(gdb) 
18-stack-list-arguments 1
18^done,stack-args=[frame={level="0",args=[{name="argc",value="5"},{name="argv",value="0xdb9560"}]}]
(gdb) 
19-exec-next
19^running
(gdb) 
19*stopped,reason="end-stepping-range",thread-id="1",frame={addr="0x00401230",func="main",args=[{name="argc",value="5"},{name="argv",value="0xdb9560"}],file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_47/welcome.cc",line="35"}
(gdb) 
20-stack-list-frames
20^done,stack=[frame={level="0",addr="0x00401230",func="main",file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_47/welcome.cc",line="35"}]
(gdb) 
21-stack-list-arguments 1
21^done,stack-args=[frame={level="0",args=[{name="argc",value="5"},{name="argv",value="0xdb9560"}]}]
(gdb) 
22-exec-next
22^running
(gdb) 
22*stopped,reason="end-stepping-range",reason="breakpoint-hit",bkptno="1",thread-id="1",frame={addr="0x00401254",func="_fu0___ZSt4cout",args=[],file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_47/welcome.cc",line="38"}
(gdb) 
23-stack-list-frames
23^done,stack=[frame={level="0",addr="0x00401254",func="_fu0___ZSt4cout",file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_47/welcome.cc",line="38"}]
(gdb) 
24-stack-list-arguments 1
24^done,stack-args=[frame={level="0",args=[{name="argc",value="5"},{name="argv",value="0xdb9560"}]}]
(gdb) 
25-exec-next
25^running
(gdb) 
25*stopped,reason="end-stepping-range",thread-id="1",frame={addr="0x00401260",func="_fu0___ZSt4cout",args=[],file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_47/welcome.cc",line="39"}
(gdb) 
26-stack-list-frames
26^done,stack=[frame={level="0",addr="0x00401260",func="_fu0___ZSt4cout",file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_47/welcome.cc",line="39"}]
(gdb) 
27-stack-list-arguments 1
27^done,stack-args=[frame={level="0",args=[{name="argc",value="5"},{name="argv",value="0xdb9560"}]}]
(gdb)
Comment 1 Alexander Pepin 2011-12-01 13:30:38 UTC
in 7.0.1 patch 2 it works nicely.
gdb log for 7.0.1:

~"GNU gdb 6.8.0.20080328-cvs (cygwin-special)\n"
~"Copyright (C) 2008 Free Software Foundation, Inc.\n"
~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n"
~"This is free software: you are free to change and redistribute it.\n"
~"There is NO WARRANTY, to the extent permitted by law.  Type \"show copying\"\n"
~"and \"show warranty\" for details.\n"
~"This GDB was configured as \"i686-pc-cygwin\".\n"
&"C:\\\\Users\\\\ap153252/.gdbinit: No such file or directory.\n"
(gdb) 
2-list-features
3-gdb-set print repeat 0
4-gdb-set backtrace limit 1024
5-gdb-set print elements 0
6-file-symbol-file "C:/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx/dist/Debug/Cygwin_4.x-Windows/welcome_xxx"
7-file-exec-and-symbols  "C:\\Users\\ap153252\\Documents\\NetBeansProjects\\Welcome_xxx\\dist\\Debug\\Cygwin_4.x-Windows\\welcome_xxx"
2^done,features=["frozen-varobjs","pending-breakpoints"]
(gdb) 
3^done
(gdb) 
4^done
(gdb) 
5^done
(gdb) 
6^done
(gdb) 
7^done
(gdb) 
8-file-list-exec-source-file
9cd C:\Users\ap153252\Documents\NetBeansProjects\Welcome_xxx
10-exec-arguments "arg 1" "arg 2" "arg 3" "arg 4"
11set environment Path=C:\cygwin\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.6.0_21\bin\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\cygwin\bin;C:\Program Files (x86)\Calibre2\
8^done,line="24",file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx/welcome.cc",macro-info="0"
(gdb) 
12-break-insert -f "C:/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx/welcome.cc:38"
1
13-break-insert -f "C:/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx/welcome.cc:45"
1
14-break-insert -t main
15-exec-run
16info threads
&"cd C:\\Users\\ap153252\\Documents\\NetBeansProjects\\Welcome_xxx\n"
~"Working directory /cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx.\n"
9^done
(gdb) 
10^done
(gdb) 
&"set environment Path=C:\\cygwin\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Java\\jdk1.6.0_21\\bin\\;C:\\Program Files (x86)\\QuickTime\\QTSystem\\;C:\\cygwin\\bin;C:\\Program Files (x86)\\Calibre2\\\n"
11^done
(gdb) 
12^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00401254",func="main",file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx/welcome.cc",line="38",times="0"}
(gdb) 
&"\n"
1^done
(gdb) 
13^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x004012f8",func="main",file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx/welcome.cc",line="45",times="0"}
(gdb) 
&"\n"
1^done
(gdb) 
14^done,bkpt={number="3",type="breakpoint",disp="del",enabled="y",addr="0x0040122b",func="main",file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx/welcome.cc",line="33",times="0"}
(gdb) 
15^running
(gdb) 
~"[New thread 4768.0xf54]\n"
&"Error: dll starting at 0x76aa0000 not found.\n"
&"Error: dll starting at 0x74a60000 not found.\n"
&"Error: dll starting at 0x76aa0000 not found.\n"
&"Error: dll starting at 0x76bc0000 not found.\n"
No command for record 1^done
No command for record 1^done
~"[New thread 4768.0x10c8]\n"
15*stopped,thread-id="1",frame={addr="0x0040122b",func="main",args=[{name="argc",value="5"},{name="argv",value="0xb59560"}],file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx/welcome.cc",line="33"}
(gdb) 
&"info threads\n"
~"  2 thread 4768.0x10c8  0x76ebf8f5 in ntdll!RtlUpdateClonedSRWLock ()\n"
~"   from /cygdrive/c/Windows/system32/ntdll.dll\n"
17-stack-list-frames
~"* 1 thread 4768.0xf54  main (argc=5, argv=0xb59560) at welcome.cc:33\n"
16^done
(gdb) 
17^done,stack=[frame={level="0",addr="0x0040122b",func="main",file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx/welcome.cc",line="33"}]
(gdb) 
18-stack-list-arguments 1
18^done,stack-args=[frame={level="0",args=[{name="argc",value="5"},{name="argv",value="0xb59560"}]}]
(gdb) 
19-exec-next
19^running
(gdb) 
19*stopped,reason="end-stepping-range",thread-id="1",frame={addr="0x00401230",func="main",args=[{name="argc",value="5"},{name="argv",value="0xb59560"}],file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx/welcome.cc",line="35"}
(gdb) 
20-stack-list-frames
20^done,stack=[frame={level="0",addr="0x00401230",func="main",file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx/welcome.cc",line="35"}]
(gdb) 
21-stack-list-arguments 1
21^done,stack-args=[frame={level="0",args=[{name="argc",value="5"},{name="argv",value="0xb59560"}]}]
(gdb) 
22-exec-next
22^running
(gdb) 
22*stopped,reason="end-stepping-range",reason="breakpoint-hit",bkptno="1",thread-id="1",frame={addr="0x00401254",func="_fu0___ZSt4cout",args=[],file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx/welcome.cc",line="38"}
(gdb) 
23-stack-list-frames
23^done,stack=[frame={level="0",addr="0x00401254",func="_fu0___ZSt4cout",file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx/welcome.cc",line="38"}]
(gdb) 
24-stack-list-arguments 1
24^done,stack-args=[frame={level="0",args=[{name="argc",value="5"},{name="argv",value="0xb59560"}]}]
(gdb) 
25-exec-next
25^running
(gdb) 
25*stopped,reason="end-stepping-range",thread-id="1",frame={addr="0x00401260",func="_fu0___ZSt4cout",args=[],file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx/welcome.cc",line="39"}
(gdb) 
26-stack-list-frames
26^done,stack=[frame={level="0",addr="0x00401260",func="_fu0___ZSt4cout",file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx/welcome.cc",line="39"}]
(gdb) 
27-stack-list-arguments 1
27^done,stack-args=[frame={level="0",args=[{name="argc",value="5"},{name="argv",value="0xb59560"}]}]
(gdb) 
28-exec-next
28^running
(gdb) 
28*stopped,reason="end-stepping-range",thread-id="1",frame={addr="0x00401294",func="_fu1___ZSt4cout",args=[],file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx/welcome.cc",line="40"}
(gdb) 
29-stack-list-frames
29^done,stack=[frame={level="0",addr="0x00401294",func="_fu1___ZSt4cout",file="welcome.cc",fullname="/cygdrive/c/Users/ap153252/Documents/NetBeansProjects/Welcome_xxx/welcome.cc",line="40"}]
(gdb) 
30-stack-list-arguments 1
30^done,stack-args=[frame={level="0",args=[{name="argc",value="5"},{name="argv",value="0xb59560"}]}]
(gdb)
Comment 2 Egor Ushakov 2011-12-01 15:13:55 UTC
looks like a race condition in current line annotation setting
Comment 3 Egor Ushakov 2011-12-01 15:51:31 UTC
cnd sets correct line for the current PC annotation but for some reason annotation sticks to the nearest following annotation in the editor (in our case - breakpoint). Interesting observations:
1. if user remove breakpoint annotation or reopen the file - it all reappears correctly (i.e. all annotations appears where they should)
2. it all happen only if before the step current PC annotation was on the same line as another breakpoint annotation (visible mixed annotation)
It all worked in 7.0.1, could it be a change in editor that causes this behavior?
Comment 4 Egor Ushakov 2011-12-01 16:37:39 UTC
it looks like this performance optimization is the cause (Annotations.java:401):
...
else if (lastGetLineAnnotationsLine + 1 == line && lastGetLineAnnotationsIdx + 1 < lineAnnotationsArray.size()) {
                    annos = (LineAnnotations)lineAnnotationsArray.get(lastGetLineAnnotationsIdx + 1);
                    lastGetLineAnnotationsIdx++;
                    lastGetLineAnnotationsLine = annos.getLine();
                    lastGetLineAnnotationsResult = annos;
                    return annos;
                }
Comment 5 Egor Ushakov 2011-12-01 16:44:21 UTC
if I comment these lines everything works perfect
Comment 6 Egor Ushakov 2011-12-01 16:52:02 UTC
Created attachment 113717 [details]
proposed patch
Comment 7 Jan Lahoda 2011-12-02 08:58:33 UTC
Thanks for the patch. I did the change for getLineAnnotations (only tried to make the diff smaller). For getNextLineWithAnnotation, the current behavior is actually correct: the method should return the line number of a next line with annotations. Which, as I read the code, is exactly what happens.

http://hg.netbeans.org/jet-main/rev/337b947a2692

Marian, Jirka, please let me know if this should go to 7.1.
Comment 8 Marian Mirilovic 2011-12-02 09:53:42 UTC
(In reply to comment #7)
> Marian, Jirka, please let me know if this should go to 7.1.

Alexander, or anybody from CND : is it stopper for you (and the only reason to rebuild FCS) ? 

My personal preference is to fix it into patch (means 7.1.1).
Comment 9 Egor Ushakov 2011-12-02 10:02:30 UTC
cnd QA thinks it is a showstopper (and a regression) and must be fixed in 7.1
Comment 10 Miloslav Metelka 2011-12-02 11:59:23 UTC
The patch seems ok to me.
Comment 11 Marian Mirilovic 2011-12-02 12:03:06 UTC
Ok, integrate into release71, ASAP please.
Comment 12 Jan Lahoda 2011-12-02 12:23:45 UTC
release71:
http://hg.netbeans.org/releases/rev/a03ccf7e25a4

Please verify.
Comment 13 Quality Engineering 2011-12-03 08:00:48 UTC
Integrated into 'releases'
Changeset: http://hg.netbeans.org/releases/rev/a03ccf7e25a4
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #205774: make sure that the last cache is used in getLineAnnotations only if the next annotation's line actually matches the provided line.
Comment 14 Quality Engineering 2011-12-04 11:58:54 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/337b947a2692
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #205774: make sure that the last cache is used in getLineAnnotations only if the next annotation's line actually matches the provided line.
Comment 15 Alexander Pepin 2011-12-05 14:06:46 UTC
Verified in FCS build 20111203