Bug 227746 - Breakpoint condition "Multiple of" does not work with remote and slow VM.
Breakpoint condition "Multiple of" does not work with remote and slow VM.
Status: NEW
Product: debugger
Classification: Unclassified
Component: Java
7.3
PC Windows 7
: P3 (vote)
: 7.4
Assigned To: Martin Entlicher
issues@debugger
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-20 21:21 UTC by alexander.burdukov
Modified: 2013-03-26 17:06 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description alexander.burdukov 2013-03-20 21:21:53 UTC
Reproduced with EA version of "Oracle Java ME SDK 3.3" connected to EA version of "Oracle Java ME Embedded 3.3 for Raspberry Pi".

Note, that in this case we have a Java VM on remote and slow physical board connected to PC where NetBeans is started.

1. Use following snippet:
--------------------------------------------
package threads;

import javax.microedition.midlet.*;

public class IMlet extends MIDlet {
    public void startApp() {
        new NewThread().start();
        sleep(2); //1 sec
        new NewThread().start();
        sleep(2); //1 sec
        new NewThread().start();
        sleep(2); //1 sec
        new NewThread().start();
        exit();
    }
    
    public void pauseApp() {
    }
    
    public void destroyApp(boolean unconditional) {
    }

    private void exit() {
        destroyApp(true);
        notifyDestroyed();
    }
    
    private void sleep(long sec) {
        try {
            Thread.sleep(sec * 1000);
        } catch (InterruptedException ex) {
            ex.printStackTrace();
        }
    }
}

class NewThread extends Thread {
    private static int nr = 0;
    private int id;

    public NewThread() {
        id = nr++;
    }
    
    public void run() {
    }
}
------------------------------------------

2. Add a new thread break point:
Stop On: Thread Start, Hit count is multiple of 2, Suspend: Breakpoint thread
3. Add another breakpoint at line 14 (exit() call).
4. Debug the application.

You may find that sometimes the application stops on NewThread.run() two times,
and sometimes - only once. 

There is no "Multiple of" feature in JDWP protocol. It is emulated with "Equal to" feature, and setting new breakpoint on handling previous one. But with this approach a number of events can be missed because:
1) VM is not stopped (recommended setting is Suspend: Breakpoint thread) and continues to produce events while NetBeans handles the event
2) JDWP protocol is asynchronous. A number of ready events can be queued or being transferred already.
Comment 1 Martin Entlicher 2013-03-26 17:06:07 UTC
True. Thanks for your observation.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo