< prev index next >

src/jdk.jdi/share/classes/com/sun/jdi/Location.java

Print this page
rev 17275 : 8181417: Code cleanups in com.sun.jdi


   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 java.util.List;
  29 
  30 /**
  31  * A point within the executing code of the target VM.
  32  * Locations are used to identify the current position of
  33  * a suspended thread (analogous to an instruction pointer or
  34  * program counter register in native programs). They are also used
  35  * to identify the position at which to set a breakpoint.
  36  * <p>
  37  * The availability of a line number for a location will
  38  * depend on the level of debugging information available from the
  39  * target VM.
  40  * <p>
  41  * Several mirror interfaces have locations. Each such mirror
  42  * extends a {@link Locatable} interface.
  43  * <p>
  44  * <a id="strata"><b>Strata</b></a>
  45  * <p>
  46  * The source information for a Location is dependent on the
  47  * <i>stratum</i> which is used. A stratum is a source code
  48  * level within a sequence of translations.  For example,
  49  * say the baz program is written in the programming language


 111      * @return the long representing the position within the method
 112      * or -1 if location is within a native method.
 113      */
 114     long codeIndex();
 115 
 116     /**
 117      * Gets an identifing name for the source corresponding to
 118      * this location.
 119      * <P>
 120      * This method is equivalent to
 121      * <code>sourceName(vm.getDefaultStratum())</code> -
 122      * see {@link #sourceName(String)}
 123      * for more information.
 124      *
 125      * @return a string specifying the source
 126      * @throws AbsentInformationException if the source name is not
 127      * known
 128      */
 129     String sourceName() throws AbsentInformationException;
 130 
 131 
 132     /**
 133      * Gets an identifing name for the source corresponding to
 134      * this location. Interpretation of this string is the
 135      * responsibility of the source repository mechanism.
 136      * <P>
 137      * Returned name is for the specified <i>stratum</i>
 138      * (see the {@link Location class comment} for a
 139      * description of strata).
 140      * <P>
 141      * The returned string is the unqualified name of the source
 142      * file for this Location.  For example,
 143      * <CODE>java.lang.Thread</CODE> would return
 144      * <CODE>"Thread.java"</CODE>.
 145      *
 146      * @param stratum The stratum to retrieve information from
 147      * or <code>null</code> for the declaring type's
 148      * default stratum.
 149      *
 150      * @return a string specifying the source
 151      *
 152      * @throws AbsentInformationException if the source name is not
 153      * known
 154      *
 155      * @since 1.4
 156      */
 157     String sourceName(String stratum)
 158                         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     /**
 178      * Gets the path to the source corresponding to this
 179      * location. Interpretation of this string is the
 180      * responsibility of the source repository mechanism.
 181      * <P>
 182      * Returned path is for the specified <i>stratum</i>
 183      * (see the {@link Location class comment} for a
 184      * description of strata).
 185      * <P>
 186      * In the reference implementation, for strata which
 187      * do not explicitly specify source path (the Java
 188      * programming language stratum never does), the returned
 189      * string is the package name of {@link #declaringType()}
 190      * converted to a platform dependent path followed by the
 191      * unqualified name of the source file for this Location
 192      * ({@link #sourceName sourceName(stratum)}).
 193      * For example, on a
 194      * Windows platform, <CODE>java.lang.Thread</CODE>
 195      * would return
 196      * <CODE>"java\lang\Thread.java"</CODE>.
 197      *
 198      * @param stratum The stratum to retrieve information from
 199      * or <code>null</code> for the declaring type's
 200      * default stratum.
 201      *
 202      * @return a string specifying the source
 203      *
 204      * @throws AbsentInformationException if the source name is not
 205      * known
 206      *
 207      * @since 1.4
 208      */
 209     String sourcePath(String stratum)
 210                          throws AbsentInformationException;
 211 
 212     /**
 213      * Gets the line number of this Location.
 214      * <P>
 215      * This method is equivalent to
 216      * <code>lineNumber(vm.getDefaultStratum())</code> -
 217      * see {@link #lineNumber(String)}
 218      * for more information.
 219      *
 220      * @return an int specifying the line in the source, returns
 221      * -1 if the information is not available; specifically, always
 222      * returns -1 for native methods.
 223      */
 224     int lineNumber();
 225 
 226     /**
 227      * The line number of this Location.  The line number is
 228      * relative to the source specified by
 229      * {@link #sourceName(String) sourceName(stratum)}.
 230      * <P>




   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 /**
  29  * A point within the executing code of the target VM.
  30  * Locations are used to identify the current position of
  31  * a suspended thread (analogous to an instruction pointer or
  32  * program counter register in native programs). They are also used
  33  * to identify the position at which to set a breakpoint.
  34  * <p>
  35  * The availability of a line number for a location will
  36  * depend on the level of debugging information available from the
  37  * target VM.
  38  * <p>
  39  * Several mirror interfaces have locations. Each such mirror
  40  * extends a {@link Locatable} interface.
  41  * <p>
  42  * <a id="strata"><b>Strata</b></a>
  43  * <p>
  44  * The source information for a Location is dependent on the
  45  * <i>stratum</i> which is used. A stratum is a source code
  46  * level within a sequence of translations.  For example,
  47  * say the baz program is written in the programming language


 109      * @return the long representing the position within the method
 110      * or -1 if location is within a native method.
 111      */
 112     long codeIndex();
 113 
 114     /**
 115      * Gets an identifing name for the source corresponding to
 116      * this location.
 117      * <P>
 118      * This method is equivalent to
 119      * <code>sourceName(vm.getDefaultStratum())</code> -
 120      * see {@link #sourceName(String)}
 121      * for more information.
 122      *
 123      * @return a string specifying the source
 124      * @throws AbsentInformationException if the source name is not
 125      * known
 126      */
 127     String sourceName() throws AbsentInformationException;
 128 

 129     /**
 130      * Gets an identifing name for the source corresponding to
 131      * this location. Interpretation of this string is the
 132      * responsibility of the source repository mechanism.
 133      * <P>
 134      * Returned name is for the specified <i>stratum</i>
 135      * (see the {@link Location class comment} for a
 136      * description of strata).
 137      * <P>
 138      * The returned string is the unqualified name of the source
 139      * file for this Location.  For example,
 140      * <CODE>java.lang.Thread</CODE> would return
 141      * <CODE>"Thread.java"</CODE>.
 142      *
 143      * @param stratum The stratum to retrieve information from
 144      * or <code>null</code> for the declaring type's
 145      * default stratum.
 146      *
 147      * @return a string specifying the source
 148      *
 149      * @throws AbsentInformationException if the source name is not
 150      * known
 151      *
 152      * @since 1.4
 153      */
 154     String sourceName(String stratum) throws AbsentInformationException;

 155 
 156     /**
 157      * Gets the path to the source corresponding to this
 158      * location.
 159      * <P>
 160      * This method is equivalent to
 161      * <code>sourcePath(vm.getDefaultStratum())</code> -
 162      * see {@link #sourcePath(String)}
 163      * for more information.
 164      *
 165      * @return a string specifying the source
 166      *
 167      * @throws AbsentInformationException if the source name is not
 168      * known
 169      */
 170     String sourcePath() throws AbsentInformationException;
 171 

 172     /**
 173      * Gets the path to the source corresponding to this
 174      * location. Interpretation of this string is the
 175      * responsibility of the source repository mechanism.
 176      * <P>
 177      * Returned path is for the specified <i>stratum</i>
 178      * (see the {@link Location class comment} for a
 179      * description of strata).
 180      * <P>
 181      * In the reference implementation, for strata which
 182      * do not explicitly specify source path (the Java
 183      * programming language stratum never does), the returned
 184      * string is the package name of {@link #declaringType()}
 185      * converted to a platform dependent path followed by the
 186      * unqualified name of the source file for this Location
 187      * ({@link #sourceName sourceName(stratum)}).
 188      * For example, on a
 189      * Windows platform, <CODE>java.lang.Thread</CODE>
 190      * would return
 191      * <CODE>"java\lang\Thread.java"</CODE>.
 192      *
 193      * @param stratum The stratum to retrieve information from
 194      * or <code>null</code> for the declaring type's
 195      * default stratum.
 196      *
 197      * @return a string specifying the source
 198      *
 199      * @throws AbsentInformationException if the source name is not
 200      * known
 201      *
 202      * @since 1.4
 203      */
 204     String sourcePath(String stratum) throws AbsentInformationException;

 205 
 206     /**
 207      * Gets the line number of this Location.
 208      * <P>
 209      * This method is equivalent to
 210      * <code>lineNumber(vm.getDefaultStratum())</code> -
 211      * see {@link #lineNumber(String)}
 212      * for more information.
 213      *
 214      * @return an int specifying the line in the source, returns
 215      * -1 if the information is not available; specifically, always
 216      * returns -1 for native methods.
 217      */
 218     int lineNumber();
 219 
 220     /**
 221      * The line number of this Location.  The line number is
 222      * relative to the source specified by
 223      * {@link #sourceName(String) sourceName(stratum)}.
 224      * <P>


< prev index next >