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 93842
Collapse All | Expand All

(-)debuggercore/api/apichanges.xml:1.6 (+19 lines)
Lines 181-186 Link Here
181
            </p>
181
            </p>
182
        </description>
182
        </description>
183
    </change>
183
    </change>
184
    <change>
185
        <api name="DebuggerCoreAPI"/>
186
        <summary>Support for stepping over operations.</summary>
187
        <version major="1" minor="9"/>
188
        <date day="1" month="2" year="2007"/>
189
        <author login="mentlicher"/>
190
        <compatibility>
191
            <p>
192
                Compatile change.
193
            </p>
194
        </compatibility>
195
        <description>
196
            <p>
197
                Added fields:
198
                <code>ActionsManager.ACTION_STEP_OPERATION</code>, 
199
                This constant is used in action performer which implements an operation step.
200
            </p>
201
        </description>
202
    </change>
184
203
185
</changes>
204
</changes>
186
205
(-)debuggercore/api/manifest.mf:1.13 (-1 / +1 lines)
Lines 1-5 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.api.debugger/1
2
OpenIDE-Module: org.netbeans.api.debugger/1
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/debugger/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/debugger/Bundle.properties
4
OpenIDE-Module-Specification-Version: 1.8
4
OpenIDE-Module-Specification-Version: 1.9
5
5
(-)debuggercore/api/src/org/netbeans/api/debugger/ActionsManager.java:1.21 (+3 lines)
Lines 49-54 Link Here
49
    /** Action constant for Step Out Action. */
49
    /** Action constant for Step Out Action. */
50
    public static final Object              ACTION_STEP_OUT = "stepOut";
50
    public static final Object              ACTION_STEP_OUT = "stepOut";
51
    
51
    
52
    /** Action constant for Step Operation Action. */
53
    public static final Object              ACTION_STEP_OPERATION = "stepOperation";
54
    
52
    /** Action constant for Continue Action. */
55
    /** Action constant for Continue Action. */
53
    public static final Object              ACTION_CONTINUE = "continue";
56
    public static final Object              ACTION_CONTINUE = "continue";
54
    
57
    
(-)debuggerjpda/api/apichanges.xml:1.17 (+43 lines)
Lines 422-427 Link Here
422
        <class package="org.netbeans.api.debugger.jpda" name="LineBreakpoint" />
422
        <class package="org.netbeans.api.debugger.jpda" name="LineBreakpoint" />
423
        <issue number="83188"/>
423
        <issue number="83188"/>
424
    </change>
424
    </change>
425
    <change>
426
        <api name="JPDADebuggerAPI"/>
427
        <summary>Support for stepping over operations.</summary>
428
        <version major="2" minor="9"/>
429
        <date day="1" month="2" year="2007"/>
430
        <author login="mentlicher"/>
431
        <compatibility addition="yes" source="compatible" binary="compatible"/>
432
        <description>
433
            <p>
434
                In order to be able to provide stepping over operations,
435
                we need a representation of an operation and some way how to
436
                retrieve the operation(s) from a Thread and a CallStackFrame.
437
            </p>
438
            <p>
439
                Added fields:<br/>
440
                <code>JPDAStep.STEP_OPERATION</code>,
441
                <code>EditorContext.CURRENT_LAST_OPERATION_ANNOTATION_TYPE</code>,
442
                <code>EditorContext.CURRENT_EXPRESSION_SECONDARY_LINE_ANNOTATION_TYPE</code>,
443
                <code>EditorContext.CURRENT_EXPRESSION_CURRENT_LINE_ANNOTATION_TYPE</code>
444
            </p>
445
            <p>
446
                Added methods:<br/>
447
                <code>CallStackFrame.getCurrentOperation()</code>,
448
                <code>JPDAThread.getCurrentOperation()</code>,
449
                <code>JPDAThread.getLastOperations()</code>,
450
                <code>EditorContext.createMethodOperation()</code>,
451
                <code>EditorContext.addNextOperationTo()</code>,
452
                <code>EditorContext.createPosition()</code>,
453
                <code>EditorContext.getOperations()</code>
454
            </p>
455
            <p>
456
                Added classes:<br/>
