-
Bug
-
Resolution: Fixed
-
P2
-
1.4.1_02, 1.4.2, 1.4.2_05, 1.4.2_08
-
b26
-
x86
-
windows, windows_2000, windows_xp
In the following example, bytecode index 37 in the method void test()
" 37 goto 43"
is mapped to line number 47, which is not correct.
Example, java code:
***************************************************************************************************
/*
Testcase: Debugger steps into forbidden code
http://www.netbeans.org/issues/show_bug.cgi?id=33921
Product Version = NetBeans IDE 3.5 RC2 (Build 200305182350)
IDE Versioning = IDE/1 spec=3.42.1 impl=200305182350
Operating System = Windows 98 version 4.10 running on x86
Java; VM; Vendor = 1.4.1; Java HotSpot(TM) Client VM 1.4.1-b21; Sun Microsystems Inc.
How to reproduce:
- Set a breakpoint on first line in test()
- Single-step [F8] through test()
Expected behavior:
- The debugger should skip the line "deleteAllSystemFiles();"
Actual behavior:
- The debugger steps onto the line "deleteAllSystemFiles();"
*/
public class DebuggerIfTrap{
public static void main(String[] args) {
try{
test();
}// try
catch(Throwable t){
t.printStackTrace();
}// catch
System.exit(0);
}// method
private final static void test(){
long number1 = 3l;
String myString = "";
String rs1 = executeQuery("SELECT * FROM MY_TABLE;");
if(next()){
close();
long number2 = 4l;
if(number2 < number1){
deleteAllSystemFiles();// The Debugger steps _onto_ this. It should not do so!
}// if
}// if()
else{
close();
}// else
}// method
public static boolean next(){
return true;
}// method
public static void close(){
}// method
public static String executeQuery(String query){
return query;
}// method
public static void deleteAllSystemFiles(){
}// method
}// class
***************************************************************************************************
Example - bytecode:
***************************************************************************************************
Compiled from DebuggerIfTrap.java
public class DebuggerIfTrap extends java.lang.Object
/* ACC_SUPER bit set */
{
public DebuggerIfTrap();
public static void main(java.lang.String[]);
private static final void test();
public static boolean next();
public static void close();
public static java.lang.String executeQuery(java.lang.String);
public static void deleteAllSystemFiles();
Method DebuggerIfTrap()
0 aload_0
1 invokespecial #1 <Method java.lang.Object.<init>()V>
4 return
Method void main(java.lang.String[])
0 invokestatic #2 <Method DebuggerIfTrap.test()V>
3 goto 14
6 astore_1
7 aload_1
8 invokevirtual #4 <Method java.lang.Throwable.printStackTrace()V>
11 goto 14
14 iconst_0
15 invokestatic #5 <Method java.lang.System.exit(I)V>
18 return
Exception table:
from to target type
0 3 6 <Class java.lang.Throwable>
Method void test()
0 ldc2_w #6 <Long 3>
3 lstore_0
4 ldc #8 <String "">
6 astore_2
7 ldc #9 <String "SELECT * FROM MY_TABLE;">
9 invokestatic #10 <Method DebuggerIfTrap.executeQuery(Ljava/lang/String;)Ljava/lang/String;>
12 astore_3
13 invokestatic #11 <Method DebuggerIfTrap.next()Z>
16 ifeq 40
19 invokestatic #12 <Method DebuggerIfTrap.close()V>
22 ldc2_w #13 <Long 4>
25 lstore 4
27 lload 4
29 lload_0
30 lcmp
31 ifge 37
34 invokestatic #15 <Method DebuggerIfTrap.deleteAllSystemFiles()V>
37 goto 43
40 invokestatic #12 <Method DebuggerIfTrap.close()V>
43 return
Method boolean next()
0 iconst_1
1 ireturn
Method void close()
0 return
Method java.lang.String executeQuery(java.lang.String)
0 aload_0
1 areturn
Method void deleteAllSystemFiles()
0 return
Line numbers for method DebuggerIfTrap()
line 26: 0
Line numbers for method void main(java.lang.String[])
line 30: 0
line 31: 3
line 33: 6
line 34: 11
line 35: 14
line 36: 18
Line numbers for method void test()
line 40: 0
line 41: 4
line 42: 7
line 43: 13
line 44: 19
line 45: 22
line 46: 27
line 47: 34
line 51: 40
line 53: 43
Line numbers for method boolean next()
line 57: 0
Line numbers for method void close()
line 61: 0
Line numbers for method java.lang.String executeQuery(java.lang.String)
line 64: 0
Line numbers for method void deleteAllSystemFiles()
line 68: 0
Local variables for method DebuggerIfTrap()
DebuggerIfTrap this pc=0, length=5, slot=0
Local variables for method void main(java.lang.String[])
java.lang.String[] args pc=0, length=19, slot=0
java.lang.Throwable t pc=7, length=7, slot=1
Local variables for method void test()
long number1 pc=4, length=39, slot=0
java.lang.String myString pc=7, length=36, slot=2
java.lang.String rs1 pc=13, length=30, slot=3
long number2 pc=27, length=10, slot=4
Local variables for method java.lang.String executeQuery(java.lang.String)
java.lang.String query pc=0, length=2, slot=0
}
***************************************************************************************************
###@###.### 2003-05-28
###@###.### 2003-05-28
" 37 goto 43"
is mapped to line number 47, which is not correct.
Example, java code:
***************************************************************************************************
/*
Testcase: Debugger steps into forbidden code
http://www.netbeans.org/issues/show_bug.cgi?id=33921
Product Version = NetBeans IDE 3.5 RC2 (Build 200305182350)
IDE Versioning = IDE/1 spec=3.42.1 impl=200305182350
Operating System = Windows 98 version 4.10 running on x86
Java; VM; Vendor = 1.4.1; Java HotSpot(TM) Client VM 1.4.1-b21; Sun Microsystems Inc.
How to reproduce:
- Set a breakpoint on first line in test()
- Single-step [F8] through test()
Expected behavior:
- The debugger should skip the line "deleteAllSystemFiles();"
Actual behavior:
- The debugger steps onto the line "deleteAllSystemFiles();"
*/
public class DebuggerIfTrap{
public static void main(String[] args) {
try{
test();
}// try
catch(Throwable t){
t.printStackTrace();
}// catch
System.exit(0);
}// method
private final static void test(){
long number1 = 3l;
String myString = "";
String rs1 = executeQuery("SELECT * FROM MY_TABLE;");
if(next()){
close();
long number2 = 4l;
if(number2 < number1){
deleteAllSystemFiles();// The Debugger steps _onto_ this. It should not do so!
}// if
}// if()
else{
close();
}// else
}// method
public static boolean next(){
return true;
}// method
public static void close(){
}// method
public static String executeQuery(String query){
return query;
}// method
public static void deleteAllSystemFiles(){
}// method
}// class
***************************************************************************************************
Example - bytecode:
***************************************************************************************************
Compiled from DebuggerIfTrap.java
public class DebuggerIfTrap extends java.lang.Object
/* ACC_SUPER bit set */
{
public DebuggerIfTrap();
public static void main(java.lang.String[]);
private static final void test();
public static boolean next();
public static void close();
public static java.lang.String executeQuery(java.lang.String);
public static void deleteAllSystemFiles();
Method DebuggerIfTrap()
0 aload_0
1 invokespecial #1 <Method java.lang.Object.<init>()V>
4 return
Method void main(java.lang.String[])
0 invokestatic #2 <Method DebuggerIfTrap.test()V>
3 goto 14
6 astore_1
7 aload_1
8 invokevirtual #4 <Method java.lang.Throwable.printStackTrace()V>
11 goto 14
14 iconst_0
15 invokestatic #5 <Method java.lang.System.exit(I)V>
18 return
Exception table:
from to target type
0 3 6 <Class java.lang.Throwable>
Method void test()
0 ldc2_w #6 <Long 3>
3 lstore_0
4 ldc #8 <String "">
6 astore_2
7 ldc #9 <String "SELECT * FROM MY_TABLE;">
9 invokestatic #10 <Method DebuggerIfTrap.executeQuery(Ljava/lang/String;)Ljava/lang/String;>
12 astore_3
13 invokestatic #11 <Method DebuggerIfTrap.next()Z>
16 ifeq 40
19 invokestatic #12 <Method DebuggerIfTrap.close()V>
22 ldc2_w #13 <Long 4>
25 lstore 4
27 lload 4
29 lload_0
30 lcmp
31 ifge 37
34 invokestatic #15 <Method DebuggerIfTrap.deleteAllSystemFiles()V>
37 goto 43
40 invokestatic #12 <Method DebuggerIfTrap.close()V>
43 return
Method boolean next()
0 iconst_1
1 ireturn
Method void close()
0 return
Method java.lang.String executeQuery(java.lang.String)
0 aload_0
1 areturn
Method void deleteAllSystemFiles()
0 return
Line numbers for method DebuggerIfTrap()
line 26: 0
Line numbers for method void main(java.lang.String[])
line 30: 0
line 31: 3
line 33: 6
line 34: 11
line 35: 14
line 36: 18
Line numbers for method void test()
line 40: 0
line 41: 4
line 42: 7
line 43: 13
line 44: 19
line 45: 22
line 46: 27
line 47: 34
line 51: 40
line 53: 43
Line numbers for method boolean next()
line 57: 0
Line numbers for method void close()
line 61: 0
Line numbers for method java.lang.String executeQuery(java.lang.String)
line 64: 0
Line numbers for method void deleteAllSystemFiles()
line 68: 0
Local variables for method DebuggerIfTrap()
DebuggerIfTrap this pc=0, length=5, slot=0
Local variables for method void main(java.lang.String[])
java.lang.String[] args pc=0, length=19, slot=0
java.lang.Throwable t pc=7, length=7, slot=1
Local variables for method void test()
long number1 pc=4, length=39, slot=0
java.lang.String myString pc=7, length=36, slot=2
java.lang.String rs1 pc=13, length=30, slot=3
long number2 pc=27, length=10, slot=4
Local variables for method java.lang.String executeQuery(java.lang.String)
java.lang.String query pc=0, length=2, slot=0
}
***************************************************************************************************
###@###.### 2003-05-28
###@###.### 2003-05-28
- duplicates
-
JDK-5084782 Debugger steps over wrong lines
- Closed
-
JDK-5077386 TTY: JDI fires invalid StepEvent while stepping through if statements
- Closed
- relates to
-
JDK-4952629 REGRESSION: javac generates a spurious line number entry on } else {
- Resolved
-
JDK-6359542 Debugger always stepping through if and else statement blocks
- Closed