annotate truffle/com.oracle.truffle.tools.debug.shell/src/com/oracle/truffle/tools/debug/shell/server/REPLHandler.java @ 22475:c434681cd164

Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Mon, 07 Dec 2015 18:21:03 -0800
parents a6c162686d81
children 4a83dc15e774
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
1 /*
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
4 *
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation. Oracle designates this
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
8 * particular file as subject to the "Classpath" exception as provided
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
9 * by Oracle in the LICENSE file that accompanied this code.
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
10 *
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
11 * This code is distributed in the hope that it will be useful, but WITHOUT
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
14 * version 2 for more details (a copy is included in the LICENSE file that
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
15 * accompanied this code).
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
16 *
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License version
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
18 * 2 along with this work; if not, write to the Free Software Foundation,
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
20 *
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
22 * or visit www.oracle.com if you need additional information or have any
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
23 * questions.
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
24 */
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
25 package com.oracle.truffle.tools.debug.shell.server;
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
26
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
27 import java.io.IOException;
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
28 import java.util.ArrayList;
22448
1c3deda60a9e Truffle/Debugging: the REPL debugger now remembers breakpoint requests it receives from the command line client when there have been no executions yet (which means breakpoints cannot be set in the engine/debugger). When the first execution event arrives (with a reference to the Debugger), any "pending" breakpoints are created with the Debugger. This involved a bit of refactoring on the Breakpoint class hierarchy.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22444
diff changeset
29 import java.util.Collection;
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
30 import java.util.List;
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
31
22471
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
32 import com.oracle.truffle.api.debug.FrameDebugDescription;
22157
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
33 import com.oracle.truffle.api.frame.Frame;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
34 import com.oracle.truffle.api.frame.FrameSlot;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
35 import com.oracle.truffle.api.instrument.ASTPrinter;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
36 import com.oracle.truffle.api.instrument.KillException;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
37 import com.oracle.truffle.api.instrument.QuitException;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
38 import com.oracle.truffle.api.instrument.StandardSyntaxTag;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
39 import com.oracle.truffle.api.instrument.Visualizer;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
40 import com.oracle.truffle.api.nodes.Node;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
41 import com.oracle.truffle.api.source.Source;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
42 import com.oracle.truffle.api.source.SourceSection;
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
43 import com.oracle.truffle.api.vm.PolyglotEngine.Language;
22157
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
44 import com.oracle.truffle.tools.debug.shell.REPLMessage;
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
45 import com.oracle.truffle.tools.debug.shell.server.REPLServer.BreakpointInfo;
22447
a8b796ac350d Truffle/REPL: upate to use new support for "eval"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22444
diff changeset
46 import com.oracle.truffle.tools.debug.shell.server.REPLServer.Context;
22442
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
47
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
48 /**
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
49 * Server-side REPL implementation of an {@linkplain REPLMessage "op"}.
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
50 * <p>
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
51 * The language-agnostic handlers are implemented here.
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
52 */
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
53 public abstract class REPLHandler {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
54
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
55 // TODO (mlvdv) add support for setting/using ignore count
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
56 private static final int DEFAULT_IGNORE_COUNT = 0;
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
57
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
58 private final String op;
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
59
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
60 protected REPLHandler(String op) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
61 this.op = op;
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
62 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
63
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
64 /**
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
65 * Gets the "op" implemented by this handler.
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
66 */
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
67 final String getOp() {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
68 return op;
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
69 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
70
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
71 /**
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
72 * Passes a request to this handler.
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
73 */
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
74 abstract REPLMessage[] receive(REPLMessage request, REPLServer replServer);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
75
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
76 /**
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
77 * Creates skeleton for a reply message that identifies the operation currently being handled.
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
78 */
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
79 REPLMessage createReply() {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
80 return new REPLMessage(REPLMessage.OP, op);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
81 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
82
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
83 /**
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
84 * Completes a reply, reporting and explaining successful handling.
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
85 */
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
86 protected static final REPLMessage[] finishReplySucceeded(REPLMessage reply, String explanation) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
87 reply.put(REPLMessage.STATUS, REPLMessage.SUCCEEDED);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
88 reply.put(REPLMessage.DISPLAY_MSG, explanation);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
89 final REPLMessage[] replies = new REPLMessage[]{reply};
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
90 return replies;
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
91 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
92
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
93 /**
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
94 * Completes a reply, reporting and explaining failed handling.
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
95 */
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
96 protected static final REPLMessage[] finishReplyFailed(REPLMessage reply, String explanation) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
97 reply.put(REPLMessage.STATUS, REPLMessage.FAILED);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
98 reply.put(REPLMessage.DISPLAY_MSG, explanation);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
99 final REPLMessage[] replies = new REPLMessage[]{reply};
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
100 return replies;
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
101 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
102
22442
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
103 protected static final REPLMessage[] finishReplyFailed(REPLMessage reply, Exception ex) {
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
104 reply.put(REPLMessage.STATUS, REPLMessage.FAILED);
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
105 String message = ex.getMessage();
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
106 reply.put(REPLMessage.DISPLAY_MSG, message == null ? ex.getClass().getSimpleName() : message);
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
107 final REPLMessage[] replies = new REPLMessage[]{reply};
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
108 return replies;
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
109 }
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
110
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
111 protected static final REPLMessage createBreakpointInfoMessage(BreakpointInfo info) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
112 final REPLMessage infoMessage = new REPLMessage(REPLMessage.OP, REPLMessage.BREAKPOINT_INFO);
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
113 infoMessage.put(REPLMessage.BREAKPOINT_ID, Integer.toString(info.getID()));
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
114 infoMessage.put(REPLMessage.BREAKPOINT_STATE, info.describeState());
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
115 infoMessage.put(REPLMessage.BREAKPOINT_HIT_COUNT, Integer.toString(info.getHitCount()));
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
116 infoMessage.put(REPLMessage.BREAKPOINT_IGNORE_COUNT, Integer.toString(info.getIgnoreCount()));
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
117 infoMessage.put(REPLMessage.INFO_VALUE, info.describeLocation());
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
118 if (info.getCondition() != null) {
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
119 infoMessage.put(REPLMessage.BREAKPOINT_CONDITION, info.getCondition());
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
120 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
121 infoMessage.put(REPLMessage.STATUS, REPLMessage.SUCCEEDED);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
122 return infoMessage;
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
123 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
124
22471
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
125 protected static final REPLMessage createFrameInfoMessage(final REPLServer replServer, int number, Node node) {
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
126 final Visualizer visualizer = replServer.getVisualizer();
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
127 final REPLMessage infoMessage = new REPLMessage(REPLMessage.OP, REPLMessage.FRAME_INFO);
22471
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
128 infoMessage.put(REPLMessage.FRAME_NUMBER, Integer.toString(number));
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
129 infoMessage.put(REPLMessage.SOURCE_LOCATION, visualizer.displaySourceLocation(node));
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
130 infoMessage.put(REPLMessage.METHOD_NAME, visualizer.displayMethodName(node));
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
131
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
132 if (node != null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
133 SourceSection section = node.getSourceSection();
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
134 if (section == null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
135 section = node.getEncapsulatingSourceSection();
22003
5bc7f7b867ab Making debugger always on for each TruffleVM execution. Introducing EventConsumer to process such debugger events. Requesting each RootNode to be associated with a TruffleLanguage, so debugger can find out proper context for each Node where executions gets suspended.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
136 }
22468
64658afaf9c0 Truffle/REPL debugger: add "loads" and "evals" commands that "step into"; default is now not to step into
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22466
diff changeset
137 if (section != null && section.getSource() != null) {
22003
5bc7f7b867ab Making debugger always on for each TruffleVM execution. Introducing EventConsumer to process such debugger events. Requesting each RootNode to be associated with a TruffleLanguage, so debugger can find out proper context for each Node where executions gets suspended.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
138 infoMessage.put(REPLMessage.FILE_PATH, section.getSource().getPath());
5bc7f7b867ab Making debugger always on for each TruffleVM execution. Introducing EventConsumer to process such debugger events. Requesting each RootNode to be associated with a TruffleLanguage, so debugger can find out proper context for each Node where executions gets suspended.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
139 infoMessage.put(REPLMessage.LINE_NUMBER, Integer.toString(section.getStartLine()));
5bc7f7b867ab Making debugger always on for each TruffleVM execution. Introducing EventConsumer to process such debugger events. Requesting each RootNode to be associated with a TruffleLanguage, so debugger can find out proper context for each Node where executions gets suspended.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
140 infoMessage.put(REPLMessage.SOURCE_LINE_TEXT, section.getSource().getCode(section.getStartLine()));
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
141 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
142 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
143 infoMessage.put(REPLMessage.STATUS, REPLMessage.SUCCEEDED);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
144 return infoMessage;
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
145 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
146
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
147 public static final REPLHandler BACKTRACE_HANDLER = new REPLHandler(REPLMessage.BACKTRACE) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
148
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
149 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
150 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
22471
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
151 final Visualizer visualizer = replServer.getVisualizer();
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
152 final ArrayList<REPLMessage> replies = new ArrayList<>();
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
153 final List<FrameDebugDescription> stack = replServer.getCurrentContext().getStack();
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
154
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
155 for (int i = 0; i < stack.size(); i++) {
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
156 replies.add(btMessage(i, stack.get(i).node(), visualizer));
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
157 }
22471
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
158 if (replies.size() > 0) {
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
159 return replies.toArray(new REPLMessage[0]);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
160 }
22471
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
161 return finishReplyFailed(new REPLMessage(REPLMessage.OP, REPLMessage.BACKTRACE), "No stack");
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
162 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
163 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
164
22471
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
165 private static REPLMessage btMessage(int index, Node node, Visualizer visualizer) {
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
166 final REPLMessage btMessage = new REPLMessage(REPLMessage.OP, REPLMessage.BACKTRACE);
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
167 btMessage.put(REPLMessage.FRAME_NUMBER, Integer.toString(index));
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
168 if (node != null) {
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
169 btMessage.put(REPLMessage.SOURCE_LOCATION, visualizer.displaySourceLocation(node));
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
170 btMessage.put(REPLMessage.METHOD_NAME, visualizer.displayMethodName(node));
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
171 SourceSection section = node.getSourceSection();
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
172 if (section == null) {
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
173 section = node.getEncapsulatingSourceSection();
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
174 }
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
175 if (section != null && section.getSource() != null) {
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
176 btMessage.put(REPLMessage.FILE_PATH, section.getSource().getPath());
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
177 btMessage.put(REPLMessage.LINE_NUMBER, Integer.toString(section.getStartLine()));
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
178 btMessage.put(REPLMessage.SOURCE_LINE_TEXT, section.getSource().getCode(section.getStartLine()));
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
179 }
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
180 btMessage.put(REPLMessage.STATUS, REPLMessage.SUCCEEDED);
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
181 }
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
182 return btMessage;
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
183 }
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
184
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
185 public static final REPLHandler BREAK_AT_LINE_HANDLER = new REPLHandler(REPLMessage.BREAK_AT_LINE) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
186
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
187 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
188 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
189 final REPLMessage reply = createReply();
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
190 final String path = request.get(REPLMessage.FILE_PATH);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
191 final String fileName = request.get(REPLMessage.SOURCE_NAME);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
192 final String lookupFile = (path == null || path.isEmpty()) ? fileName : path;
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
193 Source source = null;
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
194 try {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
195 source = Source.fromFileName(lookupFile, true);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
196 } catch (Exception ex) {
22442
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
197 return finishReplyFailed(reply, ex);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
198 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
199 if (source == null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
200 return finishReplyFailed(reply, fileName + " not found");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
201 }
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
202 final Integer lineNumber = request.getIntValue(REPLMessage.LINE_NUMBER);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
203 if (lineNumber == null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
204 return finishReplyFailed(reply, "missing line number");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
205 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
206 Integer ignoreCount = request.getIntValue(REPLMessage.BREAKPOINT_IGNORE_COUNT);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
207 if (ignoreCount == null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
208 ignoreCount = 0;
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
209 }
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
210 final BreakpointInfo breakpointInfo = replServer.setLineBreakpoint(DEFAULT_IGNORE_COUNT, source.createLineLocation(lineNumber), false);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
211 reply.put(REPLMessage.SOURCE_NAME, fileName);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
212 reply.put(REPLMessage.FILE_PATH, source.getPath());
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
213 reply.put(REPLMessage.BREAKPOINT_ID, Integer.toString(breakpointInfo.getID()));
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
214 reply.put(REPLMessage.LINE_NUMBER, Integer.toString(lineNumber));
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
215 reply.put(REPLMessage.BREAKPOINT_IGNORE_COUNT, ignoreCount.toString());
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
216 return finishReplySucceeded(reply, "Breakpoint set");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
217 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
218 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
219
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
220 public static final REPLHandler BREAK_AT_LINE_ONCE_HANDLER = new REPLHandler(REPLMessage.BREAK_AT_LINE_ONCE) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
221
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
222 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
223 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
224 final REPLMessage reply = createReply();
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
225 final String path = request.get(REPLMessage.FILE_PATH);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
226 final String fileName = request.get(REPLMessage.SOURCE_NAME);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
227 final String lookupFile = (path == null || path.isEmpty()) ? fileName : path;
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
228 Source source = null;
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
229 try {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
230 source = Source.fromFileName(lookupFile, true);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
231 } catch (Exception ex) {
22442
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
232 return finishReplyFailed(reply, ex);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
233 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
234 if (source == null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
235 return finishReplyFailed(reply, fileName + " not found");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
236 }
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
237 final Integer lineNumber = request.getIntValue(REPLMessage.LINE_NUMBER);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
238 if (lineNumber == null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
239 return finishReplyFailed(reply, "missing line number");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
240 }
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
241 final BreakpointInfo breakpointInfo = replServer.setLineBreakpoint(DEFAULT_IGNORE_COUNT, source.createLineLocation(lineNumber), true);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
242 reply.put(REPLMessage.SOURCE_NAME, fileName);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
243 reply.put(REPLMessage.FILE_PATH, source.getPath());
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
244 reply.put(REPLMessage.BREAKPOINT_ID, Integer.toString(breakpointInfo.getID()));
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
245 reply.put(REPLMessage.LINE_NUMBER, Integer.toString(lineNumber));
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
246 return finishReplySucceeded(reply, "One-shot line breakpoint set");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
247 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
248 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
249
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
250 public static final REPLHandler BREAK_AT_THROW_HANDLER = new REPLHandler(REPLMessage.BREAK_AT_THROW) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
251
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
252 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
253 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
254 final REPLMessage reply = createReply();
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
255 try {
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
256 replServer.setTagBreakpoint(DEFAULT_IGNORE_COUNT, StandardSyntaxTag.THROW, false);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
257 return finishReplySucceeded(reply, "Breakpoint at any throw set");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
258 } catch (Exception ex) {
22442
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
259 return finishReplyFailed(reply, ex);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
260 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
261 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
262 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
263
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
264 public static final REPLHandler BREAK_AT_THROW_ONCE_HANDLER = new REPLHandler(REPLMessage.BREAK_AT_THROW_ONCE) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
265
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
266 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
267 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
268 final REPLMessage reply = createReply();
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
269 try {
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
270 replServer.setTagBreakpoint(DEFAULT_IGNORE_COUNT, StandardSyntaxTag.THROW, true);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
271 return finishReplySucceeded(reply, "One-shot breakpoint at any throw set");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
272 } catch (Exception ex) {
22442
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
273 return finishReplyFailed(reply, ex);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
274 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
275 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
276 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
277
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
278 public static final REPLHandler BREAKPOINT_INFO_HANDLER = new REPLHandler(REPLMessage.BREAKPOINT_INFO) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
279
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
280 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
281 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
282 final REPLMessage reply = createReply();
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
283 final ArrayList<REPLMessage> infoMessages = new ArrayList<>();
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
284 for (BreakpointInfo breakpointInfo : replServer.getBreakpoints()) {
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
285 infoMessages.add(createBreakpointInfoMessage(breakpointInfo));
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
286 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
287 if (infoMessages.size() > 0) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
288 return infoMessages.toArray(new REPLMessage[0]);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
289 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
290 return finishReplyFailed(reply, "No breakpoints");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
291 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
292 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
293
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
294 public static final REPLHandler CALL_HANDLER = new REPLHandler(REPLMessage.CALL) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
295
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
296 @Override
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
297 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
298 final REPLMessage reply = new REPLMessage(REPLMessage.OP, REPLMessage.CALL);
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
299 final String callName = request.get(REPLMessage.CALL_NAME);
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
300 if (callName == null) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
301 return finishReplyFailed(reply, "no name specified");
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
302 }
22468
64658afaf9c0 Truffle/REPL debugger: add "loads" and "evals" commands that "step into"; default is now not to step into
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22466
diff changeset
303 final ArrayList<String> argList = new ArrayList<>();
22466
57afe7055486 Truffle/REPL debugger: "call" command can now pass string arguments
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22462
diff changeset
304 for (int argCount = 0; argCount < REPLMessage.ARG_NAMES.length; argCount++) {
57afe7055486 Truffle/REPL debugger: "call" command can now pass string arguments
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22462
diff changeset
305 final String arg = request.get(REPLMessage.ARG_NAMES[argCount]);
57afe7055486 Truffle/REPL debugger: "call" command can now pass string arguments
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22462
diff changeset
306 if (arg == null) {
57afe7055486 Truffle/REPL debugger: "call" command can now pass string arguments
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22462
diff changeset
307 break;
57afe7055486 Truffle/REPL debugger: "call" command can now pass string arguments
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22462
diff changeset
308 }
57afe7055486 Truffle/REPL debugger: "call" command can now pass string arguments
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22462
diff changeset
309 argList.add(arg);
57afe7055486 Truffle/REPL debugger: "call" command can now pass string arguments
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22462
diff changeset
310 }
22471
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
311 final boolean stepInto = REPLMessage.TRUE.equals(request.get(REPLMessage.STEP_INTO));
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
312 try {
22471
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
313 final Object result = replServer.getCurrentContext().call(callName, stepInto, argList);
22468
64658afaf9c0 Truffle/REPL debugger: add "loads" and "evals" commands that "step into"; default is now not to step into
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22466
diff changeset
314 reply.put(REPLMessage.VALUE, result == null ? "<void>" : result.toString());
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
315 } catch (QuitException ex) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
316 throw ex;
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
317 } catch (KillException ex) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
318 return finishReplySucceeded(reply, callName + " killed");
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
319 } catch (Exception ex) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
320 return finishReplyFailed(reply, ex);
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
321 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
322 return finishReplySucceeded(reply, callName + " returned");
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
323 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
324 };
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
325
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
326 public static final REPLHandler CLEAR_BREAK_HANDLER = new REPLHandler(REPLMessage.CLEAR_BREAK) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
327
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
328 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
329 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
330 final REPLMessage reply = createReply();
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
331 final Integer breakpointNumber = request.getIntValue(REPLMessage.BREAKPOINT_ID);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
332 if (breakpointNumber == null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
333 return finishReplyFailed(reply, "missing breakpoint number");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
334 }
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
335 final BreakpointInfo breakpointInfo = replServer.findBreakpoint(breakpointNumber);
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
336 if (breakpointInfo == null) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
337 return finishReplyFailed(reply, "no breakpoint number " + breakpointNumber);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
338 }
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
339 breakpointInfo.dispose();
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
340 reply.put(REPLMessage.BREAKPOINT_ID, Integer.toString(breakpointNumber));
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
341 return finishReplySucceeded(reply, "Breakpoint " + breakpointNumber + " cleared");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
342 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
343 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
344
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
345 public static final REPLHandler CONTINUE_HANDLER = new REPLHandler(REPLMessage.CONTINUE) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
346
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
347 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
348 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
349 final REPLMessage reply = createReply();
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
350 replServer.getCurrentContext().prepareContinue();
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
351 return finishReplySucceeded(reply, "Continue mode entered");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
352 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
353 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
354
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
355 public static final REPLHandler DELETE_HANDLER = new REPLHandler(REPLMessage.DELETE_BREAK) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
356
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
357 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
358 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
359 final REPLMessage reply = createReply();
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
360 final Collection<BreakpointInfo> breakpoints = replServer.getBreakpoints();
22448
1c3deda60a9e Truffle/Debugging: the REPL debugger now remembers breakpoint requests it receives from the command line client when there have been no executions yet (which means breakpoints cannot be set in the engine/debugger). When the first execution event arrives (with a reference to the Debugger), any "pending" breakpoints are created with the Debugger. This involved a bit of refactoring on the Breakpoint class hierarchy.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22444
diff changeset
361 if (breakpoints.isEmpty()) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
362 return finishReplyFailed(reply, "no breakpoints to delete");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
363 }
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
364 for (BreakpointInfo breakpointInfo : breakpoints) {
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
365 breakpointInfo.dispose();
22448
1c3deda60a9e Truffle/Debugging: the REPL debugger now remembers breakpoint requests it receives from the command line client when there have been no executions yet (which means breakpoints cannot be set in the engine/debugger). When the first execution event arrives (with a reference to the Debugger), any "pending" breakpoints are created with the Debugger. This involved a bit of refactoring on the Breakpoint class hierarchy.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22444
diff changeset
366 }
1c3deda60a9e Truffle/Debugging: the REPL debugger now remembers breakpoint requests it receives from the command line client when there have been no executions yet (which means breakpoints cannot be set in the engine/debugger). When the first execution event arrives (with a reference to the Debugger), any "pending" breakpoints are created with the Debugger. This involved a bit of refactoring on the Breakpoint class hierarchy.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22444
diff changeset
367 return finishReplySucceeded(reply, Integer.toString(breakpoints.size()) + " breakpoints deleted");
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
368 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
369 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
370
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
371 public static final REPLHandler DISABLE_BREAK_HANDLER = new REPLHandler(REPLMessage.DISABLE_BREAK) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
372
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
373 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
374 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
375 final REPLMessage reply = createReply();
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
376 Integer breakpointNumber = request.getIntValue(REPLMessage.BREAKPOINT_ID);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
377 if (breakpointNumber == null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
378 return finishReplyFailed(reply, "missing breakpoint number");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
379 }
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
380 final BreakpointInfo breakpointInfo = replServer.findBreakpoint(breakpointNumber);
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
381 if (breakpointInfo == null) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
382 return finishReplyFailed(reply, "no breakpoint number " + breakpointNumber);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
383 }
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
384 breakpointInfo.setEnabled(false);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
385 reply.put(REPLMessage.BREAKPOINT_ID, Integer.toString(breakpointNumber));
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
386 return finishReplySucceeded(reply, "Breakpoint " + breakpointNumber + " disabled");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
387 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
388 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
389
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
390 public static final REPLHandler ENABLE_BREAK_HANDLER = new REPLHandler(REPLMessage.ENABLE_BREAK) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
391
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
392 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
393 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
394 final REPLMessage reply = createReply();
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
395 Integer breakpointNumber = request.getIntValue(REPLMessage.BREAKPOINT_ID);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
396 if (breakpointNumber == null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
397 return finishReplyFailed(reply, "missing breakpoint number");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
398 }
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
399 final BreakpointInfo breakpointInfo = replServer.findBreakpoint(breakpointNumber);
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
400 if (breakpointInfo == null) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
401 return finishReplyFailed(reply, "no breakpoint number " + breakpointNumber);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
402 }
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
403 breakpointInfo.setEnabled(true);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
404 reply.put(REPLMessage.BREAKPOINT_ID, Integer.toString(breakpointNumber));
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
405 return finishReplySucceeded(reply, "Breakpoint " + breakpointNumber + " enabled");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
406 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
407 };
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
408 public static final REPLHandler EVAL_HANDLER = new REPLHandler(REPLMessage.EVAL) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
409 @Override
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
410 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
411 final REPLMessage reply = createReply();
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
412 final String sourceName = request.get(REPLMessage.SOURCE_NAME);
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
413 reply.put(REPLMessage.SOURCE_NAME, sourceName);
22447
a8b796ac350d Truffle/REPL: upate to use new support for "eval"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22444
diff changeset
414 final Context serverContext = replServer.getCurrentContext();
a8b796ac350d Truffle/REPL: upate to use new support for "eval"
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22444
diff changeset
415 reply.put(REPLMessage.DEBUG_LEVEL, Integer.toString(serverContext.getLevel()));
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
416
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
417 final String source = request.get(REPLMessage.CODE);
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
418 final Visualizer visualizer = replServer.getVisualizer();
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
419 final Integer frameNumber = request.getIntValue(REPLMessage.FRAME_NUMBER);
22468
64658afaf9c0 Truffle/REPL debugger: add "loads" and "evals" commands that "step into"; default is now not to step into
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22466
diff changeset
420 final boolean stepInto = REPLMessage.TRUE.equals(request.get(REPLMessage.STEP_INTO));
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
421 try {
22468
64658afaf9c0 Truffle/REPL debugger: add "loads" and "evals" commands that "step into"; default is now not to step into
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22466
diff changeset
422 Object returnValue = serverContext.eval(source, frameNumber, stepInto);
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
423 return finishReplySucceeded(reply, visualizer.displayValue(returnValue, 0));
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
424 } catch (QuitException ex) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
425 throw ex;
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
426 } catch (KillException ex) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
427 return finishReplySucceeded(reply, "eval (" + sourceName + ") killed");
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
428 } catch (Exception ex) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
429 return finishReplyFailed(reply, ex);
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
430 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
431 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
432 };
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
433 public static final REPLHandler FILE_HANDLER = new REPLHandler(REPLMessage.FILE) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
434 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
435 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
436 final REPLMessage reply = createReply();
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
437 final String fileName = request.get(REPLMessage.SOURCE_NAME);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
438 if (fileName == null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
439 return finishReplyFailed(reply, "no file specified");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
440 }
22442
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
441 reply.put(REPLMessage.SOURCE_NAME, fileName);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
442 try {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
443 Source source = Source.fromFileName(fileName);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
444 if (source == null) {
22442
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
445 return finishReplyFailed(reply, "file \"" + fileName + "\" not found");
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
446 } else {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
447 reply.put(REPLMessage.FILE_PATH, source.getPath());
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
448 reply.put(REPLMessage.CODE, source.getCode());
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
449 return finishReplySucceeded(reply, "file found");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
450 }
22442
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
451 } catch (IOException ex) {
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
452 return finishReplyFailed(reply, "can't read file \"" + fileName + "\"");
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
453 } catch (Exception ex) {
22442
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
454 return finishReplyFailed(reply, ex);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
455 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
456 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
457 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
458
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
459 // TODO (mlvdv) deal with slot locals explicitly
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
460 /**
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
461 * Returns a general description of the frame, plus a textual summary of the slot values: one
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
462 * per line.
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
463 */
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
464 public static final REPLHandler FRAME_HANDLER = new REPLHandler(REPLMessage.FRAME) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
465
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
466 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
467 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
468 final Integer frameNumber = request.getIntValue(REPLMessage.FRAME_NUMBER);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
469 if (frameNumber == null) {
22462
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
470 return finishReplyFailed(createReply(), "no frame number specified");
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
471 }
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
472 final List<FrameDebugDescription> stack = replServer.getCurrentContext().getStack();
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
473 if (frameNumber < 0 || frameNumber >= stack.size()) {
22462
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
474 return finishReplyFailed(createReply(), "frame number " + frameNumber + " out of range");
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
475 }
22471
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
476 final Visualizer visualizer = replServer.getVisualizer();
22462
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
477
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
478 final FrameDebugDescription frameDescription = stack.get(frameNumber);
22471
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
479 final Frame frame = frameDescription.frame();
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
480 final Node node = frameDescription.node();
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
481 List<? extends FrameSlot> slots = frame.getFrameDescriptor().getSlots();
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
482
22462
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
483 if (slots.size() == 0) {
22471
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
484 final REPLMessage emptyFrameMessage = createFrameInfoMessage(replServer, frameNumber, node);
22462
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
485 return finishReplySucceeded(emptyFrameMessage, "empty frame");
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
486 }
22462
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
487 final ArrayList<REPLMessage> replies = new ArrayList<>();
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
488
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
489 for (FrameSlot slot : slots) {
22471
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
490 final REPLMessage slotMessage = createFrameInfoMessage(replServer, frameNumber, node);
22462
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
491 slotMessage.put(REPLMessage.SLOT_INDEX, Integer.toString(slot.getIndex()));
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
492 slotMessage.put(REPLMessage.SLOT_ID, visualizer.displayIdentifier(slot));
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
493 slotMessage.put(REPLMessage.SLOT_VALUE, visualizer.displayValue(frame.getValue(slot), 0));
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
494 slotMessage.put(REPLMessage.STATUS, REPLMessage.SUCCEEDED);
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
495 replies.add(slotMessage);
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
496 }
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
497 return replies.toArray(new REPLMessage[0]);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
498 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
499 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
500
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
501 public static final REPLHandler INFO_HANDLER = new REPLHandler(REPLMessage.INFO) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
502
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
503 @Override
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
504 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
505 final String topic = request.get(REPLMessage.TOPIC);
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
506
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
507 if (topic == null || topic.isEmpty()) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
508 final REPLMessage message = new REPLMessage(REPLMessage.OP, REPLMessage.INFO);
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
509 return finishReplyFailed(message, "No info topic specified");
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
510 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
511
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
512 switch (topic) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
513
22461
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
514 case REPLMessage.INFO_SUPPORTED_LANGUAGES:
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
515 final ArrayList<REPLMessage> langMessages = new ArrayList<>();
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
516
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
517 for (Language language : replServer.getLanguages()) {
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
518 final REPLMessage infoMessage = new REPLMessage(REPLMessage.OP, REPLMessage.INFO);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
519 infoMessage.put(REPLMessage.TOPIC, REPLMessage.INFO_SUPPORTED_LANGUAGES);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
520 infoMessage.put(REPLMessage.LANG_NAME, language.getName());
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
521 infoMessage.put(REPLMessage.LANG_VER, language.getVersion());
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
522 infoMessage.put(REPLMessage.STATUS, REPLMessage.SUCCEEDED);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
523 langMessages.add(infoMessage);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
524 }
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
525 return langMessages.toArray(new REPLMessage[0]);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
526
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
527 case REPLMessage.INFO_CURRENT_LANGUAGE:
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
528 final REPLMessage reply = new REPLMessage(REPLMessage.OP, REPLMessage.INFO);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
529 reply.put(REPLMessage.TOPIC, REPLMessage.INFO_CURRENT_LANGUAGE);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
530 final String languageName = replServer.getCurrentContext().getLanguageName();
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
531 reply.put(REPLMessage.LANG_NAME, languageName);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
532 return finishReplySucceeded(reply, languageName);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
533
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
534 case REPLMessage.WELCOME_MESSAGE:
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
535 final REPLMessage infoMessage = new REPLMessage(REPLMessage.OP, REPLMessage.INFO);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
536 infoMessage.put(REPLMessage.TOPIC, REPLMessage.WELCOME_MESSAGE);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
537 infoMessage.put(REPLMessage.INFO_VALUE, replServer.getWelcome());
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
538 infoMessage.put(REPLMessage.STATUS, REPLMessage.SUCCEEDED);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
539 return finishReplySucceeded(infoMessage, "welcome");
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
540
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
541 default:
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
542 final REPLMessage message = new REPLMessage(REPLMessage.OP, REPLMessage.INFO);
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
543 return finishReplyFailed(message, "No info about topic \"" + topic + "\"");
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
544 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
545 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
546 };
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
547 public static final REPLHandler KILL_HANDLER = new REPLHandler(REPLMessage.KILL) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
548
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
549 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
550 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
551 if (replServer.getCurrentContext().getLevel() == 0) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
552 return finishReplyFailed(createReply(), "nothing to kill");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
553 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
554 throw new KillException();
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
555 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
556 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
557
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
558 public static final REPLHandler LOAD_HANDLER = new REPLHandler(REPLMessage.LOAD_SOURCE) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
559
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
560 @Override
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
561 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
562 final REPLMessage reply = new REPLMessage(REPLMessage.OP, REPLMessage.LOAD_SOURCE);
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
563 final String fileName = request.get(REPLMessage.SOURCE_NAME);
22468
64658afaf9c0 Truffle/REPL debugger: add "loads" and "evals" commands that "step into"; default is now not to step into
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22466
diff changeset
564 final boolean stepInto = REPLMessage.TRUE.equals(request.get(REPLMessage.STEP_INTO));
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
565 try {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
566 final Source fileSource = Source.fromFileName(fileName);
22468
64658afaf9c0 Truffle/REPL debugger: add "loads" and "evals" commands that "step into"; default is now not to step into
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22466
diff changeset
567 replServer.getCurrentContext().eval(fileSource, stepInto);
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
568 reply.put(REPLMessage.FILE_PATH, fileName);
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
569 return finishReplySucceeded(reply, fileName + " loaded");
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
570 } catch (QuitException ex) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
571 throw ex;
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
572 } catch (KillException ex) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
573 return finishReplySucceeded(reply, fileName + " killed");
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
574 } catch (Exception ex) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
575 return finishReplyFailed(reply, ex);
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
576 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
577 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
578 };
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
579
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
580 public static final REPLHandler QUIT_HANDLER = new REPLHandler(REPLMessage.QUIT) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
581 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
582 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
583 throw new QuitException();
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
584 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
585 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
586
22461
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
587 public static final REPLHandler SET_LANGUAGE_HANDLER = new REPLHandler(REPLMessage.SET_LANGUAGE) {
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
588
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
589 @Override
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
590 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
591 final REPLMessage reply = new REPLMessage(REPLMessage.OP, REPLMessage.SET_LANGUAGE);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
592 String languageName = request.get(REPLMessage.LANG_NAME);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
593 if (languageName == null) {
22471
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
594 final String oldLanguageName = replServer.getCurrentContext().getLanguageName();
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
595 reply.put(REPLMessage.LANG_NAME, reply.put(REPLMessage.LANG_NAME, oldLanguageName));
a6c162686d81 Truffle/Language&Debugger: reimplement completely how the execution stack is gathered and communicated; change the signature of TruffelLanguage.evalInContext() to comply.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22468
diff changeset
596 return finishReplySucceeded(reply, "Language set to " + oldLanguageName);
22461
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
597 }
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
598 reply.put(REPLMessage.LANG_NAME, languageName);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
599 try {
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
600 final String newLanguageName = replServer.getCurrentContext().setLanguage(languageName);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
601 if (newLanguageName != null) {
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
602 return finishReplySucceeded(reply, "Language set to " + newLanguageName);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
603 }
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
604 } catch (Exception ex) {
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
605 return finishReplyFailed(reply, ex);
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
606 }
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
607 return finishReplyFailed(reply, "Language \"" + languageName + "\" not supported");
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
608 }
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
609 };
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
610
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
611 public static final REPLHandler SET_BREAK_CONDITION_HANDLER = new REPLHandler(REPLMessage.SET_BREAK_CONDITION) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
612
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
613 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
614 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
615 final REPLMessage message = new REPLMessage(REPLMessage.OP, REPLMessage.SET_BREAK_CONDITION);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
616 Integer breakpointNumber = request.getIntValue(REPLMessage.BREAKPOINT_ID);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
617 if (breakpointNumber == null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
618 return finishReplyFailed(message, "missing breakpoint number");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
619 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
620 message.put(REPLMessage.BREAKPOINT_ID, Integer.toString(breakpointNumber));
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
621 final BreakpointInfo breakpointInfo = replServer.findBreakpoint(breakpointNumber);
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
622 if (breakpointInfo == null) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
623 return finishReplyFailed(message, "no breakpoint number " + breakpointNumber);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
624 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
625 final String expr = request.get(REPLMessage.BREAKPOINT_CONDITION);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
626 if (expr == null || expr.isEmpty()) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
627 return finishReplyFailed(message, "missing condition for " + breakpointNumber);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
628 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
629 try {
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
630 breakpointInfo.setCondition(expr);
22003
5bc7f7b867ab Making debugger always on for each TruffleVM execution. Introducing EventConsumer to process such debugger events. Requesting each RootNode to be associated with a TruffleLanguage, so debugger can find out proper context for each Node where executions gets suspended.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 21951
diff changeset
631 } catch (IOException ex) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
632 return finishReplyFailed(message, "invalid condition for " + breakpointNumber);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
633 } catch (UnsupportedOperationException ex) {
22457
400bbc57017e Truffle/REPLdebugger: fix misleading error message
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22451
diff changeset
634 return finishReplyFailed(message, "conditions not supported by breakpoint " + breakpointNumber);
22442
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
635 } catch (Exception ex) {
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
636 return finishReplyFailed(message, ex);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
637 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
638 message.put(REPLMessage.BREAKPOINT_CONDITION, expr);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
639 return finishReplySucceeded(message, "Breakpoint " + breakpointNumber + " condition=\"" + expr + "\"");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
640 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
641 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
642
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
643 public static final REPLHandler STEP_INTO_HANDLER = new REPLHandler(REPLMessage.STEP_INTO) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
644
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
645 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
646 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
647 final REPLMessage reply = createReply();
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
648 Integer repeat = request.getIntValue(REPLMessage.REPEAT);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
649 if (repeat == null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
650 repeat = 1;
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
651 }
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
652 replServer.getCurrentContext().prepareStepInto(repeat);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
653 return finishReplySucceeded(reply, "StepInto <" + repeat + "> enabled");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
654 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
655 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
656
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
657 public static final REPLHandler STEP_OUT_HANDLER = new REPLHandler(REPLMessage.STEP_OUT) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
658
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
659 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
660 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
661 replServer.getCurrentContext().prepareStepOut();
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
662 return finishReplySucceeded(createReply(), "StepOut enabled");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
663 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
664 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
665
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
666 public static final REPLHandler STEP_OVER_HANDLER = new REPLHandler(REPLMessage.STEP_OVER) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
667
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
668 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
669 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
670 final REPLMessage reply = createReply();
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
671 Integer repeat = request.getIntValue(REPLMessage.REPEAT);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
672 if (repeat == null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
673 repeat = 1;
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
674 }
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
675 replServer.getCurrentContext().prepareStepOver(repeat);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
676 return finishReplySucceeded(reply, "StepOver <" + repeat + "> enabled");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
677 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
678 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
679
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
680 public static final REPLHandler TRUFFLE_HANDLER = new REPLHandler(REPLMessage.TRUFFLE) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
681
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
682 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
683 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
684 final REPLMessage reply = createReply();
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
685 final ASTPrinter astPrinter = replServer.getVisualizer().getASTPrinter();
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
686 final String topic = request.get(REPLMessage.TOPIC);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
687 reply.put(REPLMessage.TOPIC, topic);
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
688 Node node = replServer.getCurrentContext().getNodeAtHalt();
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
689 if (node == null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
690 return finishReplyFailed(reply, "no current AST node");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
691 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
692 final Integer depth = request.getIntValue(REPLMessage.AST_DEPTH);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
693 if (depth == null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
694 return finishReplyFailed(reply, "missing AST depth");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
695 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
696 try {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
697 switch (topic) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
698 case REPLMessage.AST:
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
699 while (node.getParent() != null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
700 node = node.getParent();
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
701 }
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
702 final String astText = astPrinter.printTreeToString(node, depth, replServer.getCurrentContext().getNodeAtHalt());
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
703 return finishReplySucceeded(reply, astText);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
704 case REPLMessage.SUBTREE:
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
705 case REPLMessage.SUB:
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
706 final String subTreeText = astPrinter.printTreeToString(node, depth);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
707 return finishReplySucceeded(reply, subTreeText);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
708 default:
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
709 return finishReplyFailed(reply, "Unknown \"" + REPLMessage.TRUFFLE.toString() + "\" topic");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
710 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
711
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
712 } catch (Exception ex) {
22442
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
713 return finishReplyFailed(reply, ex);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
714 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
715 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
716 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
717
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
718 public static final REPLHandler UNSET_BREAK_CONDITION_HANDLER = new REPLHandler(REPLMessage.UNSET_BREAK_CONDITION) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
719
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
720 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
721 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
722 final REPLMessage message = new REPLMessage(REPLMessage.OP, REPLMessage.UNSET_BREAK_CONDITION);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
723 Integer breakpointNumber = request.getIntValue(REPLMessage.BREAKPOINT_ID);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
724 if (breakpointNumber == null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
725 return finishReplyFailed(message, "missing breakpoint number");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
726 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
727 message.put(REPLMessage.BREAKPOINT_ID, Integer.toString(breakpointNumber));
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
728 final BreakpointInfo breakpointInfo = replServer.findBreakpoint(breakpointNumber);
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
729 if (breakpointInfo == null) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
730 return finishReplyFailed(message, "no breakpoint number " + breakpointNumber);
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
731 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
732 try {
22475
c434681cd164 Truffle/REPL debugger: rewrite the management of breakpoint information that permits pre-execution setting of breakpoints, no longer depends directly on the Breakpoint classes.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22471
diff changeset
733 breakpointInfo.setCondition(null);
22442
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
734 } catch (Exception ex) {
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
735 return finishReplyFailed(message, ex);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
736 }
22442
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
737 return finishReplySucceeded(message, "Breakpoint " + breakpointNumber + " condition cleared");
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
738 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
739 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
740
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
741 public static final REPLHandler TRUFFLE_NODE_HANDLER = new REPLHandler(REPLMessage.TRUFFLE_NODE) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
742
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
743 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
744 public REPLMessage[] receive(REPLMessage request, REPLServer replServer) {
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
745 final REPLMessage reply = createReply();
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
746 final ASTPrinter astPrinter = replServer.getVisualizer().getASTPrinter();
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
747 final Node node = replServer.getCurrentContext().getNodeAtHalt();
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
748 if (node == null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
749 return finishReplyFailed(reply, "no current AST node");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
750 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
751
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
752 try {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
753 final StringBuilder sb = new StringBuilder();
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
754 sb.append(astPrinter.printNodeWithInstrumentation(node));
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
755
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
756 final SourceSection sourceSection = node.getSourceSection();
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
757 if (sourceSection != null) {
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
758 final String code = sourceSection.getCode();
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
759 sb.append(" \"");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
760 sb.append(code.substring(0, Math.min(code.length(), 15)));
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
761 sb.append("...\"");
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
762 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
763 return finishReplySucceeded(reply, sb.toString());
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
764 } catch (Exception ex) {
22442
2b1845933b6f Truffle/REPL: fix two minor bugs and improve error reporting
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22293
diff changeset
765 return finishReplyFailed(reply, ex);
21568
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
766 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
767 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
768 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
769 }