457
                <code>EditorContext.BytecodeProvider</code>,
458
                <code>EditorContext.Operation</code>,
459
                <code>EditorContext.Position</code>
460
            </p>
461
        </description>
462
        <class package="org.netbeans.api.debugger.jpda" name="JPDAStep" />
463
        <class package="org.netbeans.api.debugger.jpda" name="CallStackFrame" />
464
        <class package="org.netbeans.api.debugger.jpda" name="JPDAThread" />
465
        <class package="org.netbeans.spi.debugger.jpda" name="EditorContext" />
466
        <issue number="93842"/>
467
    </change>
425
468
426
</changes>
469
</changes>
427
470
(-)debuggerjpda/api/manifest.mf:1.19 (-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.8
4
OpenIDE-Module-Specification-Version: 2.9
5
OpenIDE-Module-Package-Dependencies: com.sun.jdi[VirtualMachineManager]
5
OpenIDE-Module-Package-Dependencies: com.sun.jdi[VirtualMachineManager]
6
6
(-)debuggerjpda/api/src/org/netbeans/api/debugger/jpda/CallStackFrame.java:1.9 (+10 lines)
Lines 22-27 Link Here
22
import com.sun.jdi.AbsentInformationException;
22
import com.sun.jdi.AbsentInformationException;
23
import java.beans.PropertyChangeListener;
23
import java.beans.PropertyChangeListener;
24
import java.util.List;
24
import java.util.List;
25
import org.netbeans.spi.debugger.jpda.EditorContext.Operation;
25
26
26
27
27
/**
28
/**
Lines 43-48 Link Here
43
     * @return line number associated with this this stack frame
44
     * @return line number associated with this this stack frame
44
     */
45
     */
45
    public abstract int getLineNumber (String struts);
46
    public abstract int getLineNumber (String struts);
47
48
    /**
49
     * Returns the current operation (if any) at the location of this call stack frame.
50
     *
51
     * @param struts a language name or null for default language
52
     * @return  The operation at the frame location if available and this frame does not
53
     *          represent a native method invocation; <CODE>null</CODE> otherwise
54
     */
55
    public abstract Operation getCurrentOperation(String struts);
46
56
47
    /**
57
    /**
48
     * Returns method name associated with this stack frame.
58
     * Returns method name associated with this stack frame.
(-)debuggerjpda/api/src/org/netbeans/api/debugger/jpda/JPDAStep.java:1.3 (+2 lines)
Lines 44-49 Link Here
44
    public static final int STEP_OUT    =   StepRequest.STEP_OUT;
44
    public static final int STEP_OUT    =   StepRequest.STEP_OUT;
45
    /** Step to the next location on a different line */
45
    /** Step to the next location on a different line */
46
    public static final int STEP_LINE   =   StepRequest.STEP_LINE;
46
    public static final int STEP_LINE   =   StepRequest.STEP_LINE;
47
    /** Step to the next available operation */
48
    public static final int STEP_OPERATION = 10;
47
    /** Step to the next available location */
49
    /** Step to the next available location */
48
    public static final int STEP_MIN    =   StepRequest.STEP_MIN;
50
    public static final int STEP_MIN    =   StepRequest.STEP_MIN;
49
    /** Property fired when the step is executed */
51
    /** Property fired when the step is executed */
(-)debuggerjpda/api/src/org/netbeans/api/debugger/jpda/JPDAThread.java:1.10 (+22 lines)
Lines 22-27 Link Here
22
import com.sun.jdi.AbsentInformationException;
22
import com.sun.jdi.AbsentInformationException;
23
import com.sun.jdi.ThreadReference;
23
import com.sun.jdi.ThreadReference;
24
import java.beans.PropertyChangeListener;
24
import java.beans.PropertyChangeListener;
25
import java.util.List;
26
import org.netbeans.spi.debugger.jpda.EditorContext;
27
import org.netbeans.spi.debugger.jpda.EditorContext.Operation;
25
28
26
29
27
/**
30
/**
Lines 82-87 Link Here
82
     * @see CallStackFrame
85
     * @see CallStackFrame
83
     */
86
     */
84
    public abstract int getLineNumber (String stratum);
87
    public abstract int getLineNumber (String stratum);
88
89
    /**
90
     * Returns the operation that is being currently executed on this thread.
91
     * @return The current operation, or <CODE>null</CODE>.
92
     * @see {@link CallStackFrame#getCurrentOperation}
93
     */
94
    public abstract Operation getCurrentOperation();
95
    
96
    /**
97
     * Returns the list of the last operations, that were performed on this thread.
98
     * Typically just operations from the current expression are stored.
99
     * The thread should be suspended at the moment this method is called.
100
     *
101
     * @return  The list of last operations if available, the thread is suspended,
102
     *          contains at least one frame and the topmost frame does not
103
     *          represent a native method invocation; <CODE>null</CODE> otherwise
104
     * @see CallStackFrame
105
     */
106
    public abstract List<Operation> getLastOperations();
85
107
86
    /**
108
    /**
87
     * Returns current state of this thread.
109
     * Returns current state of this thread.
(-)debuggerjpda/api/src/org/netbeans/spi/debugger/jpda/EditorContext.java:1.9 (+318 lines)
Lines 19-25 Link Here
19
package org.netbeans.spi.debugger.jpda;
19
package org.netbeans.spi.debugger.jpda;
20
20
21
import java.beans.PropertyChangeListener;
21
import java.beans.PropertyChangeListener;
22
import java.util.ArrayList;
23
import java.util.Collection;
24
import java.util.Collections;
25
import java.util.Iterator;
26
import java.util.List;
22
import org.netbeans.api.debugger.jpda.LineBreakpoint;
27
import org.netbeans.api.debugger.jpda.LineBreakpoint;
28
import org.netbeans.api.debugger.jpda.Variable;
23
29
24
/**
30
/**
25
 * Defines bridge to editor and src hierarchy. It allows to use different
31
 * Defines bridge to editor and src hierarchy. It allows to use different
Lines 41-46 Link Here
41
    public static final String CURRENT_LINE_ANNOTATION_TYPE = "CurrentPC";
47
    public static final String CURRENT_LINE_ANNOTATION_TYPE = "CurrentPC";
42
    /** Annotation type constant. */
48
    /** Annotation type constant. */
43
    public static final String CALL_STACK_FRAME_ANNOTATION_TYPE = "CallSite";
49
    public static final String CALL_STACK_FRAME_ANNOTATION_TYPE = "CallSite";
50
    /** Annotation type constant. */
51
    public static final String CURRENT_LAST_OPERATION_ANNOTATION_TYPE = "LastOperation";
52
    /** Annotation type constant. */
53
    public static final String CURRENT_EXPRESSION_SECONDARY_LINE_ANNOTATION_TYPE = "CurrentExpression";
54
    /** Annotation type constant. */
55
    public static final String CURRENT_EXPRESSION_CURRENT_LINE_ANNOTATION_TYPE = "CurrentExpressionLine";
44
56
45
    /** Property name constant. */
57
    /** Property name constant. */
46
    public static final String PROP_LINE_NUMBER = "lineNumber";
58
    public static final String PROP_LINE_NUMBER = "lineNumber";
Lines 100-105 Link Here
100
    );
