blob: f8b52bcb79534c890ced5b7908007d243b46ac8c [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#include "debugger.h"
18
Elliott Hughes3bb81562011-10-21 18:52:59 -070019#include <sys/uio.h>
20
Elliott Hughes872d4ec2011-10-21 17:07:15 -070021namespace art {
22
Elliott Hughes4ffd3132011-10-24 12:06:42 -070023// JDWP is allowed unless the Zygote forbids it.
24static bool gJdwpAllowed = true;
25
Elliott Hughes3bb81562011-10-21 18:52:59 -070026// Was there a -Xrunjdwp or -agent argument on the command-line?
27static bool gJdwpConfigured = false;
28
29// Broken-down JDWP options. (Only valid if gJdwpConfigured is true.)
Elliott Hughes376a7a02011-10-24 18:35:55 -070030static JDWP::JdwpOptions gJdwpOptions;
Elliott Hughes3bb81562011-10-21 18:52:59 -070031
32// Runtime JDWP state.
33static JDWP::JdwpState* gJdwpState = NULL;
34static bool gDebuggerConnected; // debugger or DDMS is connected.
35static bool gDebuggerActive; // debugger is making requests.
36
37/*
38 * Handle one of the JDWP name/value pairs.
39 *
40 * JDWP options are:
41 * help: if specified, show help message and bail
42 * transport: may be dt_socket or dt_shmem
43 * address: for dt_socket, "host:port", or just "port" when listening
44 * server: if "y", wait for debugger to attach; if "n", attach to debugger
45 * timeout: how long to wait for debugger to connect / listen
46 *
47 * Useful with server=n (these aren't supported yet):
48 * onthrow=<exception-name>: connect to debugger when exception thrown
49 * onuncaught=y|n: connect to debugger when uncaught exception thrown
50 * launch=<command-line>: launch the debugger itself
51 *
52 * The "transport" option is required, as is "address" if server=n.
53 */
54static bool ParseJdwpOption(const std::string& name, const std::string& value) {
55 if (name == "transport") {
56 if (value == "dt_socket") {
Elliott Hughes376a7a02011-10-24 18:35:55 -070057 gJdwpOptions.transport = JDWP::kJdwpTransportSocket;
Elliott Hughes3bb81562011-10-21 18:52:59 -070058 } else if (value == "dt_android_adb") {
Elliott Hughes376a7a02011-10-24 18:35:55 -070059 gJdwpOptions.transport = JDWP::kJdwpTransportAndroidAdb;
Elliott Hughes3bb81562011-10-21 18:52:59 -070060 } else {
61 LOG(ERROR) << "JDWP transport not supported: " << value;
62 return false;
63 }
64 } else if (name == "server") {
65 if (value == "n") {
Elliott Hughes376a7a02011-10-24 18:35:55 -070066 gJdwpOptions.server = false;
Elliott Hughes3bb81562011-10-21 18:52:59 -070067 } else if (value == "y") {
Elliott Hughes376a7a02011-10-24 18:35:55 -070068 gJdwpOptions.server = true;
Elliott Hughes3bb81562011-10-21 18:52:59 -070069 } else {
70 LOG(ERROR) << "JDWP option 'server' must be 'y' or 'n'";
71 return false;
72 }
73 } else if (name == "suspend") {
74 if (value == "n") {
Elliott Hughes376a7a02011-10-24 18:35:55 -070075 gJdwpOptions.suspend = false;
Elliott Hughes3bb81562011-10-21 18:52:59 -070076 } else if (value == "y") {
Elliott Hughes376a7a02011-10-24 18:35:55 -070077 gJdwpOptions.suspend = true;
Elliott Hughes3bb81562011-10-21 18:52:59 -070078 } else {
79 LOG(ERROR) << "JDWP option 'suspend' must be 'y' or 'n'";
80 return false;
81 }
82 } else if (name == "address") {
83 /* this is either <port> or <host>:<port> */
84 std::string port_string;
Elliott Hughes376a7a02011-10-24 18:35:55 -070085 gJdwpOptions.host.clear();
Elliott Hughes3bb81562011-10-21 18:52:59 -070086 std::string::size_type colon = value.find(':');
87 if (colon != std::string::npos) {
Elliott Hughes376a7a02011-10-24 18:35:55 -070088 gJdwpOptions.host = value.substr(0, colon);
Elliott Hughes3bb81562011-10-21 18:52:59 -070089 port_string = value.substr(colon + 1);
90 } else {
91 port_string = value;
92 }
93 if (port_string.empty()) {
94 LOG(ERROR) << "JDWP address missing port: " << value;
95 return false;
96 }
97 char* end;
98 long port = strtol(port_string.c_str(), &end, 10);
99 if (*end != '\0') {
100 LOG(ERROR) << "JDWP address has junk in port field: " << value;
101 return false;
102 }
Elliott Hughes376a7a02011-10-24 18:35:55 -0700103 gJdwpOptions.port = port;
Elliott Hughes3bb81562011-10-21 18:52:59 -0700104 } else if (name == "launch" || name == "onthrow" || name == "oncaught" || name == "timeout") {
105 /* valid but unsupported */
106 LOG(INFO) << "Ignoring JDWP option '" << name << "'='" << value << "'";
107 } else {
108 LOG(INFO) << "Ignoring unrecognized JDWP option '" << name << "'='" << value << "'";
109 }
110
111 return true;
112}
113
114/*
115 * Parse the latter half of a -Xrunjdwp/-agentlib:jdwp= string, e.g.:
116 * "transport=dt_socket,address=8000,server=y,suspend=n"
117 */
118bool Dbg::ParseJdwpOptions(const std::string& options) {
119 std::vector<std::string> pairs;
120 Split(options, ',', pairs);
121
122 for (size_t i = 0; i < pairs.size(); ++i) {
123 std::string::size_type equals = pairs[i].find('=');
124 if (equals == std::string::npos) {
125 LOG(ERROR) << "Can't parse JDWP option '" << pairs[i] << "' in '" << options << "'";
126 return false;
127 }
128 ParseJdwpOption(pairs[i].substr(0, equals), pairs[i].substr(equals + 1));
129 }
130
Elliott Hughes376a7a02011-10-24 18:35:55 -0700131 if (gJdwpOptions.transport == JDWP::kJdwpTransportUnknown) {
Elliott Hughes3bb81562011-10-21 18:52:59 -0700132 LOG(ERROR) << "Must specify JDWP transport: " << options;
133 }
Elliott Hughes376a7a02011-10-24 18:35:55 -0700134 if (!gJdwpOptions.server && (gJdwpOptions.host.empty() || gJdwpOptions.port == 0)) {
Elliott Hughes3bb81562011-10-21 18:52:59 -0700135 LOG(ERROR) << "Must specify JDWP host and port when server=n: " << options;
136 return false;
137 }
138
139 gJdwpConfigured = true;
140 return true;
141}
142
Elliott Hughesd1cc8362011-10-24 16:58:50 -0700143void Dbg::StartJdwp() {
Elliott Hughes376a7a02011-10-24 18:35:55 -0700144 if (!gJdwpAllowed || !gJdwpConfigured) {
145 // No JDWP for you!
146 return;
147 }
148
Elliott Hughesd1cc8362011-10-24 16:58:50 -0700149 // Init JDWP if the debugger is enabled. This may connect out to a
150 // debugger, passively listen for a debugger, or block waiting for a
151 // debugger.
Elliott Hughes376a7a02011-10-24 18:35:55 -0700152 gJdwpState = JDWP::JdwpState::Create(&gJdwpOptions);
153 if (gJdwpState == NULL) {
154 LOG(WARNING) << "debugger thread failed to initialize";
Elliott Hughesd1cc8362011-10-24 16:58:50 -0700155 }
156
157 // If a debugger has already attached, send the "welcome" message.
158 // This may cause us to suspend all threads.
Elliott Hughes376a7a02011-10-24 18:35:55 -0700159 if (gJdwpState->IsActive()) {
Elliott Hughesd1cc8362011-10-24 16:58:50 -0700160 //ScopedThreadStateChange(Thread::Current(), Thread::kRunnable);
Elliott Hughes376a7a02011-10-24 18:35:55 -0700161 if (!gJdwpState->PostVMStart()) {
Elliott Hughesd1cc8362011-10-24 16:58:50 -0700162 LOG(WARNING) << "failed to post 'start' message to debugger";
163 }
164 }
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700165}
166
Elliott Hughesd1cc8362011-10-24 16:58:50 -0700167void Dbg::StopJdwp() {
Elliott Hughes376a7a02011-10-24 18:35:55 -0700168 delete gJdwpState;
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700169}
170
Elliott Hughes4ffd3132011-10-24 12:06:42 -0700171void Dbg::SetJdwpAllowed(bool allowed) {
172 gJdwpAllowed = allowed;
173}
174
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700175DebugInvokeReq* Dbg::GetInvokeReq() {
176 UNIMPLEMENTED(FATAL);
177 return NULL;
178}
179
180void Dbg::Connected() {
Elliott Hughes3bb81562011-10-21 18:52:59 -0700181 CHECK(!gDebuggerConnected);
182 LOG(VERBOSE) << "JDWP has attached";
183 gDebuggerConnected = true;
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700184}
185
186void Dbg::Active() {
187 UNIMPLEMENTED(FATAL);
188}
189
190void Dbg::Disconnected() {
191 UNIMPLEMENTED(FATAL);
192}
193
194bool Dbg::IsDebuggerConnected() {
Elliott Hughes3bb81562011-10-21 18:52:59 -0700195 return gDebuggerActive;
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700196}
197
198bool Dbg::IsDebuggingEnabled() {
Elliott Hughes3bb81562011-10-21 18:52:59 -0700199 return gJdwpConfigured;
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700200}
201
202int64_t Dbg::LastDebuggerActivity() {
203 UNIMPLEMENTED(WARNING);
204 return -1;
205}
206
207int Dbg::ThreadRunning() {
Elliott Hughesd1cc8362011-10-24 16:58:50 -0700208 return static_cast<int>(Thread::Current()->SetState(Thread::kRunnable));
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700209}
210
211int Dbg::ThreadWaiting() {
Elliott Hughesd1cc8362011-10-24 16:58:50 -0700212 return static_cast<int>(Thread::Current()->SetState(Thread::kVmWait));
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700213}
214
215int Dbg::ThreadContinuing(int status) {
216 UNIMPLEMENTED(FATAL);
217 return 0;
218}
219
220void Dbg::UndoDebuggerSuspensions() {
221 UNIMPLEMENTED(FATAL);
222}
223
224void Dbg::Exit(int status) {
225 UNIMPLEMENTED(FATAL);
226}
227
228const char* Dbg::GetClassDescriptor(JDWP::RefTypeId id) {
229 UNIMPLEMENTED(FATAL);
230 return NULL;
231}
232
233JDWP::ObjectId Dbg::GetClassObject(JDWP::RefTypeId id) {
234 UNIMPLEMENTED(FATAL);
235 return 0;
236}
237
238JDWP::RefTypeId Dbg::GetSuperclass(JDWP::RefTypeId id) {
239 UNIMPLEMENTED(FATAL);
240 return 0;
241}
242
243JDWP::ObjectId Dbg::GetClassLoader(JDWP::RefTypeId id) {
244 UNIMPLEMENTED(FATAL);
245 return 0;
246}
247
248uint32_t Dbg::GetAccessFlags(JDWP::RefTypeId id) {
249 UNIMPLEMENTED(FATAL);
250 return 0;
251}
252
253bool Dbg::IsInterface(JDWP::RefTypeId id) {
254 UNIMPLEMENTED(FATAL);
255 return false;
256}
257
258void Dbg::GetClassList(uint32_t* pNumClasses, JDWP::RefTypeId** pClassRefBuf) {
259 UNIMPLEMENTED(FATAL);
260}
261
262void Dbg::GetVisibleClassList(JDWP::ObjectId classLoaderId, uint32_t* pNumClasses, JDWP::RefTypeId** pClassRefBuf) {
263 UNIMPLEMENTED(FATAL);
264}
265
266void Dbg::GetClassInfo(JDWP::RefTypeId classId, uint8_t* pTypeTag, uint32_t* pStatus, const char** pSignature) {
267 UNIMPLEMENTED(FATAL);
268}
269
270bool Dbg::FindLoadedClassBySignature(const char* classDescriptor, JDWP::RefTypeId* pRefTypeId) {
271 UNIMPLEMENTED(FATAL);
272 return false;
273}
274
275void Dbg::GetObjectType(JDWP::ObjectId objectId, uint8_t* pRefTypeTag, JDWP::RefTypeId* pRefTypeId) {
276 UNIMPLEMENTED(FATAL);
277}
278
279uint8_t Dbg::GetClassObjectType(JDWP::RefTypeId refTypeId) {
280 UNIMPLEMENTED(FATAL);
281 return 0;
282}
283
284const char* Dbg::GetSignature(JDWP::RefTypeId refTypeId) {
285 UNIMPLEMENTED(FATAL);
286 return NULL;
287}
288
289const char* Dbg::GetSourceFile(JDWP::RefTypeId refTypeId) {
290 UNIMPLEMENTED(FATAL);
291 return NULL;
292}
293
294const char* Dbg::GetObjectTypeName(JDWP::ObjectId objectId) {
295 UNIMPLEMENTED(FATAL);
296 return NULL;
297}
298
299uint8_t Dbg::GetObjectTag(JDWP::ObjectId objectId) {
300 UNIMPLEMENTED(FATAL);
301 return 0;
302}
303
304int Dbg::GetTagWidth(int tag) {
305 UNIMPLEMENTED(FATAL);
306 return 0;
307}
308
309int Dbg::GetArrayLength(JDWP::ObjectId arrayId) {
310 UNIMPLEMENTED(FATAL);
311 return 0;
312}
313
314uint8_t Dbg::GetArrayElementTag(JDWP::ObjectId arrayId) {
315 UNIMPLEMENTED(FATAL);
316 return 0;
317}
318
319bool Dbg::OutputArray(JDWP::ObjectId arrayId, int firstIndex, int count, JDWP::ExpandBuf* pReply) {
320 UNIMPLEMENTED(FATAL);
321 return false;
322}
323
324bool Dbg::SetArrayElements(JDWP::ObjectId arrayId, int firstIndex, int count, const uint8_t* buf) {
325 UNIMPLEMENTED(FATAL);
326 return false;
327}
328
329JDWP::ObjectId Dbg::CreateString(const char* str) {
330 UNIMPLEMENTED(FATAL);
331 return 0;
332}
333
334JDWP::ObjectId Dbg::CreateObject(JDWP::RefTypeId classId) {
335 UNIMPLEMENTED(FATAL);
336 return 0;
337}
338
339JDWP::ObjectId Dbg::CreateArrayObject(JDWP::RefTypeId arrayTypeId, uint32_t length) {
340 UNIMPLEMENTED(FATAL);
341 return 0;
342}
343
344bool Dbg::MatchType(JDWP::RefTypeId instClassId, JDWP::RefTypeId classId) {
345 UNIMPLEMENTED(FATAL);
346 return false;
347}
348
349const char* Dbg::GetMethodName(JDWP::RefTypeId refTypeId, JDWP::MethodId id) {
350 UNIMPLEMENTED(FATAL);
351 return NULL;
352}
353
354void Dbg::OutputAllFields(JDWP::RefTypeId refTypeId, bool withGeneric, JDWP::ExpandBuf* pReply) {
355 UNIMPLEMENTED(FATAL);
356}
357
358void Dbg::OutputAllMethods(JDWP::RefTypeId refTypeId, bool withGeneric, JDWP::ExpandBuf* pReply) {
359 UNIMPLEMENTED(FATAL);
360}
361
362void Dbg::OutputAllInterfaces(JDWP::RefTypeId refTypeId, JDWP::ExpandBuf* pReply) {
363 UNIMPLEMENTED(FATAL);
364}
365
366void Dbg::OutputLineTable(JDWP::RefTypeId refTypeId, JDWP::MethodId methodId, JDWP::ExpandBuf* pReply) {
367 UNIMPLEMENTED(FATAL);
368}
369
370void Dbg::OutputVariableTable(JDWP::RefTypeId refTypeId, JDWP::MethodId id, bool withGeneric, JDWP::ExpandBuf* pReply) {
371 UNIMPLEMENTED(FATAL);
372}
373
374uint8_t Dbg::GetFieldBasicTag(JDWP::ObjectId objId, JDWP::FieldId fieldId) {
375 UNIMPLEMENTED(FATAL);
376 return 0;
377}
378
379uint8_t Dbg::GetStaticFieldBasicTag(JDWP::RefTypeId refTypeId, JDWP::FieldId fieldId) {
380 UNIMPLEMENTED(FATAL);
381 return 0;
382}
383
384void Dbg::GetFieldValue(JDWP::ObjectId objectId, JDWP::FieldId fieldId, JDWP::ExpandBuf* pReply) {
385 UNIMPLEMENTED(FATAL);
386}
387
388void Dbg::SetFieldValue(JDWP::ObjectId objectId, JDWP::FieldId fieldId, uint64_t value, int width) {
389 UNIMPLEMENTED(FATAL);
390}
391
392void Dbg::GetStaticFieldValue(JDWP::RefTypeId refTypeId, JDWP::FieldId fieldId, JDWP::ExpandBuf* pReply) {
393 UNIMPLEMENTED(FATAL);
394}
395
396void Dbg::SetStaticFieldValue(JDWP::RefTypeId refTypeId, JDWP::FieldId fieldId, uint64_t rawValue, int width) {
397 UNIMPLEMENTED(FATAL);
398}
399
400char* Dbg::StringToUtf8(JDWP::ObjectId strId) {
401 UNIMPLEMENTED(FATAL);
402 return NULL;
403}
404
405char* Dbg::GetThreadName(JDWP::ObjectId threadId) {
406 UNIMPLEMENTED(FATAL);
407 return NULL;
408}
409
410JDWP::ObjectId Dbg::GetThreadGroup(JDWP::ObjectId threadId) {
411 UNIMPLEMENTED(FATAL);
412 return 0;
413}
414
415char* Dbg::GetThreadGroupName(JDWP::ObjectId threadGroupId) {
416 UNIMPLEMENTED(FATAL);
417 return NULL;
418}
419
420JDWP::ObjectId Dbg::GetThreadGroupParent(JDWP::ObjectId threadGroupId) {
421 UNIMPLEMENTED(FATAL);
422 return 0;
423}
424
425JDWP::ObjectId Dbg::GetSystemThreadGroupId() {
426 UNIMPLEMENTED(FATAL);
427 return 0;
428}
429
430JDWP::ObjectId Dbg::GetMainThreadGroupId() {
431 UNIMPLEMENTED(FATAL);
432 return 0;
433}
434
435bool Dbg::GetThreadStatus(JDWP::ObjectId threadId, uint32_t* threadStatus, uint32_t* suspendStatus) {
436 UNIMPLEMENTED(FATAL);
437 return false;
438}
439
440uint32_t Dbg::GetThreadSuspendCount(JDWP::ObjectId threadId) {
441 UNIMPLEMENTED(FATAL);
442 return 0;
443}
444
445bool Dbg::ThreadExists(JDWP::ObjectId threadId) {
446 UNIMPLEMENTED(FATAL);
447 return false;
448}
449
450bool Dbg::IsSuspended(JDWP::ObjectId threadId) {
451 UNIMPLEMENTED(FATAL);
452 return false;
453}
454
455//void Dbg::WaitForSuspend(JDWP::ObjectId threadId);
456
457void Dbg::GetThreadGroupThreads(JDWP::ObjectId threadGroupId, JDWP::ObjectId** ppThreadIds, uint32_t* pThreadCount) {
458 UNIMPLEMENTED(FATAL);
459}
460
461void Dbg::GetAllThreads(JDWP::ObjectId** ppThreadIds, uint32_t* pThreadCount) {
462 UNIMPLEMENTED(FATAL);
463}
464
465int Dbg::GetThreadFrameCount(JDWP::ObjectId threadId) {
466 UNIMPLEMENTED(FATAL);
467 return 0;
468}
469
470bool Dbg::GetThreadFrame(JDWP::ObjectId threadId, int num, JDWP::FrameId* pFrameId, JDWP::JdwpLocation* pLoc) {
471 UNIMPLEMENTED(FATAL);
472 return false;
473}
474
475JDWP::ObjectId Dbg::GetThreadSelfId() {
476 UNIMPLEMENTED(FATAL);
477 return 0;
478}
479
480void Dbg::SuspendVM(bool isEvent) {
481 UNIMPLEMENTED(FATAL);
482}
483
484void Dbg::ResumeVM() {
485 UNIMPLEMENTED(FATAL);
486}
487
488void Dbg::SuspendThread(JDWP::ObjectId threadId) {
489 UNIMPLEMENTED(FATAL);
490}
491
492void Dbg::ResumeThread(JDWP::ObjectId threadId) {
493 UNIMPLEMENTED(FATAL);
494}
495
496void Dbg::SuspendSelf() {
497 UNIMPLEMENTED(FATAL);
498}
499
500bool Dbg::GetThisObject(JDWP::ObjectId threadId, JDWP::FrameId frameId, JDWP::ObjectId* pThisId) {
501 UNIMPLEMENTED(FATAL);
502 return false;
503}
504
505void Dbg::GetLocalValue(JDWP::ObjectId threadId, JDWP::FrameId frameId, int slot, uint8_t tag, uint8_t* buf, int expectedLen) {
506 UNIMPLEMENTED(FATAL);
507}
508
509void Dbg::SetLocalValue(JDWP::ObjectId threadId, JDWP::FrameId frameId, int slot, uint8_t tag, uint64_t value, int width) {
510 UNIMPLEMENTED(FATAL);
511}
512
513void Dbg::PostLocationEvent(const Method* method, int pcOffset, Object* thisPtr, int eventFlags) {
514 UNIMPLEMENTED(FATAL);
515}
516
517void Dbg::PostException(void* throwFp, int throwRelPc, void* catchFp, int catchRelPc, Object* exception) {
518 UNIMPLEMENTED(FATAL);
519}
520
521void Dbg::PostThreadStart(Thread* t) {
Elliott Hughes3bb81562011-10-21 18:52:59 -0700522 if (!gDebuggerConnected) {
523 return;
524 }
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700525 UNIMPLEMENTED(WARNING);
526}
527
528void Dbg::PostThreadDeath(Thread* t) {
Elliott Hughes3bb81562011-10-21 18:52:59 -0700529 if (!gDebuggerConnected) {
530 return;
531 }
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700532 UNIMPLEMENTED(WARNING);
533}
534
535void Dbg::PostClassPrepare(Class* c) {
536 UNIMPLEMENTED(FATAL);
537}
538
539bool Dbg::WatchLocation(const JDWP::JdwpLocation* pLoc) {
540 UNIMPLEMENTED(FATAL);
541 return false;
542}
543
544void Dbg::UnwatchLocation(const JDWP::JdwpLocation* pLoc) {
545 UNIMPLEMENTED(FATAL);
546}
547
548bool Dbg::ConfigureStep(JDWP::ObjectId threadId, JDWP::JdwpStepSize size, JDWP::JdwpStepDepth depth) {
549 UNIMPLEMENTED(FATAL);
550 return false;
551}
552
553void Dbg::UnconfigureStep(JDWP::ObjectId threadId) {
554 UNIMPLEMENTED(FATAL);
555}
556
557JDWP::JdwpError Dbg::InvokeMethod(JDWP::ObjectId threadId, JDWP::ObjectId objectId, JDWP::RefTypeId classId, JDWP::MethodId methodId, uint32_t numArgs, uint64_t* argArray, uint32_t options, uint8_t* pResultTag, uint64_t* pResultValue, JDWP::ObjectId* pExceptObj) {
558 UNIMPLEMENTED(FATAL);
559 return JDWP::ERR_NONE;
560}
561
562void Dbg::ExecuteMethod(DebugInvokeReq* pReq) {
563 UNIMPLEMENTED(FATAL);
564}
565
566void Dbg::RegisterObjectId(JDWP::ObjectId id) {
567 UNIMPLEMENTED(FATAL);
568}
569
570bool Dbg::DdmHandlePacket(const uint8_t* buf, int dataLen, uint8_t** pReplyBuf, int* pReplyLen) {
571 UNIMPLEMENTED(FATAL);
572 return false;
573}
574
575void Dbg::DdmConnected() {
576 UNIMPLEMENTED(FATAL);
577}
578
579void Dbg::DdmDisconnected() {
580 UNIMPLEMENTED(FATAL);
581}
582
Elliott Hughes3bb81562011-10-21 18:52:59 -0700583void Dbg::DdmSendChunk(int type, size_t byte_count, const uint8_t* buf) {
584 CHECK(buf != NULL);
585 iovec vec[1];
586 vec[0].iov_base = reinterpret_cast<void*>(const_cast<uint8_t*>(buf));
587 vec[0].iov_len = byte_count;
588 Dbg::DdmSendChunkV(type, vec, 1);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700589}
590
591void Dbg::DdmSendChunkV(int type, const struct iovec* iov, int iovcnt) {
Elliott Hughes3bb81562011-10-21 18:52:59 -0700592 if (gJdwpState == NULL) {
593 LOG(VERBOSE) << "Debugger thread not active, ignoring DDM send: " << type;
594 } else {
Elliott Hughes376a7a02011-10-24 18:35:55 -0700595 gJdwpState->DdmSendChunkV(type, iov, iovcnt);
Elliott Hughes3bb81562011-10-21 18:52:59 -0700596 }
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700597}
598
599} // namespace art