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