comparison graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/debug/RubyProcAfterLineProbe.java @ 13569:1894412de0ed

Ruby: major upgrade in debugging support, mainly for navigation: step, next (passing over calls), return (from enclosing function), etc. Also a few bug fixes.
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Wed, 08 Jan 2014 14:03:36 -0800
parents graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/debug/RubyProcAfterProbe.java@0fbee3eb71f0
children
comparison
equal deleted inserted replaced
13568:f29a358cf3da 13569:1894412de0ed
1 /*
2 * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. This
3 * code is released under a tri EPL/GPL/LGPL license. You can use it,
4 * redistribute it and/or modify it under the terms of the:
5 *
6 * Eclipse Public License version 1.0
7 * GNU General Public License version 2
8 * GNU Lesser General Public License version 2.1
9 */
10 package com.oracle.truffle.ruby.runtime.debug;
11
12 import com.oracle.truffle.api.frame.*;
13 import com.oracle.truffle.api.nodes.*;
14 import com.oracle.truffle.api.source.*;
15 import com.oracle.truffle.ruby.runtime.*;
16 import com.oracle.truffle.ruby.runtime.core.*;
17
18 /**
19 * A probe for instrumenting a Ruby program with a Ruby procedure to run on the return value from
20 * node execution at a line.
21 */
22 public final class RubyProcAfterLineProbe extends RubyLineProbe {
23
24 private final RubyProc proc;
25
26 public RubyProcAfterLineProbe(RubyContext context, SourceLineLocation location, RubyProc proc) {
27 super(context, location, false);
28 this.proc = proc;
29 }
30
31 @Override
32 public void leave(Node astNode, VirtualFrame frame) {
33 proc.call(frame.pack());
34 }
35
36 @Override
37 public void leave(Node astNode, VirtualFrame frame, boolean result) {
38 proc.call(frame.pack(), result);
39 }
40
41 @Override
42 public void leave(Node astNode, VirtualFrame frame, int result) {
43 proc.call(frame.pack(), result);
44 }
45
46 @Override
47 public void leave(Node astNode, VirtualFrame frame, double result) {
48 proc.call(frame.pack(), result);
49 }
50
51 @Override
52 public void leave(Node astNode, VirtualFrame frame, Object result) {
53 proc.call(frame.pack(), result);
54 }
55
56 @Override
57 public void leaveExceptional(Node astNode, VirtualFrame frame, Exception e) {
58 proc.call(frame.pack());
59 }
60 }