annotate truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/package-info.java @ 22104:cf19259edf87

TruffleVM.eval and Source.withMimeType
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Mon, 24 Aug 2015 08:46:21 +0200
parents c0d4ec7e69c0
children b31dcacfc8ff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22008
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
1 /*
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
4 *
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation. Oracle designates this
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
8 * particular file as subject to the "Classpath" exception as provided
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
9 * by Oracle in the LICENSE file that accompanied this code.
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
10 *
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
11 * This code is distributed in the hope that it will be useful, but WITHOUT
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
14 * version 2 for more details (a copy is included in the LICENSE file that
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
15 * accompanied this code).
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
16 *
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License version
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
18 * 2 along with this work; if not, write to the Free Software Foundation,
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
20 *
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
22 * or visit www.oracle.com if you need additional information or have any
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
23 * questions.
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
24 */
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
25
22060
c0d4ec7e69c0 Properly classifying the API packages
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22050
diff changeset
26 /*
c0d4ec7e69c0 Properly classifying the API packages
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22050
diff changeset
27 @ApiInfo(
c0d4ec7e69c0 Properly classifying the API packages
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22050
diff changeset
28 group="Stable"
c0d4ec7e69c0 Properly classifying the API packages
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22050
diff changeset
29 )
c0d4ec7e69c0 Properly classifying the API packages
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22050
diff changeset
30 */
c0d4ec7e69c0 Properly classifying the API packages
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22050
diff changeset
31
22008
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
32 /**
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
33 * Control over {@link com.oracle.truffle.api.debug.Debugger debugging} of your {@link com.oracle.truffle.api.vm.TruffleVM}. Each {@link com.oracle.truffle.api.vm.TruffleVM}
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
34 * is inherently capable to run in debugging mode - there is just one thing
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
35 * to do - the {@link com.oracle.truffle.api.vm.TruffleVM.Builder creator of the virtual machine}
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
36 * needs to turn debugging on when constructing its Truffle virtual machine:
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
37 * <pre>
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
38 * vm = {@link com.oracle.truffle.api.vm.TruffleVM#newVM()}.
22050
7a5b874b8d12 Fix checkstyle problems
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22008
diff changeset
39 * {@link com.oracle.truffle.api.vm.TruffleVM.Builder#onEvent(com.oracle.truffle.api.vm.EventConsumer) onEvent}(<b>new</b> {@link com.oracle.truffle.api.vm.EventConsumer EventConsumer}
7a5b874b8d12 Fix checkstyle problems
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22008
diff changeset
40 * {@code <}{@link com.oracle.truffle.api.debug.ExecutionEvent}{@code >}() {
22008
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
41 * <b>public void</b> handle({@link com.oracle.truffle.api.debug.ExecutionEvent} ev) {
22104
cf19259edf87 TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22060
diff changeset
42 * <em>// configure the virtual machine as {@link com.oracle.truffle.api.vm.TruffleVM#eval(com.oracle.truffle.api.source.Source) new execution} is starting</em>
22008
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
43 * }
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
44 * }).
22050
7a5b874b8d12 Fix checkstyle problems
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22008
diff changeset
45 * {@link com.oracle.truffle.api.vm.TruffleVM.Builder#onEvent(com.oracle.truffle.api.vm.EventConsumer) onEvent}(<b>new</b> {@link com.oracle.truffle.api.vm.EventConsumer EventConsumer}{@code <}
7a5b874b8d12 Fix checkstyle problems
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22008
diff changeset
46 * {@link com.oracle.truffle.api.debug.SuspendedEvent}{@code >}() {
22008
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
47 * <b>public void</b> handle({@link com.oracle.truffle.api.debug.SuspendedEvent} ev) {
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
48 * <em>// execution is suspended on a breakpoint or on a step - decide what next</em>
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
49 * }
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
50 * }).{@link com.oracle.truffle.api.vm.TruffleVM.Builder#build() build()};
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
51 * </pre>
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
52 * The debugging is controlled by events emitted by the Truffle virtual machine
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
53 * at important moments. The {@link com.oracle.truffle.api.debug.ExecutionEvent}
22104
cf19259edf87 TruffleVM.eval and Source.withMimeType
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22060
diff changeset
54 * is sent when a call to {@link com.oracle.truffle.api.vm.TruffleVM#eval(com.oracle.truffle.api.source.Source)}
22008
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
55 * is made and allows one to configure {@link com.oracle.truffle.api.debug.Breakpoint breakpoints} and/or decide whether the
22050
7a5b874b8d12 Fix checkstyle problems
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22008
diff changeset
56 * program should {@link com.oracle.truffle.api.debug.ExecutionEvent#prepareStepInto() step-into} or
22008
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
57 * {@link com.oracle.truffle.api.debug.ExecutionEvent#prepareContinue() just run}. Once the execution is suspended a
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
58 * {@link com.oracle.truffle.api.debug.SuspendedEvent} is generated which
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
59 * allows one to inspect the stack and choose the further execution mode
22050
7a5b874b8d12 Fix checkstyle problems
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22008
diff changeset
60 * ({@link com.oracle.truffle.api.debug.SuspendedEvent#prepareStepInto(int) step-into}, {@link com.oracle.truffle.api.debug.SuspendedEvent#prepareStepOver(int) step-over},
7a5b874b8d12 Fix checkstyle problems
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22008
diff changeset
61 * {@link com.oracle.truffle.api.debug.SuspendedEvent#prepareStepOut() step-out}, {@link com.oracle.truffle.api.debug.SuspendedEvent#prepareContinue() continue}).
22008
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
62 * <p>
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
63 * The events methods are only available when the event is being delivered and
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
64 * shouldn't be used anytime later. Both events however provide access to
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
65 * {@link com.oracle.truffle.api.debug.Debugger} which can be kept and used
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
66 * during whole existence of the {@link com.oracle.truffle.api.vm.TruffleVM}.
22050
7a5b874b8d12 Fix checkstyle problems
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22008
diff changeset
67 * {@link com.oracle.truffle.api.debug.Debugger} is the central class that
22008
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
68 * keeps information about {@link com.oracle.truffle.api.debug.Debugger#getBreakpoints() registered breakpoints}
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
69 * and allows one create new {@link com.oracle.truffle.api.debug.Breakpoint ones}.
22050
7a5b874b8d12 Fix checkstyle problems
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22008
diff changeset
70 *
22008
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
71 * <h4>Turning on Stepping Mode</h4>
22050
7a5b874b8d12 Fix checkstyle problems
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22008
diff changeset
72 *
22008
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
73 * In case you want your execution to pause on first statement, register for
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
74 * {@link com.oracle.truffle.api.debug.ExecutionEvent} and once delivered
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
75 * call {@link com.oracle.truffle.api.debug.ExecutionEvent#prepareStepInto()}.
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
76 *
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
77 * <h4>Register a {@link com.oracle.truffle.api.debug.Breakpoint}</h4>
22050
7a5b874b8d12 Fix checkstyle problems
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22008
diff changeset
78 *
22008
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
79 * Wait for execution to be started - which generates an
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
80 * {@link com.oracle.truffle.api.debug.ExecutionEvent}. Use its
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
81 * {@link com.oracle.truffle.api.debug.Debugger ev.getDebugger}()
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
82 * methods to submit breakpoints.
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
83 */
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
84 package com.oracle.truffle.api.debug;
02e4cf046653 Providing a bit more meaningful documentation to our recent debugging improvements
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff changeset
85