summaryrefslogtreecommitdiff
path: root/libjava/gnu/gcj/jvmti/Location.java
blob: 8fae4dde7fc35f9a6898fe1950efe0ace13d0559 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Location.java - a wrapper class for breakpoint locations in JVMTI

/* Copyright (C) 2006  Free Software Foundation

   This file is part of libgcj.

This software is copyrighted work licensed under the terms of the
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
details.  */

package gnu.gcj.jvmti;

import java.lang.Long;

/**
 * This class represents a breakpoint location (pair<jmethodID,jlocation>).
 * BreakpointManager uses this class as a key in the Map of installed
 * breakpoints.
 *
 * @author Keith Seitz (keiths@redhat.com)
 */
public class Location
{
  // method (a jmethodID in JVMTI)
  private long method;

  // index (a jlocation in JVMTI)
  private long location;

  /**
   * Constructor
   *
   * @param method   the method defined by this location (a jmethodID)
   * @param location the integer index of the insn in the method (a jlocation)
   */
  public Location (long method, long location)
  {
    this.method = method;
    this.location = location;
  }

  public int hashCode ()
  {
    return toString ().hashCode ();
  }

  public boolean equals (Object obj)
  {
    Location loc = (Location) obj;
    return (loc.method == method && loc.location == location);
  }

  /**
   * Converts the Location to a String
   */
  public String toString ()
  {
    return Long.toHexString (method) + "." + Long.toString (location);
  }
}