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.

View | Details | Raw Unified | Return to bug 226029
Collapse All | Expand All

(-)a/api.debugger.jpda/apichanges.xml (+15 lines)
Lines 801-806 Link Here
801
        <issue number="215680"/>
801
        <issue number="215680"/>
802
    </change>
802
    </change>
803
803
804
    <change>
805
        <api name="JPDADebuggerAPI"/>
806
        <summary>Breakpoints can be made session-specific.</summary>
807
        <version major="2" minor="41"/>
808
        <date day="20" month="2" year="2013"/>
809
        <author login="mentlicher"/>
810
        <compatibility addition="yes" source="compatible" binary="compatible"/>
811
        <description>
812
            getSession()/setSession() methods are added to JPDABreakpoint class.
813
            They can be used to make the breakpoint debugger session-specific.
814
        </description>
815
        <class package="org.netbeans.api.debugger.jpda" name="JPDABreakpoint" />
816
        <issue number="226029"/>
817
    </change>
818
804
819
805
</changes>
820
</changes>
806
821
(-)a/api.debugger.jpda/manifest.mf (-1 / +1 lines)
Lines 1-6 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.api.debugger.jpda/2
2
OpenIDE-Module: org.netbeans.api.debugger.jpda/2
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/debugger/jpda/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/debugger/jpda/Bundle.properties
4
OpenIDE-Module-Specification-Version: 2.40
4
OpenIDE-Module-Specification-Version: 2.41
5
OpenIDE-Module-Package-Dependencies: com.sun.jdi[VirtualMachineManager]
5
OpenIDE-Module-Package-Dependencies: com.sun.jdi[VirtualMachineManager]
6
6
(-)a/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/JPDABreakpoint.java (-5 / +5 lines)
Lines 98-104 Link Here
98
    private int                         suspend;
98
    private int                         suspend;
99
    private String                      printText;
99
    private String                      printText;
100
    private Collection<JPDABreakpointListener>  breakpointListeners = new HashSet<JPDABreakpointListener>();
100
    private Collection<JPDABreakpointListener>  breakpointListeners = new HashSet<JPDABreakpointListener>();
101
    private JPDADebugger                session;
101
    private volatile JPDADebugger       session;
102
    private List<DebuggerEngine> engines = new ArrayList<DebuggerEngine>();
102
    private List<DebuggerEngine> engines = new ArrayList<DebuggerEngine>();
103
    
103
    
104
   
104
   
Lines 234-242 Link Here
234
     * This will make the breakpoint session-specific
234
     * This will make the breakpoint session-specific
235
     *
235
     *
236
     * @param session the specific session
236
     * @param session the specific session
237
     * @since 2.41
237
     */
238
     */
238
    // TODO: make this public API
239
    public void setSession(JPDADebugger session) {
239
    synchronized void setSession(JPDADebugger session) {
240
        this.session = session;
240
        this.session = session;
241
    }
241
    }
242
242
Lines 246-254 Link Here
246
     * and is discarded after this session finishes.
246
     * and is discarded after this session finishes.
247
     *
247
     *
248
     * @return the specific session or <code>null</code>.
248
     * @return the specific session or <code>null</code>.
249
     * @since 2.41
249
     */
250
     */
250
    // TODO: make this public API
251
    public JPDADebugger getSession() {
251
    synchronized JPDADebugger getSession() {
252
        return session;
252
        return session;
253
    }
253
    }
254
254
(-)a/debugger.jpda.ui/nbproject/project.xml (-1 / +1 lines)
Lines 63-69 Link Here
63
                    <build-prerequisite/>
63
                    <build-prerequisite/>
64
                    <compile-dependency/>
64
                    <compile-dependency/>
65
                    <run-dependency>
65
                    <run-dependency>
66
                        <release-version>2</release-version>
66
                        <release-version>2.41</release-version>
67
                    </run-dependency>
67
                    </run-dependency>
68
                </dependency>
68
                </dependency>
69
                <dependency>
69
                <dependency>
