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