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