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 194371 - [70cat] Debugger execution point is not consistent with marked execution point in the display
Summary: [70cat] Debugger execution point is not consistent with marked execution poin...
Status: RESOLVED INCOMPLETE
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-14 22:26 UTC by esmithbss
Modified: 2011-02-10 15:16 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description esmithbss 2011-01-14 22:26:33 UTC
Product Version = NetBeans IDE Dev (Build 201101140000)
Operating System = Windows XP version 5.1 running on x86
Java; VM; Vendor = 1.6.0_22
Runtime = Java HotSpot(TM) Client VM 17.1-b03

When debugging my program, the Debugger appears to be 1/2 to 1 step ahead of where the expected instruction point should be within the source file.

As an example:

When stepping through the following code (DBExtractInsert.java lines 78 - 80):

    Class driverClass = Class.forName(extractDriverClassName);
    Connection jdbcConnection = DriverManager.getConnection(extractConnectionString, extractUsername, extractPassword);
    IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);

Upon stepping over the second line (line 79), the following exception is thrown from the 3rd line (line 80):

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
        at org.dbunit.database.AbstractDatabaseConnection.<clinit>(AbstractDatabaseConnection.java:51)
        at com.mastercard.gto.aps.iframework.adminconfig.activedata.util.DBExtractInsert.generateDataSet(DBExtractInsert.java:80)
        at com.mastercard.gto.aps.iframework.adminconfig.activedata.util.DBExtractInsert.main(DBExtractInsert.java:48)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        ... 3 more
Comment 1 Martin Entlicher 2011-01-14 23:16:56 UTC
Didn't you modify the sources somehow before and after you've started the debugging session? Debugger keeps a map of changed lines and translates any inserts/removals so that it shows correct line content. This can break if the initial state does not completely correspond to the binaries.
Does restart of the debugging session help?
Comment 2 esmithbss 2011-01-15 22:38:34 UTC
In this case I didn't modify the code after starting the debug session.

I was also able to reproduce this 10+ times while attempting to determine what was happening.

The key was that I needed to step over the DriverManager.getConnection call.  If I stepped into this call, I would walk through the routine and come out the other side in fine shape, but if I step over the line, it appears to execute both the getConnection and new DatabaseConnection calls.
Comment 3 Martin Entlicher 2011-02-10 15:11:59 UTC
DBExtractInsert is some proprietary code and I'm not able to reproduce such behavior on a sample project.

Would it be possible to provide some test-case that we can use to reproduce the problem? I've created following test class and stepping works fine there:

public class StepTest {
    
    public StepTest(Connection jdbcConnection) {
        throw new IllegalStateException("TEST.");
    }

    public static void main(String[] args) {
        try {
            String extractDriverClassName = Runtime.class.getName();
            String extractConnectionString = "extractConnectionString";
            String extractUsername = "extractUsername";
            String extractPassword = "extractPassword";
            Class driverClass = Class.forName(extractDriverClassName);
            Connection jdbcConnection =
        DriverManager.getConnection(extractConnectionString, extractUsername,
        extractPassword);
            StepTest connection = new StepTest(jdbcConnection);
        } catch (Exception ex) {
            Logger.getLogger(StepTest.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }
    
    private static class DriverManager {

        private static Connection getConnection(String extractConnectionString, String extractUsername, String extractPassword) {
            return new Connection() {
                <snip> empty implementation </snip>
            };
        }
        
    }
}
Comment 4 Martin Entlicher 2011-02-10 15:16:48 UTC
Also, it would be best to verify the stepping with some other debugger (e.g. JDB). Or look into the class file if it has correct debug information included.

If it's not possible to provide a sample project or verify the debug information, could you please add -J-Dorg.netbeans.modules.debugger.jpda.level=400 option to NetBeans, perform the stepping where step over steps too much and attach the resulting messages.log file to this issue? The option will log debugger steps and events.