1 /*
2  * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.
8  *
9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  *
23  */
24 
25 package sun.jvm.hotspot.debugger.cdbg;
26 
27 import sun.jvm.hotspot.debugger.*;
28 
29 /** Describes in an abstract sense the kind of debug events which may
30     be received from the target process. On UNIX platforms these are
31     typically signals intercepted via ptrace or some other mechanism,
32     while on Windows they are usually exceptions. Also describes
33     certain types of events like loading and unloading of DSOs/DLLs
34     ("LoadObjects"). */
35 
36 public interface DebugEvent {
37   public static class Type {
Type()38     private Type() {}
39     /** Indicates a DSO/DLL was loaded by the target process */
40     public static final Type LOADOBJECT_LOAD   = new Type();
41     /** Indicates a DSO/DLL was unloaded by the target process */
42     public static final Type LOADOBJECT_UNLOAD = new Type();
43     /** Indicates a breakpoint was hit */
44     public static final Type BREAKPOINT        = new Type();
45     /** Indicates a single machine instruction was stepped */
46     public static final Type SINGLE_STEP       = new Type();
47     /** Indicates an unmapped memory address was read from or written
48         to by the target process */
49     public static final Type ACCESS_VIOLATION  = new Type();
50     /** Indicates an event of an unknown type occurred in the target
51         process (catch-all for implementations; but add more event
52         types) */
53     public static final Type UNKNOWN           = new Type();
54   }
55 
56   /** The type of this debug event; BREAKPOINT, SINGLE_STEP, etc. */
getType()57   public Type getType();
58 
59   /** Retrieves the ThreadProxy for the thread on which the event
60       occurred. This is always present. */
getThread()61   public ThreadProxy getThread();
62 
63   /** For BREAKPOINT, SINGLE_STEP, and ACCESS_VIOLATION events,
64       returns the program counter at which the event occurred.  For
65       other types of events returns an undefined value. */
getPC()66   public Address getPC();
67 
68   /** For ACCESS_VIOLATION events, indicates whether the fault
69       occurred on a write (vs. a read). For other types of events
70       returns an undefined value. */
getWasWrite()71   public boolean getWasWrite();
72 
73   /** For ACCESS_VIOLATION events, returns the address at which the
74       fault occurred. For LOADOBJECT_LOAD and LOADOBJECT_UNLOAD
75       events, returns the base address of the loadobject in the target
76       process's address space. For other types of events returns an
77       undefined value. */
getAddress()78   public Address getAddress();
79 
80   /** For UNKNOWN events, may return a detail message or may return
81       null. For other types of events returns an undefined value. */
getUnknownEventDetail()82   public String getUnknownEventDetail();
83 }
84