Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.ruby.nodes/src/com/oracle/truffle/ruby/nodes/debug/DebugNodes.java @ 14032:d1c1f103d42c
renamed com.oracle.graal.asm.AbstractAssembler to com.oracle.graal.asm.Assembler
author | twisti |
---|---|
date | Thu, 27 Feb 2014 11:36:25 -0800 |
parents | 22bf5a8ba9eb |
children |
rev | line source |
---|---|
13918
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
1 /* |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved. This |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
3 * code is released under a tri EPL/GPL/LGPL license. You can use it, |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
4 * redistribute it and/or modify it under the terms of the: |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
5 * |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
6 * Eclipse Public License version 1.0 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
7 * GNU General Public License version 2 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
8 * GNU Lesser General Public License version 2.1 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
9 */ |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
10 package com.oracle.truffle.ruby.nodes.debug; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
11 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
12 import com.oracle.truffle.api.*; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
13 import com.oracle.truffle.api.dsl.*; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
14 import com.oracle.truffle.api.frame.*; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
15 import com.oracle.truffle.api.nodes.*; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
16 import com.oracle.truffle.api.source.*; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
17 import com.oracle.truffle.ruby.nodes.core.*; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
18 import com.oracle.truffle.ruby.runtime.*; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
19 import com.oracle.truffle.ruby.runtime.control.*; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
20 import com.oracle.truffle.ruby.runtime.core.*; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
21 import com.oracle.truffle.ruby.runtime.debug.*; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
22 import com.oracle.truffle.ruby.runtime.methods.*; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
23 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
24 @CoreClass(name = "Debug") |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
25 public abstract class DebugNodes { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
26 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
27 @CoreMethod(names = "break", isModuleMethod = true, needsSelf = false, needsBlock = true, appendCallNode = true, minArgs = 0, maxArgs = 3) |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
28 public abstract static class BreakNode extends CoreMethodNode { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
29 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
30 public BreakNode(RubyContext context, SourceSection sourceSection) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
31 super(context, sourceSection); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
32 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
33 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
34 public BreakNode(BreakNode prev) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
35 super(prev); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
36 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
37 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
38 @Specialization(order = 1) |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
39 public NilPlaceholder debugBreak(VirtualFrame frame, Node callNode, @SuppressWarnings("unused") UndefinedPlaceholder undefined0, @SuppressWarnings("unused") UndefinedPlaceholder undefined1, |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
40 @SuppressWarnings("unused") UndefinedPlaceholder block) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
41 getContext().runShell(callNode, frame.materialize()); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
42 return NilPlaceholder.INSTANCE; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
43 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
44 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
45 @Specialization(order = 2) |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
46 public NilPlaceholder debugBreak(RubyString fileName, int line, @SuppressWarnings("unused") Node callNode, @SuppressWarnings("unused") UndefinedPlaceholder block) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
47 final RubyContext context = getContext(); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
48 if (context.getConfiguration().getDebug()) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
49 final Source source = context.getSourceManager().get(fileName.toString()); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
50 final SourceLineLocation lineLocation = new SourceLineLocation(source, line); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
51 context.getRubyDebugManager().setBreakpoint(lineLocation, null); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
52 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
53 return NilPlaceholder.INSTANCE; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
54 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
55 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
56 @Specialization(order = 3) |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
57 public NilPlaceholder debugBreak(RubyString fileName, int line, @SuppressWarnings("unused") Node callNode, RubyProc block) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
58 final RubyContext context = getContext(); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
59 if (context.getConfiguration().getDebug()) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
60 final Source source = context.getSourceManager().get(fileName.toString()); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
61 final SourceLineLocation lineLocation = new SourceLineLocation(source, line); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
62 context.getRubyDebugManager().setBreakpoint(lineLocation, block); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
63 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
64 return NilPlaceholder.INSTANCE; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
65 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
66 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
67 @Specialization(order = 4) |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
68 public NilPlaceholder debugBreak(RubySymbol methodName, RubySymbol localName, @SuppressWarnings("unused") Node callNode, @SuppressWarnings("unused") UndefinedPlaceholder block) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
69 final RubyContext context = getContext(); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
70 if (context.getConfiguration().getDebug()) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
71 final RubyMethod method = context.getCoreLibrary().getMainObject().getLookupNode().lookupMethod(methodName.toString()); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
72 final MethodLocal methodLocal = new MethodLocal(method.getUniqueIdentifier(), localName.toString()); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
73 context.getRubyDebugManager().setBreakpoint(methodLocal, null); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
74 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
75 return NilPlaceholder.INSTANCE; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
76 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
77 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
78 @Specialization(order = 5) |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
79 public NilPlaceholder debugBreak(RubySymbol methodName, RubySymbol localName, @SuppressWarnings("unused") Node callNode, RubyProc block) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
80 final RubyContext context = getContext(); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
81 if (context.getConfiguration().getDebug()) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
82 final RubyMethod method = context.getCoreLibrary().getMainObject().getLookupNode().lookupMethod(methodName.toString()); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
83 final MethodLocal methodLocal = new MethodLocal(method.getUniqueIdentifier(), localName.toString()); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
84 context.getRubyDebugManager().setBreakpoint(methodLocal, block); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
85 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
86 return NilPlaceholder.INSTANCE; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
87 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
88 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
89 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
90 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
91 @CoreMethod(names = "continue", isModuleMethod = true, needsSelf = false, maxArgs = 0) |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
92 public abstract static class ContinueNode extends CoreMethodNode { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
93 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
94 public ContinueNode(RubyContext context, SourceSection sourceSection) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
95 super(context, sourceSection); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
96 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
97 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
98 public ContinueNode(ContinueNode prev) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
99 super(prev); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
100 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
101 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
102 @Specialization |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
103 public Object debugContinue() { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
104 if (getContext().getConfiguration().getDebug()) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
105 throw new BreakShellException(); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
106 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
107 return NilPlaceholder.INSTANCE; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
108 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
109 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
110 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
111 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
112 @CoreMethod(names = "enabled?", isModuleMethod = true, needsSelf = false, maxArgs = 0) |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
113 public abstract static class EnabledNode extends CoreMethodNode { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
114 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
115 public EnabledNode(RubyContext context, SourceSection sourceSection) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
116 super(context, sourceSection); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
117 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
118 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
119 public EnabledNode(ContinueNode prev) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
120 super(prev); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
121 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
122 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
123 @Specialization |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
124 public boolean enabled() { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
125 return getContext().getConfiguration().getDebug(); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
126 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
127 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
128 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
129 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
130 @CoreMethod(names = "where", isModuleMethod = true, needsSelf = false, appendCallNode = true, minArgs = 1, maxArgs = 1) |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
131 public abstract static class WhereNode extends CoreMethodNode { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
132 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
133 public WhereNode(RubyContext context, SourceSection sourceSection) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
134 super(context, sourceSection); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
135 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
136 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
137 public WhereNode(WhereNode prev) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
138 super(prev); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
139 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
140 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
141 @Specialization |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
142 public NilPlaceholder where(Node callNode) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
143 getContext().getConfiguration().getStandardOut().println(callNode.getSourceSection()); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
144 return NilPlaceholder.INSTANCE; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
145 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
146 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
147 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
148 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
149 @CoreMethod(names = "remove", isModuleMethod = true, needsSelf = false, needsBlock = true, minArgs = 2, maxArgs = 2) |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
150 public abstract static class RemoveNode extends CoreMethodNode { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
151 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
152 public RemoveNode(RubyContext context, SourceSection sourceSection) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
153 super(context, sourceSection); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
154 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
155 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
156 public RemoveNode(RemoveNode prev) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
157 super(prev); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
158 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
159 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
160 @Specialization |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
161 public NilPlaceholder debugRemove(RubyString fileName, int line) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
162 final RubyContext context = getContext(); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
163 if (context.getConfiguration().getDebug()) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
164 final Source source = context.getSourceManager().get(fileName.toString()); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
165 final SourceLineLocation lineLocation = new SourceLineLocation(source, line); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
166 context.getRubyDebugManager().removeBreakpoint(lineLocation); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
167 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
168 return NilPlaceholder.INSTANCE; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
169 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
170 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
171 @Specialization |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
172 public NilPlaceholder debugRemove(RubySymbol methodName, RubySymbol localName) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
173 final RubyContext context = getContext(); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
174 if (context.getConfiguration().getDebug()) { |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
175 final RubyMethod method = context.getCoreLibrary().getMainObject().getLookupNode().lookupMethod(methodName.toString()); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
176 final MethodLocal methodLocal = new MethodLocal(method.getUniqueIdentifier(), localName.toString()); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
177 context.getRubyDebugManager().removeBreakpoint(methodLocal); |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
178 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
179 return NilPlaceholder.INSTANCE; |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
180 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
181 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
182 } |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
183 |
22bf5a8ba9eb
Ruby: restore prototype debugger.
Chris Seaton <chris.seaton@oracle.com>
parents:
diff
changeset
|
184 } |