112
    );
101
113
102
    /**
114
    /**
115
     * Adds annotation to given url on given character range.
116
     *
117
     * @param url a url of source annotation should be set into
118
     * @param startPosition the offset of the starting position of the annotation
119
     * @param endPosition the offset of the ending position of the annotation
120
     * @param annotationType a type of annotation to be set
121
122
     * @return annotation or <code>null</code>, when the annotation can not be
123
     *         created at the given URL or line number.
124
     */
125
    public Object annotate (
126
        String url, 
127
        int startPosition, 
128
        int endPosition, 
129
        String annotationType,
130
        Object timeStamp
131
    ) {
132
        return null;
133
    }
134
135
    /**
103
     * Returns line number given annotation is associated with.
136
     * Returns line number given annotation is associated with.
104
     *
137
     *
105
     * @param annotation a annotation
138
     * @param annotation a annotation
Lines 207-212 Link Here
207
    public abstract String[] getImports (String url);
240
    public abstract String[] getImports (String url);
208
    
241
    
209
    /**
242
    /**
243
     * Creates an operation which is determined by starting and ending position.
244
     *
245
    protected final Operation createOperation(Position startPosition,
246
                                              Position endPosition,
247
                                              int bytecodeIndex) {
248
        return new Operation(startPosition, endPosition, bytecodeIndex);
249
    }
250
     */