(-)a/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/actions/RunToCursorActionProvider.java (-8 / +1 lines)
Lines 152-165 Link Here
152
        if (currentThread != null) {
152
        if (currentThread != null) {
153
            breakpoint.setThreadFilters(debugger, new JPDAThread[] { currentThread });
153
            breakpoint.setThreadFilters(debugger, new JPDAThread[] { currentThread });
154
        }
154
        }
155
        // TODO: mb.setSession(debugger);
155
        breakpoint.setSession(debugger);
156
        try {
157
            java.lang.reflect.Method setSessionMethod = JPDABreakpoint.class.getDeclaredMethod("setSession", JPDADebugger.class);
158
            setSessionMethod.setAccessible(true);
159
            setSessionMethod.invoke(breakpoint, debugger);
160
        } catch (Exception ex) {
161
            org.openide.util.Exceptions.printStackTrace(ex);
162
        }
163
        DebuggerManager.getDebuggerManager ().addBreakpoint (breakpoint);
156
        DebuggerManager.getDebuggerManager ().addBreakpoint (breakpoint);
164
        if (currentThread != null) {
157
        if (currentThread != null) {
165
            currentThread.resume();
158
            currentThread.resume();
(-)a/debugger.jpda/nbproject/project.xml (-1 / +1 lines)
Lines 64-70 Link Here
64
                    <compile-dependency/>
64
                    <compile-dependency/>
65
                    <run-dependency>
65
                    <run-dependency>
66
                        <release-version>2</release-version>
66
                        <release-version>2</release-version>
67
                        <specification-version>2.37</specification-version>
67
                        <specification-version>2.41</specification-version>
68
                    </run-dependency>
68
                    </run-dependency>
69
                </dependency>
69
                </dependency>
70
                <dependency>
70
                <dependency>
(-)a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/JPDAStepImpl.java (-8 / +1 lines)
Lines 341-354 Link Here
341
                mb.setSuspend(JPDABreakpoint.SUSPEND_NONE);
341
                mb.setSuspend(JPDABreakpoint.SUSPEND_NONE);
342
                lastMethodExitBreakpointListener = new MethodExitBreakpointListener(mb);
342
                lastMethodExitBreakpointListener = new MethodExitBreakpointListener(mb);
343
                mb.addJPDABreakpointListener(lastMethodExitBreakpointListener);
343
                mb.addJPDABreakpointListener(lastMethodExitBreakpointListener);
344
                // TODO: mb.setSession(debugger);
344
                mb.setSession(debugger);
345
                try {
346
                    java.lang.reflect.Method setSessionMethod = JPDABreakpoint.class.getDeclaredMethod("setSession", JPDADebugger.class);
347
                    setSessionMethod.setAccessible(true);
348
                    setSessionMethod.invoke(mb, debugger);
349
                } catch (Exception ex) {
350
                    org.openide.util.Exceptions.printStackTrace(ex);
351
                }
352
                DebuggerManager.getDebuggerManager().addBreakpoint(mb);
345
                DebuggerManager.getDebuggerManager().addBreakpoint(mb);
353
            }
346
            }
354
        }
347
        }
(-)a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/actions/RunIntoMethodActionProvider.java (-8 / +1 lines)
Lines 265-278 Link Here
265
                    doAction(url, event.getReferenceType(), methodLine, methodOffset, method, false);
265
                    doAction(url, event.getReferenceType(), methodLine, methodOffset, method, false);
266
                }
266
                }
267
            });
267
            });
268
            // TODO: cbrkp.setSession(debugger);
268
            cbrkp.setSession(debugger);
269
            try {
270
                java.lang.reflect.Method setSessionMethod = JPDABreakpoint.class.getDeclaredMethod("setSession", JPDADebugger.class);
271
                setSessionMethod.setAccessible(true);
272
                setSessionMethod.invoke(cbrkp, debugger);
273
            } catch (Exception ex) {
274
                Exceptions.printStackTrace(ex);
275
            }
276
            DebuggerManager.getDebuggerManager().addBreakpoint(cbrkp);
269
            DebuggerManager.getDebuggerManager().addBreakpoint(cbrkp);
277
            resume(debugger);
270
            resume(debugger);
278
        }
271
        }
(-)a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/actions/StepActionProvider.java (-8 / +1 lines)
Lines 331-344 Link Here
331
        mb.setThreadFilters(getDebuggerImpl(), new JPDAThread[] { jtr });
