annotate truffle/com.oracle.truffle.tools.debug.shell/src/com/oracle/truffle/tools/debug/shell/server/REPLHandler.java @ 22548:6b76a24fffbd default tip

Use all variables: a, b, u,v and x, y
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Thu, 14 Jan 2016 14:20:57 +0100
parents 4a83dc15e774
children
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
22476
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
32 import com.oracle.truffle.api.frame.FrameInstance;
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
33 import com.oracle.truffle.api.frame.FrameInstance.FrameAccess;
22157
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
34 import com.oracle.truffle.api.frame.FrameSlot;
22476
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
35 import com.oracle.truffle.api.frame.MaterializedFrame;
22157
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
36 import com.oracle.truffle.api.instrument.ASTPrinter;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
37 import com.oracle.truffle.api.instrument.KillException;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
38 import com.oracle.truffle.api.instrument.QuitException;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
39 import com.oracle.truffle.api.instrument.StandardSyntaxTag;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
40 import com.oracle.truffle.api.instrument.Visualizer;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
41 import com.oracle.truffle.api.nodes.Node;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
42 import com.oracle.truffle.api.source.Source;
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
43 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
44 import com.oracle.truffle.api.vm.PolyglotEngine.Language;
22157
dc83cc1f94f2 Using fully qualified imports
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents: 22003
diff changeset
45 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
46 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
47 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
48
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
49 /**
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 * 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
51 * <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
52 * 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
53 */
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
55
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 // 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
57 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
58
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
60
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
62 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
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 /**
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 * 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
67 */
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
68 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
69 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
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 /**
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 * 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
74 */
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
75 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
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 /**
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 * 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
79 */
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
80 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
81 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
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 /**
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 * 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
86 */
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
88 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
89 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
90 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
91 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
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 /**
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 * 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
96 */
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
98 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
99 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
100 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
101 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
102 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
103
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
104 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
105 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
106 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
107 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
108 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
109 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
110 }
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
111
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
112 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
113 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
114 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
115 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
116 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
117 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
118 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
119 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
120 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
121 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
123 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
124 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
125
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
126 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
127 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
128 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
129 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
130 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
131 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
132
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
134 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
135 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
136 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
137 }
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
138 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
139 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
140 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
141 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
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 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
145 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
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
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
149
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
150 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
151 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
152 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
153 final ArrayList<REPLMessage> replies = new ArrayList<>();
22476
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
154 final Context currentContext = replServer.getCurrentContext();
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
155 final List<FrameInstance> stack = currentContext.getStack();
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
156 replies.add(btMessage(0, currentContext.getNode(), visualizer));
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
157 for (int i = 1; i <= stack.size(); i++) {
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
158 replies.add(btMessage(i, stack.get(i - 1).getCallNode(), 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
159 }
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
160 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
161 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
162 }
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
163 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
164 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
165 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
166
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
167 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
168 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
169 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
170 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
171 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
172 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
173 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
174 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
175 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
176 }
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 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
178 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
179 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
180 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
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 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
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 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
185 }
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
186
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
187 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
188
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
190 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
191 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
192 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
193 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
194 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
195 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
196 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
197 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
198 } 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
199 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
200 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
202 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
203 }
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
204 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
205 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
206 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
207 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
209 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
210 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
211 }
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
212 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
213 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
214 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
215 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
216 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
217 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
218 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
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 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
223
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
225 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
226 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
227 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
228 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
229 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
230 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
231 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
232 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
233 } 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
234 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
235 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
237 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
238 }
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
239 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
240 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
241 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
242 }
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
243 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
244 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
245 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
246 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
247 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
248 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
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 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
253
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
255 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
256 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
257 try {
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
258 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
259 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
260 } 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
261 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
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 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
267
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
269 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
270 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
271 try {
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
272 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
273 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
274 } 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
275 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
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 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
281
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
283 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
284 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
285 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
286 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
287 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
288 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
290 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
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 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
293 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
294 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
295
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
296 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
297
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
298 @Override
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
299 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
300 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
301 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
302 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
303 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
304 }
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
305 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
306 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
307 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
308 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
309 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
310 }
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
311 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
312 }
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 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
314 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
315 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
316 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
317 } 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
318 throw ex;
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
319 } 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
320 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
321 } 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
322 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
323 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
324 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
325 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
326 };
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
327
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
328 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
329
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
331 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
332 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
333 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
334 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
335 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
336 }
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
337 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
338 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
339 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
340 }
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
341 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
342 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
343 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
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 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
348
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
350 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
351 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
352 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
353 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
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 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
358
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
360 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
361 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
362 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
363 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
364 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
365 }
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
366 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
367 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
368 }
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
369 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
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 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
374
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
376 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
377 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
378 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
379 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
380 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
381 }
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
382 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
383 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
384 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
385 }
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
386 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
387 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
388 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
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 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
393
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
395 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
396 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
397 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
398 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
399 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
400 }
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
401 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
402 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
403 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
404 }
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
405 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
406 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
407 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
408 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
409 };
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
410 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
411 @Override
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
412 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
413 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
414 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
415 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
416 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
417 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
418
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
419 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
420 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
421 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
422 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
423 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
424 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
425 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
426 } 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
427 throw ex;
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
428 } 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
429 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
430 } 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
431 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
432 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
433 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
434 };
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
435 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
436 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
437 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
438 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
439 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
440 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
441 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
442 }
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
443 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
444 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
445 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
446 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
447 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
448 } 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
449 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
450 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
451 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
452 }
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
453 } 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
454 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
455 } 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
456 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
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 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 // 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
462 /**
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 * 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
464 * 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
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 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
467
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
469 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
470 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
471 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
472 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
473 }
22476
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
474 final Context currentContext = replServer.getCurrentContext();
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
475 final List<FrameInstance> stack = currentContext.getStack();
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
476 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
477 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
478 }
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 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
480
22476
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
481 MaterializedFrame frame;
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
482 Node node;
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
483 if (frameNumber == 0) {
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
484 frame = currentContext.getFrame();
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
485 node = currentContext.getNode();
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
486 } else {
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
487 final FrameInstance instance = stack.get(frameNumber - 1);
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
488 frame = instance.getFrame(FrameAccess.MATERIALIZE, true).materialize();
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
489 node = instance.getCallNode();
4a83dc15e774 Truffle/Debugging: reorganize Debugger/Suspended event to pass stack as FrameInstances; delete FrameDebugDescription
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22475
diff changeset
490 }
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
491 List<? extends FrameSlot> slots = frame.getFrameDescriptor().getSlots();
22462
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
492 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
493 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
494 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
495 }
22462
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
496 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
497
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
498 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
499 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
500 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
501 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
502 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
503 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
504 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
505 }
460f85e7c64c Truffle/REPL debugger: handle stack frames more explicitly
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22461
diff changeset
506 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
507 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
508 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
509
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
510 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
511
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
512 @Override
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
513 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
514 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
515
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
516 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
517 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
518 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
519 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
520
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
521 switch (topic) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
522
22461
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
523 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
524 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
525
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
526 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
527 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
528 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
529 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
530 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
531 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
532 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
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 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
535
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
536 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
537 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
538 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
539 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
540 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
541 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
542
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
543 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
544 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
545 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
546 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
547 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
548 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
549
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
550 default:
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
551 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
552 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
553 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
554 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
555 };
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
556 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
557
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
558 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
559 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
560 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
561 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
562 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
563 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
564 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
565 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
566
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
567 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
568
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
569 @Override
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
570 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
571 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
572 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
573 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
574 try {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
575 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
576 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
577 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
578 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
579 } 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
580 throw ex;
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
581 } 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
582 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
583 } 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
584 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
585 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
586 }
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
587 };
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
588
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
589 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
590 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
591 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
592 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
593 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
594 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
595
22461
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
596 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
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 @Override
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
599 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
600 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
601 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
602 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
603 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
604 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
605 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
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 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
608 try {
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
609 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
610 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
611 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
612 }
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
613 } 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
614 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
615 }
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
616 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
617 }
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
618 };
c17794973b64 Truffle/REPL debugger: move closer to multi-lang
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22459
diff changeset
619
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
620 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
621
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
622 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
623 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
624 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
625 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
626 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
627 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
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 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
630 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
631 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
632 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
633 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
634 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
635 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
636 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
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 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
639 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
640 } 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
641 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
642 } 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
643 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
644 } 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
645 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
646 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
648 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
649 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
652 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
653
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
655 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
656 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
657 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
658 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
659 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
660 }
22444
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().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
662 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
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_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
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) {
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
670 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
671 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
672 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
675 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
676
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
678 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
679 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
680 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
681 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
682 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
683 }
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
684 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
685 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
686 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
688
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
690
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
692 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
693 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
694 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
695 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
696 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
697 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
698 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
699 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
700 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
702 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
703 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
704 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
706 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
707 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
708 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
709 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
710 }
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
711 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
712 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
713 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
714 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
715 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
716 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
717 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
718 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
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
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
721 } 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
722 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
723 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
728
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
729 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
730 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
731 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
732 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
733 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
734 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
735 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
737 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
738 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
739 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
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 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
742 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
743 } 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
744 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
745 }
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
746 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
747 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
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 @Override
22444
c3e397ce5941 Truffle/Debugging/REPL: major reorganization post-PolyglotEngine
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents: 22442
diff changeset
753 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
754 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
755 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
756 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
757 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
758 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
759 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.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 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
762 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
763 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
764
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
765 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
766 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
767 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
768 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
769 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
770 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
771 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
772 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
773 } 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
774 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
775 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
776 }
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
777 };
3b8bbf51d320 Truffle/Debugging: add the Truffle DebugEngine and supporting code, as well as add a crude command-line debugging tool used mainly to test the DebugEngine. Migrate the small tols out of project com.oracle.truffle.api into the new project com.oracle.truffle.tools.
Michael Van De Vanter <michael.van.de.vanter@oracle.com>
parents:
diff changeset
778 }