251
    
252
    /**
253
     * Creates a method operation.
254
     * @param startPosition The starting position of the operation
255
     * @param endPosition The ending position of the operation
256
     * @param methodStartPosition The starting position of the method name
257
     * @param methodEndPosition The ending position of the method name
258
     * @param methodName The string representation of the method name
259
     * @param methodClassType The class type, which defines this method
260
     * @param bytecodeIndex The bytecode index of this method call
261
     */
262
    protected final Operation createMethodOperation(Position startPosition,
263
                                                    Position endPosition,
264
                                                    Position methodStartPosition,
265
                                                    Position methodEndPosition,
266
                                                    String methodName,
267
                                                    String methodClassType,
268
                                                    int bytecodeIndex) {
269
        return new Operation(startPosition, endPosition,
270
                             methodStartPosition, methodEndPosition,
271
                             methodName, methodClassType, bytecodeIndex);
272
    }
273
    
274
    /**
275
     * Assign a next operation, concatenates operations.
276
     * @param operation The first operation
277
     * @param next The next operation
278
     */
279
    protected final void addNextOperationTo(Operation operation, Operation next) {
280
        operation.addNextOperation(next);
281
    }
282
    
283
    /**
284
     * Creates a new {@link Position} object.
285
     * @param offset The offset
286
     * @param line The line number
287
     * @param column The column number
288
     */
289
    protected final Position createPosition(
290
            int offset, int line, int column) {
291
        
292
        return new Position(offset, line, column);
293
    }
294
    
295
    /**
296
     * Get the list of operations that are in expression(s) located at the given line.
297
     * @param url The file's URL
298
     * @param lineNumber The line number
299
     * @param bytecodeProvider The provider of method bytecodes.
300
     */
301
    public Operation[] getOperations(String url, int lineNumber,
302
                                     BytecodeProvider bytecodeProvider) {
303
        throw new UnsupportedOperationException("This method is not implemented.");
304
    }
305
    
306
    /**
210
     * Adds a property change listener.
307
     * Adds a property change listener.
211
     *
308
     *
212
     * @param l the listener to add
309
     * @param l the listener to add
Lines 241-245 Link Here
241
        String propertyName,
338
        String propertyName,
242
        PropertyChangeListener l
339
        PropertyChangeListener l
243
    );
340
    );
341
    
342
    /**
343
     * A provider of method bytecode information.
344
     */
345
    public interface BytecodeProvider {
346
        
347
        /**
348
         * Retrieve the class' constant pool.
349
         */
350
        byte[] constantPool();
351
        
352
        /**
353
         * Retrieve the bytecodes of the method.
354
         */
355
        byte[] byteCodes();
356
        
357
        /**
358
         * Get an array of bytecode indexes of operations between the starting
359
         * and ending line.
360
         * @param startLine The starting line
361
         * @param endLine The ending line
362
         */
363
        int[] indexAtLines(int startLine, int endLine);
364
        
365
    }
366
    
367
    /**
368
     * The operation definition.
369
     */