331
        mb.setThreadFilters(getDebuggerImpl(), new JPDAThread[] { jtr });
332
        lastMethodExitBreakpointListener = new MethodExitBreakpointListener(mb);
332
        lastMethodExitBreakpointListener = new MethodExitBreakpointListener(mb);
333
        mb.addJPDABreakpointListener(lastMethodExitBreakpointListener);
333
        mb.addJPDABreakpointListener(lastMethodExitBreakpointListener);
334
        // TODO: mb.setSession(debugger);
334
        mb.setSession(debugger);
335
        try {
336
            java.lang.reflect.Method setSessionMethod = JPDABreakpoint.class.getDeclaredMethod("setSession", JPDADebugger.class);
337
            setSessionMethod.setAccessible(true);
338
            setSessionMethod.invoke(mb, debugger);
339
        } catch (Exception ex) {
340
            Exceptions.printStackTrace(ex);
341
        }
342
        DebuggerManager.getDebuggerManager().addBreakpoint(mb);
335
        DebuggerManager.getDebuggerManager().addBreakpoint(mb);
343
    }
336
    }
344
    
337
    
(-)a/debugger.jpda/src/org/netbeans/modules/debugger/jpda/breakpoints/BreakpointsEngineListener.java (-20 / +2 lines)
Lines 277-292 Link Here
277
            boolean removed = removeBreakpointImpl (bs [i]);
277
            boolean removed = removeBreakpointImpl (bs [i]);
278
            if (removed && bs[i] instanceof JPDABreakpoint) {
278
            if (removed && bs[i] instanceof JPDABreakpoint) {
279
                JPDABreakpoint jb = (JPDABreakpoint) bs[i];
279
                JPDABreakpoint jb = (JPDABreakpoint) bs[i];
280
                // TODO: JPDADebugger bDebugger = jb.getSession();
280
                JPDADebugger bDebugger = jb.getSession();
281
                JPDADebugger bDebugger;
282
                try {
283
                    java.lang.reflect.Method getSessionMethod = JPDABreakpoint.class.getDeclaredMethod("getSession");
284
                    getSessionMethod.setAccessible(true);
285
                    bDebugger = (JPDADebugger) getSessionMethod.invoke(jb);
286
                } catch (Exception ex) {
287
                    bDebugger = null;
288
                    Exceptions.printStackTrace(ex);
289
                }
290
                if (bDebugger != null && bDebugger.equals(debugger)) {
281
                if (bDebugger != null && bDebugger.equals(debugger)) {
291
                    // A hidden breakpoint submitted just for this one session. Remove it with the end of the session.
282
                    // A hidden breakpoint submitted just for this one session. Remove it with the end of the session.
292
                    DebuggerManager.getDebuggerManager ().removeBreakpoint(jb);
283
                    DebuggerManager.getDebuggerManager ().removeBreakpoint(jb);
Lines 317-332 Link Here
317
        synchronized (breakpointToImpl) {
308
        synchronized (breakpointToImpl) {
318
            if (breakpointToImpl.containsKey (b)) return;
309
            if (breakpointToImpl.containsKey (b)) return;
319
            if (!(b instanceof JPDABreakpoint)) return ;
310
            if (!(b instanceof JPDABreakpoint)) return ;
320
            JPDADebugger bDebugger;
311
            JPDADebugger bDebugger = ((JPDABreakpoint) b).getSession();
321
            try {
322
                // TODO: bDebugger = ((JPDADebugger) b).getSession();
323
                java.lang.reflect.Method getSessionMethod = JPDABreakpoint.class.getDeclaredMethod("getSession");
324
                getSessionMethod.setAccessible(true);
325
                bDebugger = (JPDADebugger) getSessionMethod.invoke(b);
326
            } catch (Exception ex) {
327
                bDebugger = null;
328
                Exceptions.printStackTrace(ex);
329
            }
330
            if (bDebugger != null && !bDebugger.equals(debugger)) {
312
            if (bDebugger != null && !bDebugger.equals(debugger)) {
331
                return ;
313
                return ;
332
            }
314
            }

Return to bug 226029