1 /* 2 * Copyright 2016, Google Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: 8 * 9 * Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * Redistributions in binary form must reproduce the above 12 * copyright notice, this list of conditions and the following disclaimer 13 * in the documentation and/or other materials provided with the 14 * distribution. 15 * Neither the name of Google Inc. nor the names of its 16 * contributors may be used to endorse or promote products derived from 17 * this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32 package org.jf.smalidea.debugging.value; 33 34 import com.intellij.openapi.project.Project; 35 import com.sun.jdi.*; 36 import org.jf.smalidea.psi.impl.SmaliMethod; 37 38 import java.util.List; 39 40 public class LazyThreadReference extends LazyObjectReference<ThreadReference> implements ThreadReference { 41 public LazyThreadReference(SmaliMethod method, Project project, int registerNumber, String type) { 42 super(method, project, registerNumber, type); 43 } 44 45 public ObjectReference currentContendedMonitor() throws IncompatibleThreadStateException { 46 return getValue().currentContendedMonitor(); 47 } 48 49 public void forceEarlyReturn(Value value) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException { 50 getValue().forceEarlyReturn(value); 51 } 52 53 public StackFrame frame(int index) throws IncompatibleThreadStateException { 54 return getValue().frame(index); 55 } 56 57 public int frameCount() throws IncompatibleThreadStateException { 58 return getValue().frameCount(); 59 } 60 61 public List<StackFrame> frames() throws IncompatibleThreadStateException { 62 return getValue().frames(); 63 } 64 65 public List<StackFrame> frames(int start, int length) throws IncompatibleThreadStateException { 66 return getValue().frames(start, length); 67 } 68 69 public void interrupt() { 70 getValue().interrupt(); 71 } 72 73 public boolean isAtBreakpoint() { 74 return getValue().isAtBreakpoint(); 75 } 76 77 public boolean isSuspended() { 78 return getValue().isSuspended(); 79 } 80 81 public String name() { 82 return getValue().name(); 83 } 84 85 public List<ObjectReference> ownedMonitors() throws IncompatibleThreadStateException { 86 return getValue().ownedMonitors(); 87 } 88 89 public List<MonitorInfo> ownedMonitorsAndFrames() throws IncompatibleThreadStateException { 90 return getValue().ownedMonitorsAndFrames(); 91 } 92 93 public void popFrames(StackFrame frame) throws IncompatibleThreadStateException { 94 getValue().popFrames(frame); 95 } 96 97 public void resume() { 98 getValue().resume(); 99 } 100 101 public int status() { 102 return getValue().status(); 103 } 104 105 public void stop(ObjectReference throwable) throws InvalidTypeException { 106 getValue().stop(throwable); 107 } 108 109 public void suspend() { 110 getValue().suspend(); 111 } 112 113 public int suspendCount() { 114 return getValue().suspendCount(); 115 } 116 117 public ThreadGroupReference threadGroup() { 118 return getValue().threadGroup(); 119 } 120 } 121