blob: 7c26bd0fd3d8484fde5aa17621e13aad600f5448 [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
Elliott Hughes6ba581a2011-10-25 11:45:35 -0700215int Dbg::ThreadContinuing(int new_state) {
216 return static_cast<int>(Thread::Current()->SetState(static_cast<Thread::State>(new_state)));
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700217}
218
219void Dbg::UndoDebuggerSuspensions() {
220 UNIMPLEMENTED(FATAL);
221}
222
223void Dbg::Exit(int status) {
224 UNIMPLEMENTED(FATAL);
225}
226
227const char* Dbg::GetClassDescriptor(JDWP::RefTypeId id) {
228 UNIMPLEMENTED(FATAL);
229 return NULL;
230}
231
232JDWP::ObjectId Dbg::GetClassObject(JDWP::RefTypeId id) {
233 UNIMPLEMENTED(FATAL);
234 return 0;
235}
236
237JDWP::RefTypeId Dbg::GetSuperclass(JDWP::RefTypeId id) {
238 UNIMPLEMENTED(FATAL);
239 return 0;
240}
241
242JDWP::ObjectId Dbg::GetClassLoader(JDWP::RefTypeId id) {
243 UNIMPLEMENTED(FATAL);
244 return 0;
245}
246
247uint32_t Dbg::GetAccessFlags(JDWP::RefTypeId id) {
248 UNIMPLEMENTED(FATAL);
249 return 0;
250}
251
252bool Dbg::IsInterface(JDWP::RefTypeId id) {
253 UNIMPLEMENTED(FATAL);
254 return false;
255}
256
257void Dbg::GetClassList(uint32_t* pNumClasses, JDWP::RefTypeId** pClassRefBuf) {
258 UNIMPLEMENTED(FATAL);
259}
260
261void Dbg::GetVisibleClassList(JDWP::ObjectId classLoaderId, uint32_t* pNumClasses, JDWP::RefTypeId** pClassRefBuf) {
262 UNIMPLEMENTED(FATAL);
263}
264
265void Dbg::GetClassInfo(JDWP::RefTypeId classId, uint8_t* pTypeTag, uint32_t* pStatus, const char** pSignature) {
266 UNIMPLEMENTED(FATAL);
267}
268
269bool Dbg::FindLoadedClassBySignature(const char* classDescriptor, JDWP::RefTypeId* pRefTypeId) {
270 UNIMPLEMENTED(FATAL);
271 return false;
272}
273
274void Dbg::GetObjectType(JDWP::ObjectId objectId, uint8_t* pRefTypeTag, JDWP::RefTypeId* pRefTypeId) {
275 UNIMPLEMENTED(FATAL);
276}
277
278uint8_t Dbg::GetClassObjectType(JDWP::RefTypeId refTypeId) {
279 UNIMPLEMENTED(FATAL);
280 return 0;
281}
282
283const char* Dbg::GetSignature(JDWP::RefTypeId refTypeId) {
284 UNIMPLEMENTED(FATAL);
285 return NULL;
286}
287
288const char* Dbg::GetSourceFile(JDWP::RefTypeId refTypeId) {
289 UNIMPLEMENTED(FATAL);
290 return NULL;
291}
292
293const char* Dbg::GetObjectTypeName(JDWP::ObjectId objectId) {
294 UNIMPLEMENTED(FATAL);
295 return NULL;
296}
297
298uint8_t Dbg::GetObjectTag(JDWP::ObjectId objectId) {
299 UNIMPLEMENTED(FATAL);
300 return 0;
301}
302
303int Dbg::GetTagWidth(int tag) {
304 UNIMPLEMENTED(FATAL);
305 return 0;
306}
307
308int Dbg::GetArrayLength(JDWP::ObjectId arrayId) {
309 UNIMPLEMENTED(FATAL);
310 return 0;
311}
312
313uint8_t Dbg::GetArrayElementTag(JDWP::ObjectId arrayId) {
314 UNIMPLEMENTED(FATAL);
315 return 0;
316}
317
318bool Dbg::OutputArray(JDWP::ObjectId arrayId, int firstIndex, int count, JDWP::ExpandBuf* pReply) {
319 UNIMPLEMENTED(FATAL);
320 return false;
321}
322
323bool Dbg::SetArrayElements(JDWP::ObjectId arrayId, int firstIndex, int count, const uint8_t* buf) {
324 UNIMPLEMENTED(FATAL);
325 return false;
326}
327
328JDWP::ObjectId Dbg::CreateString(const char* str) {
329 UNIMPLEMENTED(FATAL);
330 return 0;
331}
332
333JDWP::ObjectId Dbg::CreateObject(JDWP::RefTypeId classId) {
334 UNIMPLEMENTED(FATAL);
335 return 0;
336}
337
338JDWP::ObjectId Dbg::CreateArrayObject(JDWP::RefTypeId arrayTypeId, uint32_t length) {
339 UNIMPLEMENTED(FATAL);
340 return 0;
341}
342
343bool Dbg::MatchType(JDWP::RefTypeId instClassId, JDWP::RefTypeId classId) {
344 UNIMPLEMENTED(FATAL);
345 return false;
346}
347
348const char* Dbg::GetMethodName(JDWP::RefTypeId refTypeId, JDWP::MethodId id) {
349 UNIMPLEMENTED(FATAL);
350 return NULL;
351}
352
353void Dbg::OutputAllFields(JDWP::RefTypeId refTypeId, bool withGeneric, JDWP::ExpandBuf* pReply) {
354 UNIMPLEMENTED(FATAL);
355}
356
357void Dbg::OutputAllMethods(JDWP::RefTypeId refTypeId, bool withGeneric, JDWP::ExpandBuf* pReply) {
358 UNIMPLEMENTED(FATAL);
359}
360
361void Dbg::OutputAllInterfaces(JDWP::RefTypeId refTypeId, JDWP::ExpandBuf* pReply) {
362 UNIMPLEMENTED(FATAL);
363}
364
365void Dbg::OutputLineTable(JDWP::RefTypeId refTypeId, JDWP::MethodId methodId, JDWP::ExpandBuf* pReply) {
366 UNIMPLEMENTED(FATAL);
367}
368
369void Dbg::OutputVariableTable(JDWP::RefTypeId refTypeId, JDWP::MethodId id, bool withGeneric, JDWP::ExpandBuf* pReply) {
370 UNIMPLEMENTED(FATAL);
371}
372
373uint8_t Dbg::GetFieldBasicTag(JDWP::ObjectId objId, JDWP::FieldId fieldId) {
374 UNIMPLEMENTED(FATAL);
375 return 0;
376}
377
378uint8_t Dbg::GetStaticFieldBasicTag(JDWP::RefTypeId refTypeId, JDWP::FieldId fieldId) {
379 UNIMPLEMENTED(FATAL);
380 return 0;
381}
382
383void Dbg::GetFieldValue(JDWP::ObjectId objectId, JDWP::FieldId fieldId, JDWP::ExpandBuf* pReply) {
384 UNIMPLEMENTED(FATAL);
385}
386
387void Dbg::SetFieldValue(JDWP::ObjectId objectId, JDWP::FieldId fieldId, uint64_t value, int width) {
388 UNIMPLEMENTED(FATAL);
389}
390
391void Dbg::GetStaticFieldValue(JDWP::RefTypeId refTypeId, JDWP::FieldId fieldId, JDWP::ExpandBuf* pReply) {
392 UNIMPLEMENTED(FATAL);
393}
394
395void Dbg::SetStaticFieldValue(JDWP::RefTypeId refTypeId, JDWP::FieldId fieldId, uint64_t rawValue, int width) {
396 UNIMPLEMENTED(FATAL);
397}
398
399char* Dbg::StringToUtf8(JDWP::ObjectId strId) {
400 UNIMPLEMENTED(FATAL);
401 return NULL;
402}
403
404char* Dbg::GetThreadName(JDWP::ObjectId threadId) {
405 UNIMPLEMENTED(FATAL);
406 return NULL;
407}
408
409JDWP::ObjectId Dbg::GetThreadGroup(JDWP::ObjectId threadId) {
410 UNIMPLEMENTED(FATAL);
411 return 0;
412}
413
414char* Dbg::GetThreadGroupName(JDWP::ObjectId threadGroupId) {
415 UNIMPLEMENTED(FATAL);
416 return NULL;
417}
418
419JDWP::ObjectId Dbg::GetThreadGroupParent(JDWP::ObjectId threadGroupId) {
420 UNIMPLEMENTED(FATAL);
421 return 0;
422}
423
424JDWP::ObjectId Dbg::GetSystemThreadGroupId() {
425 UNIMPLEMENTED(FATAL);
426 return 0;
427}
428
429JDWP::ObjectId Dbg::GetMainThreadGroupId() {
430 UNIMPLEMENTED(FATAL);
431 return 0;
432}
433
434bool Dbg::GetThreadStatus(JDWP::ObjectId threadId, uint32_t* threadStatus, uint32_t* suspendStatus) {
435 UNIMPLEMENTED(FATAL);
436 return false;
437}
438
439uint32_t Dbg::GetThreadSuspendCount(JDWP::ObjectId threadId) {
440 UNIMPLEMENTED(FATAL);
441 return 0;
442}
443
444bool Dbg::ThreadExists(JDWP::ObjectId threadId) {
445 UNIMPLEMENTED(FATAL);
446 return false;
447}
448
449bool Dbg::IsSuspended(JDWP::ObjectId threadId) {
450 UNIMPLEMENTED(FATAL);
451 return false;
452}
453
454//void Dbg::WaitForSuspend(JDWP::ObjectId threadId);
455
456void Dbg::GetThreadGroupThreads(JDWP::ObjectId threadGroupId, JDWP::ObjectId** ppThreadIds, uint32_t* pThreadCount) {
457 UNIMPLEMENTED(FATAL);
458}
459
460void Dbg::GetAllThreads(JDWP::ObjectId** ppThreadIds, uint32_t* pThreadCount) {
461 UNIMPLEMENTED(FATAL);
462}
463
464int Dbg::GetThreadFrameCount(JDWP::ObjectId threadId) {
465 UNIMPLEMENTED(FATAL);
466 return 0;
467}
468
469bool Dbg::GetThreadFrame(JDWP::ObjectId threadId, int num, JDWP::FrameId* pFrameId, JDWP::JdwpLocation* pLoc) {
470 UNIMPLEMENTED(FATAL);
471 return false;
472}
473
474JDWP::ObjectId Dbg::GetThreadSelfId() {
475 UNIMPLEMENTED(FATAL);
476 return 0;
477}
478
479void Dbg::SuspendVM(bool isEvent) {
480 UNIMPLEMENTED(FATAL);
481}
482
483void Dbg::ResumeVM() {
484 UNIMPLEMENTED(FATAL);
485}
486
487void Dbg::SuspendThread(JDWP::ObjectId threadId) {
488 UNIMPLEMENTED(FATAL);
489}
490
491void Dbg::ResumeThread(JDWP::ObjectId threadId) {
492 UNIMPLEMENTED(FATAL);
493}
494
495void Dbg::SuspendSelf() {
496 UNIMPLEMENTED(FATAL);
497}
498
499bool Dbg::GetThisObject(JDWP::ObjectId threadId, JDWP::FrameId frameId, JDWP::ObjectId* pThisId) {
500 UNIMPLEMENTED(FATAL);
501 return false;
502}
503
504void Dbg::GetLocalValue(JDWP::ObjectId threadId, JDWP::FrameId frameId, int slot, uint8_t tag, uint8_t* buf, int expectedLen) {
505 UNIMPLEMENTED(FATAL);
506}
507
508void Dbg::SetLocalValue(JDWP::ObjectId threadId, JDWP::FrameId frameId, int slot, uint8_t tag, uint64_t value, int width) {
509 UNIMPLEMENTED(FATAL);
510}
511
512void Dbg::PostLocationEvent(const Method* method, int pcOffset, Object* thisPtr, int eventFlags) {
513 UNIMPLEMENTED(FATAL);
514}
515
516void Dbg::PostException(void* throwFp, int throwRelPc, void* catchFp, int catchRelPc, Object* exception) {
517 UNIMPLEMENTED(FATAL);
518}
519
520void Dbg::PostThreadStart(Thread* t) {
Elliott Hughes3bb81562011-10-21 18:52:59 -0700521 if (!gDebuggerConnected) {
522 return;
523 }
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700524 UNIMPLEMENTED(WARNING);
525}
526
527void Dbg::PostThreadDeath(Thread* t) {
Elliott Hughes3bb81562011-10-21 18:52:59 -0700528 if (!gDebuggerConnected) {
529 return;
530 }
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700531 UNIMPLEMENTED(WARNING);
532}
533
534void Dbg::PostClassPrepare(Class* c) {
535 UNIMPLEMENTED(FATAL);
536}
537
538bool Dbg::WatchLocation(const JDWP::JdwpLocation* pLoc) {
539 UNIMPLEMENTED(FATAL);
540 return false;
541}
542
543void Dbg::UnwatchLocation(const JDWP::JdwpLocation* pLoc) {
544 UNIMPLEMENTED(FATAL);
545}
546
547bool Dbg::ConfigureStep(JDWP::ObjectId threadId, JDWP::JdwpStepSize size, JDWP::JdwpStepDepth depth) {
548 UNIMPLEMENTED(FATAL);
549 return false;
550}
551
552void Dbg::UnconfigureStep(JDWP::ObjectId threadId) {
553 UNIMPLEMENTED(FATAL);
554}
555
556JDWP::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) {
557 UNIMPLEMENTED(FATAL);
558 return JDWP::ERR_NONE;
559}
560
561void Dbg::ExecuteMethod(DebugInvokeReq* pReq) {
562 UNIMPLEMENTED(FATAL);
563}
564
565void Dbg::RegisterObjectId(JDWP::ObjectId id) {
566 UNIMPLEMENTED(FATAL);
567}
568
569bool Dbg::DdmHandlePacket(const uint8_t* buf, int dataLen, uint8_t** pReplyBuf, int* pReplyLen) {
570 UNIMPLEMENTED(FATAL);
571 return false;
572}
573
574void Dbg::DdmConnected() {
575 UNIMPLEMENTED(FATAL);
576}
577
578void Dbg::DdmDisconnected() {
579 UNIMPLEMENTED(FATAL);
580}
581
Elliott Hughes3bb81562011-10-21 18:52:59 -0700582void Dbg::DdmSendChunk(int type, size_t byte_count, const uint8_t* buf) {
583 CHECK(buf != NULL);
584 iovec vec[1];
585 vec[0].iov_base = reinterpret_cast<void*>(const_cast<uint8_t*>(buf));
586 vec[0].iov_len = byte_count;
587 Dbg::DdmSendChunkV(type, vec, 1);
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700588}
589
590void Dbg::DdmSendChunkV(int type, const struct iovec* iov, int iovcnt) {
Elliott Hughes3bb81562011-10-21 18:52:59 -0700591 if (gJdwpState == NULL) {
592 LOG(VERBOSE) << "Debugger thread not active, ignoring DDM send: " << type;
593 } else {
Elliott Hughes376a7a02011-10-24 18:35:55 -0700594 gJdwpState->DdmSendChunkV(type, iov, iovcnt);
Elliott Hughes3bb81562011-10-21 18:52:59 -0700595 }
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700596}
597
598} // namespace art