Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/jdk.jdi/share/classes/com/sun/jdi/Location.java
41159 views
1
/*
2
* Copyright (c) 1998, 2017, 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. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package com.sun.jdi;
27
28
import com.sun.jdi.event.BreakpointEvent;
29
import com.sun.jdi.event.ExceptionEvent;
30
import com.sun.jdi.request.EventRequestManager;
31
32
/**
33
* A point within the executing code of the target VM.
34
* Locations are used to identify the current position of
35
* a suspended thread (analogous to an instruction pointer or
36
* program counter register in native programs). They are also used
37
* to identify the position at which to set a breakpoint.
38
* <p>
39
* The availability of a line number for a location will
40
* depend on the level of debugging information available from the
41
* target VM.
42
* <p>
43
* Several mirror interfaces have locations. Each such mirror
44
* extends a {@link Locatable} interface.
45
* <p>
46
* <a id="strata"><b>Strata</b></a>
47
* <p>
48
* The source information for a Location is dependent on the
49
* <i>stratum</i> which is used. A stratum is a source code
50
* level within a sequence of translations. For example,
51
* say the baz program is written in the programming language
52
* "Foo" then translated to the language "Bar" and finally
53
* translated into the Java programming language. The
54
* Java programming language stratum is named
55
* <code>"Java"</code>, let's say the other strata are named
56
* "Foo" and "Bar". A given location (as viewed by the
57
* {@link #sourceName()} and {@link #lineNumber()} methods)
58
* might be at line 14 of "baz.foo" in the <code>"Foo"</code>
59
* stratum, line 23 of "baz.bar" in the <code>"Bar"</code>
60
* stratum and line 71 of the <code>"Java"</code> stratum.
61
* Note that while the Java programming language may have
62
* only one source file for a reference type, this restriction
63
* does not apply to other strata - thus each Location should
64
* be consulted to determine its source path.
65
* Queries which do not specify a stratum
66
* ({@link #sourceName()}, {@link #sourcePath()} and
67
* {@link #lineNumber()}) use the VM's default stratum
68
* ({@link VirtualMachine#getDefaultStratum()}).
69
* If the specified stratum (whether explicitly specified
70
* by a method parameter or implicitly as the VM's default)
71
* is <code>null</code> or is not available in the declaring
72
* type, the declaring type's default stratum is used
73
* ({@link #declaringType()}.{@link ReferenceType#defaultStratum()
74
* defaultStratum()}). Note that in the normal case, of code
75
* that originates as Java programming language source, there
76
* will be only one stratum (<code>"Java"</code>) and it will be
77
* returned as the default. To determine the available strata
78
* use {@link ReferenceType#availableStrata()}.
79
*
80
* @see EventRequestManager
81
* @see StackFrame
82
* @see BreakpointEvent
83
* @see ExceptionEvent
84
* @see Locatable
85
*
86
* @author Robert Field
87
* @author Gordon Hirsch
88
* @author James McIlree
89
* @since 1.3
90
*/
91
public interface Location extends Mirror, Comparable<Location> {
92
93
/**
94
* Gets the type to which this Location belongs. Normally
95
* the declaring type is a {@link ClassType}, but executable
96
* locations also may exist within the static initializer of an
97
* {@link InterfaceType}.
98
*
99
* @return the {@link ReferenceType} containing this Location.
100
*/
101
ReferenceType declaringType();
102
103
/**
104
* Gets the method containing this Location.
105
*
106
* @return the location's {@link Method}.
107
*/
108
Method method();
109
110
/**
111
* Gets the code position within this location's method.
112
*
113
* @return the long representing the position within the method
114
* or -1 if location is within a native method.
115
*/
116
long codeIndex();
117
118
/**
119
* Gets an identifing name for the source corresponding to
120
* this location.
121
* <P>
122
* This method is equivalent to
123
* <code>sourceName(vm.getDefaultStratum())</code> -
124
* see {@link #sourceName(String)}
125
* for more information.
126
*
127
* @return a string specifying the source
128
* @throws AbsentInformationException if the source name is not
129
* known
130
*/
131
String sourceName() throws AbsentInformationException;
132
133
/**
134
* Gets an identifing name for the source corresponding to
135
* this location. Interpretation of this string is the
136
* responsibility of the source repository mechanism.
137
* <P>
138
* Returned name is for the specified <i>stratum</i>
139
* (see the {@link Location class comment} for a
140
* description of strata).
141
* <P>
142
* The returned string is the unqualified name of the source
143
* file for this Location. For example,
144
* <CODE>java.lang.Thread</CODE> would return
145
* <CODE>"Thread.java"</CODE>.
146
*
147
* @param stratum The stratum to retrieve information from
148
* or <code>null</code> for the declaring type's
149
* default stratum.
150
*
151
* @return a string specifying the source
152
*
153
* @throws AbsentInformationException if the source name is not
154
* known
155
*
156
* @since 1.4
157
*/
158
String sourceName(String stratum) throws AbsentInformationException;
159
160
/**
161
* Gets the path to the source corresponding to this
162
* location.
163
* <P>
164
* This method is equivalent to
165
* <code>sourcePath(vm.getDefaultStratum())</code> -
166
* see {@link #sourcePath(String)}
167
* for more information.
168
*
169
* @return a string specifying the source
170
*
171
* @throws AbsentInformationException if the source name is not
172
* known
173
*/
174
String sourcePath() throws AbsentInformationException;
175
176
/**
177
* Gets the path to the source corresponding to this
178
* location. Interpretation of this string is the
179
* responsibility of the source repository mechanism.
180
* <P>
181
* Returned path is for the specified <i>stratum</i>
182
* (see the {@link Location class comment} for a
183
* description of strata).
184
* <P>
185
* In the reference implementation, for strata which
186
* do not explicitly specify source path (the Java
187
* programming language stratum never does), the returned
188
* string is the package name of {@link #declaringType()}
189
* converted to a platform dependent path followed by the
190
* unqualified name of the source file for this Location
191
* ({@link #sourceName sourceName(stratum)}).
192
* For example, on a
193
* Windows platform, <CODE>java.lang.Thread</CODE>
194
* would return
195
* <CODE>"java\lang\Thread.java"</CODE>.
196
*
197
* @param stratum The stratum to retrieve information from
198
* or <code>null</code> for the declaring type's
199
* default stratum.
200
*
201
* @return a string specifying the source
202
*
203
* @throws AbsentInformationException if the source name is not
204
* known
205
*
206
* @since 1.4
207
*/
208
String sourcePath(String stratum) throws AbsentInformationException;
209
210
/**
211
* Gets the line number of this Location.
212
* <P>
213
* This method is equivalent to
214
* <code>lineNumber(vm.getDefaultStratum())</code> -
215
* see {@link #lineNumber(String)}
216
* for more information.
217
*
218
* @return an int specifying the line in the source, returns
219
* -1 if the information is not available; specifically, always
220
* returns -1 for native methods.
221
*/
222
int lineNumber();
223
224
/**
225
* The line number of this Location. The line number is
226
* relative to the source specified by
227
* {@link #sourceName(String) sourceName(stratum)}.
228
* <P>
229
* Returned line number is for the specified <i>stratum</i>
230
* (see the {@link Location class comment} for a
231
* description of strata).
232
*
233
* @param stratum The stratum to retrieve information from
234
* or <code>null</code> for the declaring type's
235
* default stratum.
236
*
237
* @return an int specifying the line in the source, returns
238
* -1 if the information is not available; specifically, always
239
* returns -1 for native methods.
240
*
241
* @since 1.4
242
*/
243
int lineNumber(String stratum);
244
245
/**
246
* Compares the specified Object with this Location for equality.
247
*
248
* @return true if the Object is a Location and if it refers to
249
* the same point in the same VM as this Location.
250
*/
251
boolean equals(Object obj);
252
253
/**
254
* Returns the hash code value for this Location.
255
*
256
* @return the integer hash code
257
*/
258
int hashCode();
259
}
260
261