blob: 3a4d3980b0560ca0f88855721c6835b9c713e4ed [file] [log] [blame]
Elliott Hughes872d4ec2011-10-21 17:07:15 -07001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * JDWP initialization.
19 */
20
21#include "atomic.h"
22#include "debugger.h"
23#include "jdwp/jdwp_priv.h"
24#include "logging.h"
25
26#include <stdlib.h>
27#include <unistd.h>
28#include <sys/time.h>
29#include <time.h>
30#include <errno.h>
31
32namespace art {
33
34namespace JDWP {
35
Elliott Hughes376a7a02011-10-24 18:35:55 -070036static void* StartJdwpThread(void* arg);
Elliott Hughes872d4ec2011-10-21 17:07:15 -070037
38/*
39 * JdwpNetStateBase class implementation
40 */
41JdwpNetStateBase::JdwpNetStateBase() : socket_lock_("JdwpNetStateBase lock") {
42 clientSock = -1;
43}
44
45/*
46 * Write a packet. Grabs a mutex to assure atomicity.
47 */
48ssize_t JdwpNetStateBase::writePacket(ExpandBuf* pReply) {
49 MutexLock mu(socket_lock_);
50 return write(clientSock, expandBufGetBuffer(pReply), expandBufGetLength(pReply));
51}
52
53/*
54 * Write a buffered packet. Grabs a mutex to assure atomicity.
55 */
Elliott Hughescccd84f2011-12-05 16:51:54 -080056ssize_t JdwpNetStateBase::writeBufferedPacket(const iovec* iov, int iov_count) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -070057 MutexLock mu(socket_lock_);
Elliott Hughescccd84f2011-12-05 16:51:54 -080058 return writev(clientSock, iov, iov_count);
Elliott Hughes872d4ec2011-10-21 17:07:15 -070059}
60
Elliott Hughes376a7a02011-10-24 18:35:55 -070061bool JdwpState::IsConnected() {
Elliott Hughesa21039c2012-06-21 12:09:25 -070062 return (*transport_->isConnected)(this);
Elliott Hughes872d4ec2011-10-21 17:07:15 -070063}
64
Elliott Hughes376a7a02011-10-24 18:35:55 -070065bool JdwpState::SendRequest(ExpandBuf* pReq) {
Elliott Hughesa21039c2012-06-21 12:09:25 -070066 return (*transport_->sendRequest)(this, pReq);
Elliott Hughes872d4ec2011-10-21 17:07:15 -070067}
68
Elliott Hughes376a7a02011-10-24 18:35:55 -070069/*
70 * Get the next "request" serial number. We use this when sending
71 * packets to the debugger.
72 */
73uint32_t JdwpState::NextRequestSerial() {
74 MutexLock mu(serial_lock_);
Elliott Hughesf8349362012-06-18 15:00:06 -070075 return request_serial_++;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070076}
77
Elliott Hughes376a7a02011-10-24 18:35:55 -070078/*
79 * Get the next "event" serial number. We use this in the response to
80 * message type EventRequest.Set.
81 */
82uint32_t JdwpState::NextEventSerial() {
83 MutexLock mu(serial_lock_);
Elliott Hughesf8349362012-06-18 15:00:06 -070084 return event_serial_++;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070085}
86
Elliott Hughes376a7a02011-10-24 18:35:55 -070087JdwpState::JdwpState(const JdwpOptions* options)
88 : options_(options),
89 thread_start_lock_("JDWP thread start lock"),
Elliott Hughes872d4ec2011-10-21 17:07:15 -070090 thread_start_cond_("JDWP thread start condition variable"),
91 debug_thread_started_(false),
Elliott Hughesa21039c2012-06-21 12:09:25 -070092 debug_thread_id_(0),
Elliott Hughes872d4ec2011-10-21 17:07:15 -070093 run(false),
Elliott Hughesa21039c2012-06-21 12:09:25 -070094 transport_(NULL),
Elliott Hughes872d4ec2011-10-21 17:07:15 -070095 netState(NULL),
96 attach_lock_("JDWP attach lock"),
97 attach_cond_("JDWP attach condition variable"),
Elliott Hughesa21039c2012-06-21 12:09:25 -070098 last_activity_time_ms_(0),
Elliott Hughes872d4ec2011-10-21 17:07:15 -070099 serial_lock_("JDWP serial lock"),
Elliott Hughesf8349362012-06-18 15:00:06 -0700100 request_serial_(0x10000000),
101 event_serial_(0x20000000),
102 event_list_lock_("JDWP event list lock"),
103 event_list_(NULL),
104 event_list_size_(0),
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700105 event_thread_lock_("JDWP event thread lock"),
106 event_thread_cond_("JDWP event thread condition variable"),
Elliott Hughesa21039c2012-06-21 12:09:25 -0700107 event_thread_id_(0),
108 ddm_is_active_(false) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700109}
110
111/*
112 * Initialize JDWP.
113 *
114 * Does not return until JDWP thread is running, but may return before
115 * the thread is accepting network connections.
116 */
Elliott Hughes376a7a02011-10-24 18:35:55 -0700117JdwpState* JdwpState::Create(const JdwpOptions* options) {
Elliott Hughes761928d2011-11-16 18:33:03 -0800118 UniquePtr<JdwpState> state(new JdwpState(options));
Elliott Hughes376a7a02011-10-24 18:35:55 -0700119 switch (options->transport) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700120 case kJdwpTransportSocket:
121 // LOGD("prepping for JDWP over TCP");
Elliott Hughesa21039c2012-06-21 12:09:25 -0700122 state->transport_ = SocketTransport();
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700123 break;
124#ifdef HAVE_ANDROID_OS
125 case kJdwpTransportAndroidAdb:
126 // LOGD("prepping for JDWP over ADB");
Elliott Hughesa21039c2012-06-21 12:09:25 -0700127 state->transport_ = AndroidAdbTransport();
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700128 break;
129#endif
130 default:
Elliott Hughes376a7a02011-10-24 18:35:55 -0700131 LOG(FATAL) << "Unknown transport: " << options->transport;
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700132 }
133
Elliott Hughesa21039c2012-06-21 12:09:25 -0700134 if (!(*state->transport_->startup)(state.get(), options)) {
Elliott Hughes761928d2011-11-16 18:33:03 -0800135 return NULL;
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700136 }
137
138 /*
139 * Grab a mutex or two before starting the thread. This ensures they
140 * won't signal the cond var before we're waiting.
141 */
142 state->thread_start_lock_.Lock();
Elliott Hughesf8349362012-06-18 15:00:06 -0700143 const bool should_suspend = options->suspend;
144 if (should_suspend) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700145 state->attach_lock_.Lock();
146 }
147
148 /*
149 * We have bound to a port, or are trying to connect outbound to a
150 * debugger. Create the JDWP thread and let it continue the mission.
151 */
Elliott Hughes761928d2011-11-16 18:33:03 -0800152 CHECK_PTHREAD_CALL(pthread_create, (&state->pthread_, NULL, StartJdwpThread, state.get()), "JDWP thread");
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700153
154 /*
155 * Wait until the thread finishes basic initialization.
156 * TODO: cond vars should be waited upon in a loop
157 */
158 state->thread_start_cond_.Wait(state->thread_start_lock_);
159 state->thread_start_lock_.Unlock();
160
161 /*
162 * For suspend=y, wait for the debugger to connect to us or for us to
163 * connect to the debugger.
164 *
165 * The JDWP thread will signal us when it connects successfully or
166 * times out (for timeout=xxx), so we have to check to see what happened
167 * when we wake up.
168 */
Elliott Hughesf8349362012-06-18 15:00:06 -0700169 if (should_suspend) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700170 {
Elliott Hughes34e06962012-04-09 13:55:55 -0700171 ScopedThreadStateChange tsc(Thread::Current(), kVmWait);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700172
173 state->attach_cond_.Wait(state->attach_lock_);
174 state->attach_lock_.Unlock();
175 }
176
Elliott Hughes376a7a02011-10-24 18:35:55 -0700177 if (!state->IsActive()) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700178 LOG(ERROR) << "JDWP connection failed";
Elliott Hughes761928d2011-11-16 18:33:03 -0800179 return NULL;
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700180 }
181
182 LOG(INFO) << "JDWP connected";
183
184 /*
185 * Ordinarily we would pause briefly to allow the debugger to set
186 * breakpoints and so on, but for "suspend=y" the VM init code will
187 * pause the VM when it sends the VM_START message.
188 */
189 }
190
Elliott Hughes761928d2011-11-16 18:33:03 -0800191 return state.release();
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700192}
193
194/*
195 * Reset all session-related state. There should not be an active connection
196 * to the client at this point. The rest of the VM still thinks there is
197 * a debugger attached.
198 *
199 * This includes freeing up the debugger event list.
200 */
Elliott Hughes376a7a02011-10-24 18:35:55 -0700201void JdwpState::ResetState() {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700202 /* could reset the serial numbers, but no need to */
203
Elliott Hughes761928d2011-11-16 18:33:03 -0800204 UnregisterAll();
Elliott Hughesf8349362012-06-18 15:00:06 -0700205 {
206 MutexLock mu(event_list_lock_);
207 CHECK(event_list_ == NULL);
208 }
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700209
210 /*
211 * Should not have one of these in progress. If the debugger went away
212 * mid-request, though, we could see this.
213 */
Elliott Hughesa21039c2012-06-21 12:09:25 -0700214 if (event_thread_id_ != 0) {
Elliott Hughes3d30d9b2011-12-07 17:35:48 -0800215 LOG(WARNING) << "Resetting state while event in progress";
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700216 DCHECK(false);
217 }
218}
219
220/*
221 * Tell the JDWP thread to shut down. Frees "state".
222 */
Elliott Hughes376a7a02011-10-24 18:35:55 -0700223JdwpState::~JdwpState() {
Elliott Hughesa21039c2012-06-21 12:09:25 -0700224 if (transport_ != NULL) {
Elliott Hughes376a7a02011-10-24 18:35:55 -0700225 if (IsConnected()) {
226 PostVMDeath();
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700227 }
228
229 /*
230 * Close down the network to inspire the thread to halt.
231 */
Elliott Hughes0cc1bbd2012-01-12 12:27:08 -0800232 VLOG(jdwp) << "JDWP shutting down net...";
Elliott Hughesa21039c2012-06-21 12:09:25 -0700233 (*transport_->shutdown)(this);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700234
Elliott Hughes376a7a02011-10-24 18:35:55 -0700235 if (debug_thread_started_) {
236 run = false;
237 void* threadReturn;
Elliott Hughes475fc232011-10-25 15:00:35 -0700238 if (pthread_join(pthread_, &threadReturn) != 0) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700239 LOG(WARNING) << "JDWP thread join failed";
240 }
241 }
242
Elliott Hughes0cc1bbd2012-01-12 12:27:08 -0800243 VLOG(jdwp) << "JDWP freeing netstate...";
Elliott Hughesa21039c2012-06-21 12:09:25 -0700244 (*transport_->free)(this);
Elliott Hughes376a7a02011-10-24 18:35:55 -0700245 netState = NULL;
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700246 }
Elliott Hughes376a7a02011-10-24 18:35:55 -0700247 CHECK(netState == NULL);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700248
Elliott Hughes376a7a02011-10-24 18:35:55 -0700249 ResetState();
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700250}
251
252/*
253 * Are we talking to a debugger?
254 */
Elliott Hughes376a7a02011-10-24 18:35:55 -0700255bool JdwpState::IsActive() {
256 return IsConnected();
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700257}
258
259/*
260 * Entry point for JDWP thread. The thread was created through the VM
261 * mechanisms, so there is a java/lang/Thread associated with us.
262 */
Elliott Hughes376a7a02011-10-24 18:35:55 -0700263static void* StartJdwpThread(void* arg) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700264 JdwpState* state = reinterpret_cast<JdwpState*>(arg);
265 CHECK(state != NULL);
266
Elliott Hughes376a7a02011-10-24 18:35:55 -0700267 state->Run();
268 return NULL;
269}
270
271void JdwpState::Run() {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700272 Runtime* runtime = Runtime::Current();
Elliott Hughes462c9442012-03-23 18:47:50 -0700273 runtime->AttachCurrentThread("JDWP", true, Thread::GetSystemThreadGroup());
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700274
Elliott Hughes4dd9b4d2011-12-12 18:29:24 -0800275 VLOG(jdwp) << "JDWP: thread running";
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700276
277 /*
Elliott Hughes376a7a02011-10-24 18:35:55 -0700278 * Finish initializing, then notify the creating thread that
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700279 * we're running.
280 */
Elliott Hughes475fc232011-10-25 15:00:35 -0700281 thread_ = Thread::Current();
Elliott Hughes376a7a02011-10-24 18:35:55 -0700282 run = true;
283 android_atomic_release_store(true, &debug_thread_started_);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700284
Elliott Hughes376a7a02011-10-24 18:35:55 -0700285 thread_start_lock_.Lock();
286 thread_start_cond_.Broadcast();
287 thread_start_lock_.Unlock();
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700288
289 /* set the thread state to VMWAIT so GCs don't wait for us */
290 Dbg::ThreadWaiting();
291
292 /*
293 * Loop forever if we're in server mode, processing connections. In
294 * non-server mode, we bail out of the thread when the debugger drops
295 * us.
296 *
297 * We broadcast a notification when a debugger attaches, after we
298 * successfully process the handshake.
299 */
Elliott Hughes376a7a02011-10-24 18:35:55 -0700300 while (run) {
301 if (options_->server) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700302 /*
303 * Block forever, waiting for a connection. To support the
304 * "timeout=xxx" option we'll need to tweak this.
305 */
Elliott Hughesa21039c2012-06-21 12:09:25 -0700306 if (!(*transport_->accept)(this)) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700307 break;
308 }
309 } else {
310 /*
311 * If we're not acting as a server, we need to connect out to the
312 * debugger. To support the "timeout=xxx" option we need to
313 * have a timeout if the handshake reply isn't received in a
314 * reasonable amount of time.
315 */
Elliott Hughesa21039c2012-06-21 12:09:25 -0700316 if (!(*transport_->establish)(this, options_)) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700317 /* wake anybody who was waiting for us to succeed */
Elliott Hughes376a7a02011-10-24 18:35:55 -0700318 MutexLock mu(attach_lock_);
319 attach_cond_.Broadcast();
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700320 break;
321 }
322 }
323
324 /* prep debug code to handle the new connection */
325 Dbg::Connected();
326
327 /* process requests until the debugger drops */
Elliott Hughes376a7a02011-10-24 18:35:55 -0700328 bool first = true;
Elliott Hughes86964332012-02-15 19:37:42 -0800329 while (!Dbg::IsDisposed()) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700330 // sanity check -- shouldn't happen?
Elliott Hughes34e06962012-04-09 13:55:55 -0700331 if (Thread::Current()->GetState() != kVmWait) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700332 LOG(ERROR) << "JDWP thread no longer in VMWAIT (now " << Thread::Current()->GetState() << "); resetting";
333 Dbg::ThreadWaiting();
334 }
335
Elliott Hughesa21039c2012-06-21 12:09:25 -0700336 if (!(*transport_->processIncoming)(this)) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700337 /* blocking read */
338 break;
339 }
340
Elliott Hughesa21039c2012-06-21 12:09:25 -0700341 if (first && !(*transport_->awaitingHandshake)(this)) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700342 /* handshake worked, tell the interpreter that we're active */
343 first = false;
344
345 /* set thread ID; requires object registry to be active */
Elliott Hughesa21039c2012-06-21 12:09:25 -0700346 debug_thread_id_ = Dbg::GetThreadSelfId();
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700347
348 /* wake anybody who's waiting for us */
Elliott Hughes376a7a02011-10-24 18:35:55 -0700349 MutexLock mu(attach_lock_);
350 attach_cond_.Broadcast();
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700351 }
352 }
353
Elliott Hughesa21039c2012-06-21 12:09:25 -0700354 (*transport_->close)(this);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700355
Elliott Hughesa21039c2012-06-21 12:09:25 -0700356 if (ddm_is_active_) {
357 ddm_is_active_ = false;
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700358
359 /* broadcast the disconnect; must be in RUNNING state */
360 Dbg::ThreadRunning();
361 Dbg::DdmDisconnected();
362 Dbg::ThreadWaiting();
363 }
364
365 /* release session state, e.g. remove breakpoint instructions */
Elliott Hughes376a7a02011-10-24 18:35:55 -0700366 ResetState();
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700367
368 /* tell the interpreter that the debugger is no longer around */
369 Dbg::Disconnected();
370
371 /* if we had threads suspended, resume them now */
372 Dbg::UndoDebuggerSuspensions();
373
374 /* if we connected out, this was a one-shot deal */
Elliott Hughes376a7a02011-10-24 18:35:55 -0700375 if (!options_->server) {
376 run = false;
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700377 }
378 }
379
380 /* back to running, for thread shutdown */
381 Dbg::ThreadRunning();
382
Elliott Hughes4dd9b4d2011-12-12 18:29:24 -0800383 VLOG(jdwp) << "JDWP: thread detaching and exiting...";
Elliott Hughes6ba581a2011-10-25 11:45:35 -0700384 runtime->DetachCurrentThread();
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700385}
386
Elliott Hughesa21039c2012-06-21 12:09:25 -0700387void JdwpState::NotifyDdmsActive() {
388 if (!ddm_is_active_) {
389 ddm_is_active_ = true;
390 Dbg::DdmConnected();
391 }
392}
393
Elliott Hughes475fc232011-10-25 15:00:35 -0700394Thread* JdwpState::GetDebugThread() {
395 return thread_;
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700396}
397
398/*
399 * Support routines for waitForDebugger().
400 *
401 * We can't have a trivial "waitForDebugger" function that returns the
402 * instant the debugger connects, because we run the risk of executing code
403 * before the debugger has had a chance to configure breakpoints or issue
404 * suspend calls. It would be nice to just sit in the suspended state, but
405 * most debuggers don't expect any threads to be suspended when they attach.
406 *
407 * There's no JDWP event we can post to tell the debugger, "we've stopped,
408 * and we like it that way". We could send a fake breakpoint, which should
409 * cause the debugger to immediately send a resume, but the debugger might
410 * send the resume immediately or might throw an exception of its own upon
411 * receiving a breakpoint event that it didn't ask for.
412 *
413 * What we really want is a "wait until the debugger is done configuring
414 * stuff" event. We can approximate this with a "wait until the debugger
415 * has been idle for a brief period".
416 */
417
418/*
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700419 * Return the time, in milliseconds, since the last debugger activity.
420 *
421 * Returns -1 if no debugger is attached, or 0 if we're in the middle of
422 * processing a debugger request.
423 */
Elliott Hughes376a7a02011-10-24 18:35:55 -0700424int64_t JdwpState::LastDebuggerActivity() {
Elliott Hughesc0f09332012-03-26 13:27:06 -0700425 if (!Dbg::IsDebuggerActive()) {
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700426 LOG(DEBUG) << "no active debugger";
427 return -1;
428 }
429
Elliott Hughesa21039c2012-06-21 12:09:25 -0700430 int64_t last = QuasiAtomic::Read64(&last_activity_time_ms_);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700431
432 /* initializing or in the middle of something? */
433 if (last == 0) {
Elliott Hughes4dd9b4d2011-12-12 18:29:24 -0800434 VLOG(jdwp) << "+++ last=busy";
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700435 return 0;
436 }
437
438 /* now get the current time */
Elliott Hughes7162ad92011-10-27 14:08:42 -0700439 int64_t now = MilliTime();
Elliott Hughesc3b3e752012-01-27 13:48:50 -0800440 CHECK_GE(now, last);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700441
Elliott Hughes4dd9b4d2011-12-12 18:29:24 -0800442 VLOG(jdwp) << "+++ debugger interval=" << (now - last);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700443 return now - last;
444}
445
Elliott Hughes03181a82011-11-17 17:22:21 -0800446std::ostream& operator<<(std::ostream& os, const JdwpLocation& rhs) {
Elliott Hughesd07986f2011-12-06 18:27:45 -0800447 os << "JdwpLocation["
Elliott Hughes74847412012-06-20 18:10:21 -0700448 << Dbg::GetClassName(rhs.class_id) << "." << Dbg::GetMethodName(rhs.class_id, rhs.method_id)
449 << "@" << StringPrintf("%#llx", rhs.dex_pc) << " " << rhs.type_tag << "]";
Elliott Hughes03181a82011-11-17 17:22:21 -0800450 return os;
451}
452
Elliott Hughes2aa2e392012-02-17 17:15:43 -0800453bool operator==(const JdwpLocation& lhs, const JdwpLocation& rhs) {
Elliott Hughes74847412012-06-20 18:10:21 -0700454 return lhs.dex_pc == rhs.dex_pc && lhs.method_id == rhs.method_id &&
455 lhs.class_id == rhs.class_id && lhs.type_tag == rhs.type_tag;
Elliott Hughes2aa2e392012-02-17 17:15:43 -0800456}
457
458bool operator!=(const JdwpLocation& lhs, const JdwpLocation& rhs) {
459 return !(lhs == rhs);
460}
461
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700462} // namespace JDWP
463
464} // namespace art