370
    public static final class Operation {
371
        
372
        private final Position startPosition;
373
        private final Position endPosition;
374
        private final int bytecodeIndex;
375
376
        private Position methodStartPosition;
377
        private Position methodEndPosition;
378
        private String methodName;
379
        private String methodClassType;
380
        private Variable returnValue;
381
        
382
        private List<Operation> nextOperations;
383
        
384
        /*
385
        Operation(Position startPosition, Position endPosition,
386
                  int bytecodeIndex) {
387
            this.startPosition = startPosition;
388
            this.endPosition = endPosition;
389
            this.bytecodeIndex = bytecodeIndex;
390
        }
391
         */
392
        
393
        /**
394
         * Creates a new method operation.
395
         */
396
        Operation(Position startPosition, Position endPosition,
397
                  Position methodStartPosition, Position methodEndPosition,
398
                  String methodName, String methodClassType,
399
                  int bytecodeIndex) {
400
            this.startPosition = startPosition;
401
            this.endPosition = endPosition;
402
            this.bytecodeIndex = bytecodeIndex;
403
            this.methodStartPosition = methodStartPosition;
404
            this.methodEndPosition = methodEndPosition;
405
            this.methodName = methodName;
406
            this.methodClassType = methodClassType;
407
        }
408
        
409
        synchronized void addNextOperation(Operation next) {
410
            if (nextOperations == null) {
411
                nextOperations = new ArrayList<Operation>();
412
            }
413
            nextOperations.add(next);
414
        }
415
        
416
        /**
417
         * Get the starting position of this operation.
418
         */
419
        public Position getStartPosition() {
420
            return startPosition;
421
        }
422
        
423
        /**
424
         * Get the ending position of this operation.
425
         */
426
        public Position getEndPosition() {
427
            return endPosition;
428
        }
429
        
430
        /**
431
         * Get the starting position of the method call of this operation.
432
         */
433
        public Position getMethodStartPosition() {
434
            return methodStartPosition;
435
        }
436
437
        /**
438
         * Get the ending position of the method call of this operation.
439
         */
440
        public Position getMethodEndPosition() {
441
            return methodEndPosition;
442
        }
443
444
        /**
445
         * Get the method name.
446
         */
447
        public String getMethodName() {
448
            return methodName;
449
        }
450
        
451
        /**
452
         * Get the class type declaring the method.
453
         */
454
        public String getMethodClassType() {
455
            return methodClassType;
456
        }
457
        
458
        /**
459
         * Get the bytecode index of this operation.
460
         */
461
        public int getBytecodeIndex() {
462
            return bytecodeIndex;
463
        }
464
465
        /**
466
         * Set the return value of this operation.
467
         */
468
        public void setReturnValue(Variable returnValue) {
469
            this.returnValue = returnValue;
470
        }
471
        
472
        /**
473
         * Get the return value of this operation.
474
         */
475
        public Variable getReturnValue() {
476
            return returnValue;
477
        }
478
        
479
        /**
480
         * Get the list of following operations.
481
         */
482
        public List<Operation> getNextOperations() {
483
            if (nextOperations == null) {
484
                return Collections.emptyList();
485
            } else {
486
                synchronized (this) {
487
                    return Collections.unmodifiableList(nextOperations);
488
                }
489
            }
490
        }
491
492
        public boolean equals(Object obj) {
493
            if (obj instanceof Operation) {
494
                Operation op2 = (Operation) obj;
495
                return bytecodeIndex == op2.bytecodeIndex &&
496
                        ((startPosition == null) ?
497
                            op2.startPosition == null :
498
                            startPosition.equals(op2.startPosition)) &&
499
                        ((endPosition == null) ?
500
                            op2.endPosition == null :
501
                            endPosition.equals(op2.endPosition));
502
            }
503
            return false;
504
        }
505
506
        public int hashCode() {
507
            return bytecodeIndex;
508
        }
509
510
    }
511
    
512
    /**
513
     * Representation of a position in a source code.
514
     */
515
    public static final class Position {
516
517
        private final int offset;
518
        private final int line;
519
        private final int column;
520
521
        Position(int offset, int line, int column) {
522
            this.offset = offset;
523
            this.line = line;
524
            this.column = column;
525
        }
526
527
        /**
528
         * Get the offset of this position.
529
         */
530
        public int getOffset() {
531
            return offset;
532
        }
533
534
        /**
535
         * Get the line number of this position.
536
         */
537
        public int getLine() {
538
            return line;
539
        }
540
541
        /**
542
         * Get the column number of this position.
543
         */
544
        public int getColumn() {
545
            return column;
546
        }
547
548
        public boolean equals(Object obj) {
549
            if (obj instanceof Position) {
550
                Position pos = (Position) obj;
551
                return pos.offset == offset;
552
            }
553
            return false;
554
        }
555
556
        public int hashCode() {
557
            return offset;
558
        }
559
        
560
    }
561
244
}
562
}
245
563

Return to bug 93842