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.) |
Elliott Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 30 | static JDWP::JdwpOptions gJdwpOptions; |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 31 | |
| 32 | // Runtime JDWP state. |
| 33 | static JDWP::JdwpState* gJdwpState = NULL; |
| 34 | static bool gDebuggerConnected; // debugger or DDMS is connected. |
| 35 | static 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 | */ |
| 54 | static bool ParseJdwpOption(const std::string& name, const std::string& value) { |
| 55 | if (name == "transport") { |
| 56 | if (value == "dt_socket") { |
Elliott Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 57 | gJdwpOptions.transport = JDWP::kJdwpTransportSocket; |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 58 | } else if (value == "dt_android_adb") { |
Elliott Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 59 | gJdwpOptions.transport = JDWP::kJdwpTransportAndroidAdb; |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 60 | } else { |
| 61 | LOG(ERROR) << "JDWP transport not supported: " << value; |
| 62 | return false; |
| 63 | } |
| 64 | } else if (name == "server") { |
| 65 | if (value == "n") { |
Elliott Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 66 | gJdwpOptions.server = false; |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 67 | } else if (value == "y") { |
Elliott Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 68 | gJdwpOptions.server = true; |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 69 | } 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 Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 75 | gJdwpOptions.suspend = false; |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 76 | } else if (value == "y") { |
Elliott Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 77 | gJdwpOptions.suspend = true; |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 78 | } 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 Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 85 | gJdwpOptions.host.clear(); |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 86 | std::string::size_type colon = value.find(':'); |
| 87 | if (colon != std::string::npos) { |
Elliott Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 88 | gJdwpOptions.host = value.substr(0, colon); |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 89 | 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 Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 103 | gJdwpOptions.port = port; |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 104 | } 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 | */ |
| 118 | bool 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 Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 131 | if (gJdwpOptions.transport == JDWP::kJdwpTransportUnknown) { |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 132 | LOG(ERROR) << "Must specify JDWP transport: " << options; |
| 133 | } |
Elliott Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 134 | if (!gJdwpOptions.server && (gJdwpOptions.host.empty() || gJdwpOptions.port == 0)) { |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 135 | 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 Hughes | d1cc836 | 2011-10-24 16:58:50 -0700 | [diff] [blame] | 143 | void Dbg::StartJdwp() { |
Elliott Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 144 | if (!gJdwpAllowed || !gJdwpConfigured) { |
| 145 | // No JDWP for you! |
| 146 | return; |
| 147 | } |
| 148 | |
Elliott Hughes | d1cc836 | 2011-10-24 16:58:50 -0700 | [diff] [blame] | 149 | // 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 Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 152 | gJdwpState = JDWP::JdwpState::Create(&gJdwpOptions); |
| 153 | if (gJdwpState == NULL) { |
| 154 | LOG(WARNING) << "debugger thread failed to initialize"; |
Elliott Hughes | d1cc836 | 2011-10-24 16:58:50 -0700 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | // If a debugger has already attached, send the "welcome" message. |
| 158 | // This may cause us to suspend all threads. |
Elliott Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 159 | if (gJdwpState->IsActive()) { |
Elliott Hughes | d1cc836 | 2011-10-24 16:58:50 -0700 | [diff] [blame] | 160 | //ScopedThreadStateChange(Thread::Current(), Thread::kRunnable); |
Elliott Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 161 | if (!gJdwpState->PostVMStart()) { |
Elliott Hughes | d1cc836 | 2011-10-24 16:58:50 -0700 | [diff] [blame] | 162 | LOG(WARNING) << "failed to post 'start' message to debugger"; |
| 163 | } |
| 164 | } |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 165 | } |
| 166 | |
Elliott Hughes | d1cc836 | 2011-10-24 16:58:50 -0700 | [diff] [blame] | 167 | void Dbg::StopJdwp() { |
Elliott Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 168 | delete gJdwpState; |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 169 | } |
| 170 | |
Elliott Hughes | 4ffd313 | 2011-10-24 12:06:42 -0700 | [diff] [blame] | 171 | void Dbg::SetJdwpAllowed(bool allowed) { |
| 172 | gJdwpAllowed = allowed; |
| 173 | } |
| 174 | |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 175 | DebugInvokeReq* Dbg::GetInvokeReq() { |
| 176 | UNIMPLEMENTED(FATAL); |
| 177 | return NULL; |
| 178 | } |
| 179 | |
| 180 | void Dbg::Connected() { |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 181 | CHECK(!gDebuggerConnected); |
| 182 | LOG(VERBOSE) << "JDWP has attached"; |
| 183 | gDebuggerConnected = true; |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | void Dbg::Active() { |
| 187 | UNIMPLEMENTED(FATAL); |
| 188 | } |
| 189 | |
| 190 | void Dbg::Disconnected() { |
| 191 | UNIMPLEMENTED(FATAL); |
| 192 | } |
| 193 | |
| 194 | bool Dbg::IsDebuggerConnected() { |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 195 | return gDebuggerActive; |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 196 | } |
| 197 | |
| 198 | bool Dbg::IsDebuggingEnabled() { |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 199 | return gJdwpConfigured; |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | int64_t Dbg::LastDebuggerActivity() { |
| 203 | UNIMPLEMENTED(WARNING); |
| 204 | return -1; |
| 205 | } |
| 206 | |
| 207 | int Dbg::ThreadRunning() { |
Elliott Hughes | d1cc836 | 2011-10-24 16:58:50 -0700 | [diff] [blame] | 208 | return static_cast<int>(Thread::Current()->SetState(Thread::kRunnable)); |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 209 | } |
| 210 | |
| 211 | int Dbg::ThreadWaiting() { |
Elliott Hughes | d1cc836 | 2011-10-24 16:58:50 -0700 | [diff] [blame] | 212 | return static_cast<int>(Thread::Current()->SetState(Thread::kVmWait)); |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | int Dbg::ThreadContinuing(int status) { |
| 216 | UNIMPLEMENTED(FATAL); |
| 217 | return 0; |
| 218 | } |
| 219 | |
| 220 | void Dbg::UndoDebuggerSuspensions() { |
| 221 | UNIMPLEMENTED(FATAL); |
| 222 | } |
| 223 | |
| 224 | void Dbg::Exit(int status) { |
| 225 | UNIMPLEMENTED(FATAL); |
| 226 | } |
| 227 | |
| 228 | const char* Dbg::GetClassDescriptor(JDWP::RefTypeId id) { |
| 229 | UNIMPLEMENTED(FATAL); |
| 230 | return NULL; |
| 231 | } |
| 232 | |
| 233 | JDWP::ObjectId Dbg::GetClassObject(JDWP::RefTypeId id) { |
| 234 | UNIMPLEMENTED(FATAL); |
| 235 | return 0; |
| 236 | } |
| 237 | |
| 238 | JDWP::RefTypeId Dbg::GetSuperclass(JDWP::RefTypeId id) { |
| 239 | UNIMPLEMENTED(FATAL); |
| 240 | return 0; |
| 241 | } |
| 242 | |
| 243 | JDWP::ObjectId Dbg::GetClassLoader(JDWP::RefTypeId id) { |
| 244 | UNIMPLEMENTED(FATAL); |
| 245 | return 0; |
| 246 | } |
| 247 | |
| 248 | uint32_t Dbg::GetAccessFlags(JDWP::RefTypeId id) { |
| 249 | UNIMPLEMENTED(FATAL); |
| 250 | return 0; |
| 251 | } |
| 252 | |
| 253 | bool Dbg::IsInterface(JDWP::RefTypeId id) { |
| 254 | UNIMPLEMENTED(FATAL); |
| 255 | return false; |
| 256 | } |
| 257 | |
| 258 | void Dbg::GetClassList(uint32_t* pNumClasses, JDWP::RefTypeId** pClassRefBuf) { |
| 259 | UNIMPLEMENTED(FATAL); |
| 260 | } |
| 261 | |
| 262 | void Dbg::GetVisibleClassList(JDWP::ObjectId classLoaderId, uint32_t* pNumClasses, JDWP::RefTypeId** pClassRefBuf) { |
| 263 | UNIMPLEMENTED(FATAL); |
| 264 | } |
| 265 | |
| 266 | void Dbg::GetClassInfo(JDWP::RefTypeId classId, uint8_t* pTypeTag, uint32_t* pStatus, const char** pSignature) { |
| 267 | UNIMPLEMENTED(FATAL); |
| 268 | } |
| 269 | |
| 270 | bool Dbg::FindLoadedClassBySignature(const char* classDescriptor, JDWP::RefTypeId* pRefTypeId) { |
| 271 | UNIMPLEMENTED(FATAL); |
| 272 | return false; |
| 273 | } |
| 274 | |
| 275 | void Dbg::GetObjectType(JDWP::ObjectId objectId, uint8_t* pRefTypeTag, JDWP::RefTypeId* pRefTypeId) { |
| 276 | UNIMPLEMENTED(FATAL); |
| 277 | } |
| 278 | |
| 279 | uint8_t Dbg::GetClassObjectType(JDWP::RefTypeId refTypeId) { |
| 280 | UNIMPLEMENTED(FATAL); |
| 281 | return 0; |
| 282 | } |
| 283 | |
| 284 | const char* Dbg::GetSignature(JDWP::RefTypeId refTypeId) { |
| 285 | UNIMPLEMENTED(FATAL); |
| 286 | return NULL; |
| 287 | } |
| 288 | |
| 289 | const char* Dbg::GetSourceFile(JDWP::RefTypeId refTypeId) { |
| 290 | UNIMPLEMENTED(FATAL); |
| 291 | return NULL; |
| 292 | } |
| 293 | |
| 294 | const char* Dbg::GetObjectTypeName(JDWP::ObjectId objectId) { |
| 295 | UNIMPLEMENTED(FATAL); |
| 296 | return NULL; |
| 297 | } |
| 298 | |
| 299 | uint8_t Dbg::GetObjectTag(JDWP::ObjectId objectId) { |
| 300 | UNIMPLEMENTED(FATAL); |
| 301 | return 0; |
| 302 | } |
| 303 | |
| 304 | int Dbg::GetTagWidth(int tag) { |
| 305 | UNIMPLEMENTED(FATAL); |
| 306 | return 0; |
| 307 | } |
| 308 | |
| 309 | int Dbg::GetArrayLength(JDWP::ObjectId arrayId) { |
| 310 | UNIMPLEMENTED(FATAL); |
| 311 | return 0; |
| 312 | } |
| 313 | |
| 314 | uint8_t Dbg::GetArrayElementTag(JDWP::ObjectId arrayId) { |
| 315 | UNIMPLEMENTED(FATAL); |
| 316 | return 0; |
| 317 | } |
| 318 | |
| 319 | bool Dbg::OutputArray(JDWP::ObjectId arrayId, int firstIndex, int count, JDWP::ExpandBuf* pReply) { |
| 320 | UNIMPLEMENTED(FATAL); |
| 321 | return false; |
| 322 | } |
| 323 | |
| 324 | bool Dbg::SetArrayElements(JDWP::ObjectId arrayId, int firstIndex, int count, const uint8_t* buf) { |
| 325 | UNIMPLEMENTED(FATAL); |
| 326 | return false; |
| 327 | } |
| 328 | |
| 329 | JDWP::ObjectId Dbg::CreateString(const char* str) { |
| 330 | UNIMPLEMENTED(FATAL); |
| 331 | return 0; |
| 332 | } |
| 333 | |
| 334 | JDWP::ObjectId Dbg::CreateObject(JDWP::RefTypeId classId) { |
| 335 | UNIMPLEMENTED(FATAL); |
| 336 | return 0; |
| 337 | } |
| 338 | |
| 339 | JDWP::ObjectId Dbg::CreateArrayObject(JDWP::RefTypeId arrayTypeId, uint32_t length) { |
| 340 | UNIMPLEMENTED(FATAL); |
| 341 | return 0; |
| 342 | } |
| 343 | |
| 344 | bool Dbg::MatchType(JDWP::RefTypeId instClassId, JDWP::RefTypeId classId) { |
| 345 | UNIMPLEMENTED(FATAL); |
| 346 | return false; |
| 347 | } |
| 348 | |
| 349 | const char* Dbg::GetMethodName(JDWP::RefTypeId refTypeId, JDWP::MethodId id) { |
| 350 | UNIMPLEMENTED(FATAL); |
| 351 | return NULL; |
| 352 | } |
| 353 | |
| 354 | void Dbg::OutputAllFields(JDWP::RefTypeId refTypeId, bool withGeneric, JDWP::ExpandBuf* pReply) { |
| 355 | UNIMPLEMENTED(FATAL); |
| 356 | } |
| 357 | |
| 358 | void Dbg::OutputAllMethods(JDWP::RefTypeId refTypeId, bool withGeneric, JDWP::ExpandBuf* pReply) { |
| 359 | UNIMPLEMENTED(FATAL); |
| 360 | } |
| 361 | |
| 362 | void Dbg::OutputAllInterfaces(JDWP::RefTypeId refTypeId, JDWP::ExpandBuf* pReply) { |
| 363 | UNIMPLEMENTED(FATAL); |
| 364 | } |
| 365 | |
| 366 | void Dbg::OutputLineTable(JDWP::RefTypeId refTypeId, JDWP::MethodId methodId, JDWP::ExpandBuf* pReply) { |
| 367 | UNIMPLEMENTED(FATAL); |
| 368 | } |
| 369 | |
| 370 | void Dbg::OutputVariableTable(JDWP::RefTypeId refTypeId, JDWP::MethodId id, bool withGeneric, JDWP::ExpandBuf* pReply) { |
| 371 | UNIMPLEMENTED(FATAL); |
| 372 | } |
| 373 | |
| 374 | uint8_t Dbg::GetFieldBasicTag(JDWP::ObjectId objId, JDWP::FieldId fieldId) { |
| 375 | UNIMPLEMENTED(FATAL); |
| 376 | return 0; |
| 377 | } |
| 378 | |
| 379 | uint8_t Dbg::GetStaticFieldBasicTag(JDWP::RefTypeId refTypeId, JDWP::FieldId fieldId) { |
| 380 | UNIMPLEMENTED(FATAL); |
| 381 | return 0; |
| 382 | } |
| 383 | |
| 384 | void Dbg::GetFieldValue(JDWP::ObjectId objectId, JDWP::FieldId fieldId, JDWP::ExpandBuf* pReply) { |
| 385 | UNIMPLEMENTED(FATAL); |
| 386 | } |
| 387 | |
| 388 | void Dbg::SetFieldValue(JDWP::ObjectId objectId, JDWP::FieldId fieldId, uint64_t value, int width) { |
| 389 | UNIMPLEMENTED(FATAL); |
| 390 | } |
| 391 | |
| 392 | void Dbg::GetStaticFieldValue(JDWP::RefTypeId refTypeId, JDWP::FieldId fieldId, JDWP::ExpandBuf* pReply) { |
| 393 | UNIMPLEMENTED(FATAL); |
| 394 | } |
| 395 | |
| 396 | void Dbg::SetStaticFieldValue(JDWP::RefTypeId refTypeId, JDWP::FieldId fieldId, uint64_t rawValue, int width) { |
| 397 | UNIMPLEMENTED(FATAL); |
| 398 | } |
| 399 | |
| 400 | char* Dbg::StringToUtf8(JDWP::ObjectId strId) { |
| 401 | UNIMPLEMENTED(FATAL); |
| 402 | return NULL; |
| 403 | } |
| 404 | |
| 405 | char* Dbg::GetThreadName(JDWP::ObjectId threadId) { |
| 406 | UNIMPLEMENTED(FATAL); |
| 407 | return NULL; |
| 408 | } |
| 409 | |
| 410 | JDWP::ObjectId Dbg::GetThreadGroup(JDWP::ObjectId threadId) { |
| 411 | UNIMPLEMENTED(FATAL); |
| 412 | return 0; |
| 413 | } |
| 414 | |
| 415 | char* Dbg::GetThreadGroupName(JDWP::ObjectId threadGroupId) { |
| 416 | UNIMPLEMENTED(FATAL); |
| 417 | return NULL; |
| 418 | } |
| 419 | |
| 420 | JDWP::ObjectId Dbg::GetThreadGroupParent(JDWP::ObjectId threadGroupId) { |
| 421 | UNIMPLEMENTED(FATAL); |
| 422 | return 0; |
| 423 | } |
| 424 | |
| 425 | JDWP::ObjectId Dbg::GetSystemThreadGroupId() { |
| 426 | UNIMPLEMENTED(FATAL); |
| 427 | return 0; |
| 428 | } |
| 429 | |
| 430 | JDWP::ObjectId Dbg::GetMainThreadGroupId() { |
| 431 | UNIMPLEMENTED(FATAL); |
| 432 | return 0; |
| 433 | } |
| 434 | |
| 435 | bool Dbg::GetThreadStatus(JDWP::ObjectId threadId, uint32_t* threadStatus, uint32_t* suspendStatus) { |
| 436 | UNIMPLEMENTED(FATAL); |
| 437 | return false; |
| 438 | } |
| 439 | |
| 440 | uint32_t Dbg::GetThreadSuspendCount(JDWP::ObjectId threadId) { |
| 441 | UNIMPLEMENTED(FATAL); |
| 442 | return 0; |
| 443 | } |
| 444 | |
| 445 | bool Dbg::ThreadExists(JDWP::ObjectId threadId) { |
| 446 | UNIMPLEMENTED(FATAL); |
| 447 | return false; |
| 448 | } |
| 449 | |
| 450 | bool Dbg::IsSuspended(JDWP::ObjectId threadId) { |
| 451 | UNIMPLEMENTED(FATAL); |
| 452 | return false; |
| 453 | } |
| 454 | |
| 455 | //void Dbg::WaitForSuspend(JDWP::ObjectId threadId); |
| 456 | |
| 457 | void Dbg::GetThreadGroupThreads(JDWP::ObjectId threadGroupId, JDWP::ObjectId** ppThreadIds, uint32_t* pThreadCount) { |
| 458 | UNIMPLEMENTED(FATAL); |
| 459 | } |
| 460 | |
| 461 | void Dbg::GetAllThreads(JDWP::ObjectId** ppThreadIds, uint32_t* pThreadCount) { |
| 462 | UNIMPLEMENTED(FATAL); |
| 463 | } |
| 464 | |
| 465 | int Dbg::GetThreadFrameCount(JDWP::ObjectId threadId) { |
| 466 | UNIMPLEMENTED(FATAL); |
| 467 | return 0; |
| 468 | } |
| 469 | |
| 470 | bool Dbg::GetThreadFrame(JDWP::ObjectId threadId, int num, JDWP::FrameId* pFrameId, JDWP::JdwpLocation* pLoc) { |
| 471 | UNIMPLEMENTED(FATAL); |
| 472 | return false; |
| 473 | } |
| 474 | |
| 475 | JDWP::ObjectId Dbg::GetThreadSelfId() { |
| 476 | UNIMPLEMENTED(FATAL); |
| 477 | return 0; |
| 478 | } |
| 479 | |
| 480 | void Dbg::SuspendVM(bool isEvent) { |
| 481 | UNIMPLEMENTED(FATAL); |
| 482 | } |
| 483 | |
| 484 | void Dbg::ResumeVM() { |
| 485 | UNIMPLEMENTED(FATAL); |
| 486 | } |
| 487 | |
| 488 | void Dbg::SuspendThread(JDWP::ObjectId threadId) { |
| 489 | UNIMPLEMENTED(FATAL); |
| 490 | } |
| 491 | |
| 492 | void Dbg::ResumeThread(JDWP::ObjectId threadId) { |
| 493 | UNIMPLEMENTED(FATAL); |
| 494 | } |
| 495 | |
| 496 | void Dbg::SuspendSelf() { |
| 497 | UNIMPLEMENTED(FATAL); |
| 498 | } |
| 499 | |
| 500 | bool Dbg::GetThisObject(JDWP::ObjectId threadId, JDWP::FrameId frameId, JDWP::ObjectId* pThisId) { |
| 501 | UNIMPLEMENTED(FATAL); |
| 502 | return false; |
| 503 | } |
| 504 | |
| 505 | void Dbg::GetLocalValue(JDWP::ObjectId threadId, JDWP::FrameId frameId, int slot, uint8_t tag, uint8_t* buf, int expectedLen) { |
| 506 | UNIMPLEMENTED(FATAL); |
| 507 | } |
| 508 | |
| 509 | void Dbg::SetLocalValue(JDWP::ObjectId threadId, JDWP::FrameId frameId, int slot, uint8_t tag, uint64_t value, int width) { |
| 510 | UNIMPLEMENTED(FATAL); |
| 511 | } |
| 512 | |
| 513 | void Dbg::PostLocationEvent(const Method* method, int pcOffset, Object* thisPtr, int eventFlags) { |
| 514 | UNIMPLEMENTED(FATAL); |
| 515 | } |
| 516 | |
| 517 | void Dbg::PostException(void* throwFp, int throwRelPc, void* catchFp, int catchRelPc, Object* exception) { |
| 518 | UNIMPLEMENTED(FATAL); |
| 519 | } |
| 520 | |
| 521 | void Dbg::PostThreadStart(Thread* t) { |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 522 | if (!gDebuggerConnected) { |
| 523 | return; |
| 524 | } |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 525 | UNIMPLEMENTED(WARNING); |
| 526 | } |
| 527 | |
| 528 | void Dbg::PostThreadDeath(Thread* t) { |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 529 | if (!gDebuggerConnected) { |
| 530 | return; |
| 531 | } |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 532 | UNIMPLEMENTED(WARNING); |
| 533 | } |
| 534 | |
| 535 | void Dbg::PostClassPrepare(Class* c) { |
| 536 | UNIMPLEMENTED(FATAL); |
| 537 | } |
| 538 | |
| 539 | bool Dbg::WatchLocation(const JDWP::JdwpLocation* pLoc) { |
| 540 | UNIMPLEMENTED(FATAL); |
| 541 | return false; |
| 542 | } |
| 543 | |
| 544 | void Dbg::UnwatchLocation(const JDWP::JdwpLocation* pLoc) { |
| 545 | UNIMPLEMENTED(FATAL); |
| 546 | } |
| 547 | |
| 548 | bool Dbg::ConfigureStep(JDWP::ObjectId threadId, JDWP::JdwpStepSize size, JDWP::JdwpStepDepth depth) { |
| 549 | UNIMPLEMENTED(FATAL); |
| 550 | return false; |
| 551 | } |
| 552 | |
| 553 | void Dbg::UnconfigureStep(JDWP::ObjectId threadId) { |
| 554 | UNIMPLEMENTED(FATAL); |
| 555 | } |
| 556 | |
| 557 | 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) { |
| 558 | UNIMPLEMENTED(FATAL); |
| 559 | return JDWP::ERR_NONE; |
| 560 | } |
| 561 | |
| 562 | void Dbg::ExecuteMethod(DebugInvokeReq* pReq) { |
| 563 | UNIMPLEMENTED(FATAL); |
| 564 | } |
| 565 | |
| 566 | void Dbg::RegisterObjectId(JDWP::ObjectId id) { |
| 567 | UNIMPLEMENTED(FATAL); |
| 568 | } |
| 569 | |
| 570 | bool Dbg::DdmHandlePacket(const uint8_t* buf, int dataLen, uint8_t** pReplyBuf, int* pReplyLen) { |
| 571 | UNIMPLEMENTED(FATAL); |
| 572 | return false; |
| 573 | } |
| 574 | |
| 575 | void Dbg::DdmConnected() { |
| 576 | UNIMPLEMENTED(FATAL); |
| 577 | } |
| 578 | |
| 579 | void Dbg::DdmDisconnected() { |
| 580 | UNIMPLEMENTED(FATAL); |
| 581 | } |
| 582 | |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 583 | void 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 Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 589 | } |
| 590 | |
| 591 | void Dbg::DdmSendChunkV(int type, const struct iovec* iov, int iovcnt) { |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 592 | if (gJdwpState == NULL) { |
| 593 | LOG(VERBOSE) << "Debugger thread not active, ignoring DDM send: " << type; |
| 594 | } else { |
Elliott Hughes | 376a7a0 | 2011-10-24 18:35:55 -0700 | [diff] [blame^] | 595 | gJdwpState->DdmSendChunkV(type, iov, iovcnt); |
Elliott Hughes | 3bb8156 | 2011-10-21 18:52:59 -0700 | [diff] [blame] | 596 | } |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 597 | } |
| 598 | |
| 599 | } // namespace art |