001 002 003 package frysk.isa.watchpoints; 004 //This file is part of the program FRYSK. 005 // 006 // Copyright 2008, Red Hat Inc. 007 // 008 // FRYSK is free software; you can redistribute it and/or modify it 009 // under the terms of the GNU General Public License as published by 010 // the Free Software Foundation; version 2 of the License. 011 // 012 // FRYSK is distributed in the hope that it will be useful, but 013 // WITHOUT ANY WARRANTY; without even the implied warranty of 014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 // General Public License for more details. 016 // 017 // You should have received a copy of the GNU General Public License 018 // along with FRYSK; if not, write to the Free Software Foundation, 019 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 020 // 021 // In addition, as a special exception, Red Hat, Inc. gives You the 022 // additional right to link the code of FRYSK with code not covered 023 // under the GNU General Public License ("Non-GPL Code") and to 024 // distribute linked combinations including the two, subject to the 025 // limitations in this paragraph. Non-GPL Code permitted under this 026 // exception must only link to the code of FRYSK through those well 027 // defined interfaces identified in the file named EXCEPTION found in 028 // the source code files (the "Approved Interfaces"). The files of 029 // Non-GPL Code may instantiate templates or use macros or inline 030 // functions from the Approved Interfaces without causing the 031 // resulting work to be covered by the GNU General Public 032 // License. Only Red Hat, Inc. may make changes or additions to the 033 // list of Approved Interfaces. You must obey the GNU General Public 034 // License in all respects for all of the FRYSK code and other code 035 // used in conjunction with FRYSK except the Non-GPL Code covered by 036 // this exception. If you modify this file, you may extend this 037 // exception to your version of the file, but you are not obligated to 038 // do so. If you do not wish to provide this exception without 039 // modification, you must delete this exception statement from your 040 // version and license this file solely under the GPL without 041 // exception. 042 public class Watchpoint { 043 044 private final long address; 045 private final int range; 046 private final int register; 047 private final boolean writeOnly; 048 049 private Watchpoint(long address, int range, int register, boolean writeOnly) { 050 this.address = address; 051 this.range = range; 052 this.register = register; 053 this.writeOnly = writeOnly; 054 } 055 056 /** 057 * Create 058 * 059 * Watchpoint. This is an immutable class that carries only information. 060 * It is not connected with the underlying hardware, and there is no 061 * guarantee that the information contained in this class is current, 062 * or even exists at any given time. 063 * 064 * The watchpoint manager can, and will, optimize watchpoint allocation 065 * to maximize use; and it can, and will, sometimes combine or split 066 * hardware watchpoints. Thus this class is immutable, and cannot be 067 * changed after instantiation. If you want to alter a watchpoint, you should 068 * apply it via the WatchpointFunctionFactory, WatchpointFunction classes and 069 * their subclasses, and a new watchpoint object will be generated. 070 * 071 * Clients should not instantiate this class directly. 072 * 073 * @param address - address of watchpoint. 074 * @param range - range of the watchpoint. 075 * @param register - register watchpoint was allocated. 076 * @param writeOnly - true if the watchpoint will only trigger on a write. 077 */ 078 public static Watchpoint create(long address, int range, int register, boolean writeOnly) { 079 return new Watchpoint(address, range, register, writeOnly); 080 } 081 public int getRegister() { 082 return register; 083 } 084 085 public long getAddress() { 086 return address; 087 } 088 089 public int getRange() { 090 return range; 091 } 092 093 public boolean isWriteOnly() { 094 return writeOnly; 095 } 096 }