home *** CD-ROM | disk | FTP | other *** search
- package sun.tools.debug;
-
- public class RemoteThread extends RemoteObject {
- private int currentFrame;
- private RemoteStackFrame[] stack;
- private boolean suspended = false;
-
- RemoteThread(RemoteAgent var1, int var2, RemoteClass var3) {
- super(var1, 19, var2, var3);
- }
-
- public String getName() throws Exception {
- return super.agent.getThreadName(super.id);
- }
-
- public int getCurrentFrameIndex() {
- return this.currentFrame;
- }
-
- public void setCurrentFrameIndex(int var1) {
- this.currentFrame = var1;
- }
-
- public void resetCurrentFrameIndex() {
- this.currentFrame = 0;
- }
-
- // $FF: renamed from: up (int) void
- public void method_0(int var1) throws Exception {
- int var2 = super.agent.getThreadStatus(super.id);
- if (var2 != 5 && var2 != 6) {
- throw new IllegalAccessError();
- } else {
- if (this.stack == null) {
- this.stack = super.agent.dumpStack(this);
- }
-
- if (this.currentFrame + var1 >= this.stack.length) {
- throw new ArrayIndexOutOfBoundsException();
- } else {
- this.currentFrame += var1;
- }
- }
- }
-
- public void down(int var1) throws Exception {
- int var2 = super.agent.getThreadStatus(super.id);
- if (var2 != 5 && var2 != 6) {
- throw new IllegalAccessError();
- } else {
- if (this.stack == null) {
- this.stack = super.agent.dumpStack(this);
- }
-
- if (this.currentFrame - var1 < 0) {
- throw new ArrayIndexOutOfBoundsException();
- } else {
- this.currentFrame -= var1;
- }
- }
- }
-
- public String getStatus() throws Exception {
- int var1 = super.agent.getThreadStatus(super.id);
- switch (var1) {
- case -1:
- return "";
- case 0:
- return "zombie";
- case 1:
- return "running";
- case 2:
- return "sleeping";
- case 3:
- return "waiting in a monitor";
- case 4:
- return "cond. waiting";
- case 5:
- return "suspended";
- case 6:
- return "at breakpoint";
- default:
- return "invalid status returned";
- }
- }
-
- public RemoteStackFrame[] dumpStack() throws Exception {
- this.stack = super.agent.dumpStack(this);
- return this.stack;
- }
-
- public RemoteStackFrame getCurrentFrame() throws Exception {
- int var1 = super.agent.getThreadStatus(super.id);
- if (var1 != 5 && var1 != 6) {
- throw new IllegalAccessError();
- } else {
- if (this.stack == null) {
- this.stack = super.agent.dumpStack(this);
- }
-
- return this.stack[this.currentFrame];
- }
- }
-
- public void suspend() throws Exception {
- if (!this.suspended) {
- super.agent.suspendThread(super.id);
- this.suspended = true;
- }
-
- }
-
- public void resume() throws Exception {
- if (this.suspended) {
- super.agent.resumeThread(super.id);
- this.suspended = false;
- }
-
- }
-
- public void step(boolean var1) throws Exception {
- int var2 = super.agent.getThreadStatus(super.id);
- if (var2 != 5 && var2 != 6) {
- throw new IllegalAccessError();
- } else {
- super.agent.stepThread(super.id, var1);
- }
- }
-
- public void next() throws Exception {
- int var1 = super.agent.getThreadStatus(super.id);
- if (var1 != 5 && var1 != 6) {
- throw new IllegalAccessError();
- } else {
- super.agent.stepNextThread(super.id);
- }
- }
-
- public boolean isSuspended() {
- return this.suspended;
- }
-
- public void cont() throws Exception {
- if (!this.suspended) {
- super.agent.resumeThread(super.id);
- }
-
- }
-
- public void stop() throws Exception {
- super.agent.stopThread(super.id);
- }
-
- public RemoteStackVariable getStackVariable(String var1) throws Exception {
- super.agent.message("getStackVariable: thread=" + this.getName() + ", currentFrame=" + this.currentFrame);
- int var2 = super.agent.getThreadStatus(super.id);
- if (var2 != 5 && var2 != 6) {
- super.agent.message("getStackVariable: bogus thread status=" + var2);
- return null;
- } else {
- if (this.stack == null) {
- this.stack = super.agent.dumpStack(this);
- }
-
- return this.stack[this.currentFrame].getLocalVariable(var1);
- }
- }
-
- public RemoteStackVariable[] getStackVariables() throws Exception {
- super.agent.message("getStackVariables: thread=" + this.getName() + ", currentFrame=" + this.currentFrame);
- int var1 = super.agent.getThreadStatus(super.id);
- if (var1 != 5 && var1 != 6) {
- super.agent.message("getStackVariables: bogus thread status=" + var1);
- return null;
- } else {
- if (this.stack == null) {
- this.stack = super.agent.dumpStack(this);
- }
-
- return this.stack[this.currentFrame].getLocalVariables();
- }
- }
- }
-