Milán Major

netscape-revival

1 branch
Code

sun-java/classsrc/sun/tools/debug/BreakpointSet.java

/*
 * @(#)BreakpointSet.java	1.4 96/01/09
 *
 * Copyright (c) 1995 Sun Microsystems, Inc. All Rights Reserved.
 *
 * Permission to use, copy, modify, and distribute this software
 * and its documentation for NON-COMMERCIAL purposes and without
 * fee is hereby granted provided that this copyright notice
 * appears in all copies. Please refer to the file "copyright.html"
 * for further important copyright and licensing information.
 *
 * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
 * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
 * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
 * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
 * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
 * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
 */

package sun.tools.debug;

class BreakpointSet implements AgentConstants {
    int		pc;
    int		opcode;
    Class	clazz;
    int		type;
    byte	condition[];

    BreakpointSet(int p, int op, Class objClass,
			 int type, byte cond[])  {
	pc = p;
	opcode = op;
	clazz = objClass;
	this.type = type;
	condition = cond;
    }

    void setUnconditional() {
	type = BKPT_NORMAL;
    }

    void addCondition(byte cond[]) {
	type = BKPT_CONDITIONAL;
	condition = cond;
    }

    public String toString() {
        String typeStr = null;
        switch (type) {
          case BKPT_NORMAL : typeStr = "normal"; break;
          case BKPT_ONESHOT : typeStr = "oneshot"; break;
          case BKPT_CONDITIONAL : typeStr = "conditional"; break;
        }
        return "bkpt: pc=" + pc + ", opcode=" + opcode + ", type=" + typeStr;
    }
}