Lines Matching defs:thread
86 ScopedObjectAccessUnchecked soa(Thread::Current());
91 ScopedObjectAccessUnchecked soa(Thread::Current());
109 ScopedObjectAccessUnchecked soa(Thread::Current());
128 Thread* self = Thread::Current();
140 return down_cast<mirror::Class*>(Thread::Current()->DecodeJObject(type_));
189 ScopedObjectAccessUnchecked soa(Thread::Current());
196 ScopedObjectAccessUnchecked soa(Thread::Current());
201 ScopedObjectAccessUnchecked soa(Thread::Current());
233 void MethodEntered(Thread* thread, mirror::Object* this_object, mirror::ArtMethod* method,
240 Dbg::UpdateDebugger(thread, this_object, method, 0, Dbg::kMethodEntry, nullptr);
243 void MethodExited(Thread* thread, mirror::Object* this_object, mirror::ArtMethod* method,
250 Dbg::UpdateDebugger(thread, this_object, method, dex_pc, Dbg::kMethodExit, &return_value);
253 void MethodUnwind(Thread* thread, mirror::Object* this_object, mirror::ArtMethod* method,
261 void DexPcMoved(Thread* thread, mirror::Object* this_object, mirror::ArtMethod* method,
264 Dbg::UpdateDebugger(thread, this_object, method, new_dex_pc, 0, nullptr);
267 void FieldRead(Thread* thread, mirror::Object* this_object, mirror::ArtMethod* method,
273 void FieldWritten(Thread* thread, mirror::Object* this_object, mirror::ArtMethod* method,
279 void ExceptionCaught(Thread* thread, const ThrowLocation& throw_location,
345 if (thread != nullptr) {
346 callback(&thread, arg, tid, root_type);
359 thread = nullptr;
384 ReaderMutexLock mu(Thread::Current(), *Locks::breakpoint_lock_);
394 static bool IsSuspendedForDebugger(ScopedObjectAccessUnchecked& soa, Thread* thread)
397 // A thread may be suspended for GC; in this code, we really want to know whether
399 return thread->IsSuspended() && thread->GetDebugSuspendCount() > 0;
432 static JDWP::JdwpError DecodeThread(ScopedObjectAccessUnchecked& soa, JDWP::ObjectId thread_id, Thread*& thread)
444 // This isn't a thread.
448 thread = Thread::FromManagedThread(soa, thread_peer);
449 if (thread == NULL) {
450 // This is a java.lang.Thread without a Thread*. Must be a zombie.
658 LOG(FATAL) << "Debugger thread failed to initialize";
664 ScopedObjectAccess soa(Thread::Current());
672 // Post VM_DEATH event before the JDWP connection is closed (either by the JDWP thread or the
677 // Prevent the JDWP thread from processing JDWP incoming packets after we close the connection.
687 ScopedObjectAccess soa(Thread::Current());
692 ScopedObjectAccess soa(Thread::Current());
697 ScopedObjectAccess soa(Thread::Current());
708 return Thread::Current()->GetInvokeReq();
711 Thread* Dbg::GetDebugThread() {
737 // Only called from the JDWP handler thread.
744 ReaderMutexLock mu(Thread::Current(), *Locks::breakpoint_lock_);
749 MutexLock mu(Thread::Current(), *Locks::deoptimization_lock_);
763 Thread* self = Thread::Current();
780 // Suspend all threads and exclusively acquire the mutator lock. Set the state of the thread
785 Thread* self = Thread::Current();
794 MutexLock mu(Thread::Current(), *Locks::deoptimization_lock_);
914 Thread* self = Thread::Current();
941 OwnedMonitorVisitor(Thread* thread, Context* context,
945 : StackVisitor(thread, context), current_stack_depth(0),
970 ScopedObjectAccessUnchecked soa(Thread::Current());
971 Thread* thread;
974 JDWP::JdwpError error = DecodeThread(soa, thread_id, thread);
978 if (!IsSuspendedForDebugger(soa, thread)) {
983 OwnedMonitorVisitor visitor(thread, context.get(), &monitors, &stack_depths);
991 ScopedObjectAccessUnchecked soa(Thread::Current());
994 Thread* thread;
995 JDWP::JdwpError error = DecodeThread(soa, thread_id, thread);
999 if (!IsSuspendedForDebugger(soa, thread)) {
1002 contended_monitor_obj = Monitor::GetContendedMonitor(thread);
1242 ScopedObjectAccessUnchecked soa(Thread::Current());
1323 ScopedObjectAccessUnchecked soa(Thread::Current());
1391 return gRegistry->Add(mirror::String::AllocFromModifiedUtf8(Thread::Current(), str.c_str()));
1400 new_object = gRegistry->Add(c->AllocObject(Thread::Current()));
1414 new_array = gRegistry->Add(mirror::Array::Alloc<true>(Thread::Current(), c, length,
1443 bool Dbg::MatchThread(JDWP::ObjectId expected_thread_id, Thread* event_thread) {
1626 Thread* self = Thread::Current();
1895 StackHandleScope<3> hs(Thread::Current());
1927 ScopedObjectAccessUnchecked soa(Thread::Current());
1953 ScopedObjectAccessUnchecked soa(Thread::Current());
1961 ScopedObjectAccessUnchecked soa(Thread::Current());
1963 Thread* thread;
1964 JDWP::JdwpError error = DecodeThread(soa, thread_id, thread);
1969 // We still need to report the zombie threads' names, so we can't just call Thread::GetThreadName.
1982 ScopedObjectAccessUnchecked soa(Thread::Current());
1988 // Okay, so it's an object, but is it actually a thread?
1992 Thread* thread;
1993 error = DecodeThread(soa, thread_id, thread);
2033 ScopedObjectAccessUnchecked soa(Thread::Current());
2052 ScopedObjectAccessUnchecked soa(Thread::Current());
2076 // Get the ArrayList<ThreadGroup> "groups" out of this thread group...
2096 ScopedObjectAccessUnchecked soa(Thread::Current());
2113 // Add child thread groups.
2127 ScopedObjectAccessUnchecked soa(Thread::Current());
2163 LOG(FATAL) << "Unknown thread state: " << state;
2169 ScopedObjectAccess soa(Thread::Current());
2174 Thread* thread;
2175 JDWP::JdwpError error = DecodeThread(soa, thread_id, thread);
2184 if (IsSuspendedForDebugger(soa, thread)) {
2188 *pThreadStatus = ToJdwpThreadStatus(thread->GetState());
2193 ScopedObjectAccess soa(Thread::Current());
2195 Thread* thread;
2196 JDWP::JdwpError error = DecodeThread(soa, thread_id, thread);
2201 expandBufAdd4BE(pReply, thread->GetDebugSuspendCount());
2206 ScopedObjectAccess soa(Thread::Current());
2208 Thread* thread;
2209 JDWP::JdwpError error = DecodeThread(soa, thread_id, thread);
2213 thread->Interrupt(soa.Self());
2220 // Do we want threads from all thread groups?
2231 ScopedObjectAccessUnchecked soa(Thread::Current());
2232 std::list<Thread*> all_threads_list;
2234 MutexLock mu(Thread::Current(), *Locks::thread_list_lock_);
2237 for (Thread* t : all_threads_list) {
2239 // Skip the JDWP thread. Some debuggers get bent out of shape when they can't suspend and
2240 // query all threads, so it's easier if we just don't tell them about this thread.
2244 // This thread is being started (and has been registered in the thread list). However, it is
2250 // peer might be NULL if the thread is still starting up. We can't tell the debugger about
2251 // this thread yet.
2252 // TODO: if we identified threads to the debugger by their Thread*
2263 static int GetStackDepth(Thread* thread) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
2265 explicit CountStackDepthVisitor(Thread* thread)
2266 : StackVisitor(thread, NULL), depth(0) {}
2279 CountStackDepthVisitor visitor(thread);
2285 ScopedObjectAccess soa(Thread::Current());
2287 Thread* thread;
2288 JDWP::JdwpError error = DecodeThread(soa, thread_id, thread);
2292 if (!IsSuspendedForDebugger(soa, thread)) {
2295 result = GetStackDepth(thread);
2303 GetFrameVisitor(Thread* thread, size_t start_frame, size_t frame_count, JDWP::ExpandBuf* buf)
2305 : StackVisitor(thread, NULL), depth_(0),
2338 ScopedObjectAccessUnchecked soa(Thread::Current());
2340 Thread* thread;
2341 JDWP::JdwpError error = DecodeThread(soa, thread_id, thread);
2345 if (!IsSuspendedForDebugger(soa, thread)) {
2348 GetFrameVisitor visitor(thread, start_frame, frame_count, buf);
2354 return GetThreadId(Thread::Current());
2357 JDWP::ObjectId Dbg::GetThreadId(Thread* thread) {
2358 ScopedObjectAccessUnchecked soa(Thread::Current());
2359 return gRegistry->Add(thread->GetPeer());
2371 Thread* self = Thread::Current();
2380 // Suspend thread to build stack trace. Take suspend thread lock to avoid races with threads
2385 Thread* thread = thread_list->SuspendThreadByPeer(peer.get(), request_suspension, true,
2387 if (thread != NULL) {
2397 ScopedObjectAccessUnchecked soa(Thread::Current());
2399 Thread* thread;
2402 thread = Thread::FromManagedThread(soa, peer);
2404 if (thread == NULL) {
2405 LOG(WARNING) << "No such thread for resume: " << peer;
2411 needs_resume = thread->GetSuspendCount() > 0;
2414 Runtime::Current()->GetThreadList()->Resume(thread, true);
2423 GetThisVisitor(Thread* thread, Context* context, JDWP::FrameId frame_id)
2425 : StackVisitor(thread, context), this_object(NULL), frame_id(frame_id) {}
2444 ScopedObjectAccessUnchecked soa(Thread::Current());
2445 Thread* thread;
2448 JDWP::JdwpError error = DecodeThread(soa, thread_id, thread);
2452 if (!IsSuspendedForDebugger(soa, thread)) {
2457 GetThisVisitor visitor(thread, context.get(), frame_id);
2466 GetLocalVisitor(const ScopedObjectAccessUnchecked& soa, Thread* thread, Context* context,
2469 : StackVisitor(thread, context), soa_(soa), frame_id_(frame_id), slot_(slot), tag_(tag),
2615 ScopedObjectAccessUnchecked soa(Thread::Current());
2617 Thread* thread;
2618 JDWP::JdwpError error = DecodeThread(soa, thread_id, thread);
2622 // TODO check thread is suspended by the debugger ?
2624 GetLocalVisitor visitor(soa, thread, context.get(), frame_id, slot, tag, buf, width);
2632 SetLocalVisitor(Thread* thread, Context* context,
2636 : StackVisitor(thread, context),
2743 ScopedObjectAccessUnchecked soa(Thread::Current());
2745 Thread* thread;
2746 JDWP::JdwpError error = DecodeThread(soa, thread_id, thread);
2750 // TODO check thread is suspended by the debugger ?
2752 SetLocalVisitor visitor(thread, context.get(), frame_id, slot, tag, value, width);
2831 void Dbg::UpdateDebugger(Thread* thread, mirror::Object* this_object,
2843 // see if we're that thread and we've reached a step point.
2844 const SingleStepControl* single_step_control = thread->GetSingleStepControl();
2869 int stack_depth = GetStackDepth(thread);
2894 int stack_depth = GetStackDepth(thread);
2975 MutexLock mu(Thread::Current(), *Locks::deoptimization_lock_);
2983 MutexLock mu(Thread::Current(), *Locks::deoptimization_lock_);
3000 MutexLock mu(Thread::Current(), *Locks::deoptimization_lock_);
3075 Thread* const self = Thread::Current();
3103 static bool IsMethodPossiblyInlined(Thread* self, mirror::ArtMethod* m)
3111 // Note: method verifier may cause thread suspension.
3155 Thread* const self = Thread::Current();
3168 thread suspension.
3201 WriterMutexLock mu(Thread::Current(), *Locks::breakpoint_lock_);
3236 // Scoped utility class to suspend a thread so that we may do tasks such as walk its stack. Doesn't
3237 // cause suspension if the thread is the current thread.
3240 ScopedThreadSuspension(Thread* self, JDWP::ObjectId thread_id)
3259 Thread* suspended_thread;
3261 // Take suspend thread lock to avoid races with threads trying to suspend this one.
3268 // Thread terminated from under us while suspending.
3278 Thread* GetThread() const {
3293 Thread* thread_;
3301 Thread* self = Thread::Current();
3313 explicit SingleStepStackVisitor(Thread* thread, SingleStepControl* single_step_control,
3316 : StackVisitor(thread, NULL), single_step_control_(single_step_control),
3318 DCHECK_EQ(single_step_control_, thread->GetSingleStepControl());
3346 Thread* const thread = sts.GetThread();
3347 SingleStepControl* const single_step_control = thread->GetSingleStepControl();
3350 SingleStepStackVisitor visitor(thread, single_step_control, &line_number);
3418 VLOG(jdwp) << "Single-step thread: " << *thread;
3434 ScopedObjectAccessUnchecked soa(Thread::Current());
3436 Thread* thread;
3437 JDWP::JdwpError error = DecodeThread(soa, thread_id, thread);
3439 SingleStepControl* single_step_control = thread->GetSingleStepControl();
3481 Thread* targetThread = NULL;
3483 Thread* self = Thread::Current();
3489 LOG(ERROR) << "InvokeMethod request for invalid thread id " << thread_id;
3494 LOG(ERROR) << "InvokeMethod request for thread not stopped by event: " << *targetThread;
3500 * target thread if the suspend count is too deep. We're expected to
3510 * be stuck waiting on a suspended thread.
3528 mirror::Object* thread = gRegistry->Get<mirror::Object*>(thread_id);
3529 if (thread == ObjectRegistry::kInvalidObject) {
3532 // TODO: check that 'thread' is actually a java.lang.Thread!
3592 req->thread = thread;
3601 // The fact that we've released the thread list lock is a bit risky --- if the thread goes
3607 * We change our (JDWP thread) status, which should be THREAD_RUNNING,
3614 VLOG(jdwp) << " Transferring control to event thread";
3622 VLOG(jdwp) << " Resuming event thread only";
3631 VLOG(jdwp) << " Control has returned from event thread";
3633 /* wait for thread to re-suspend itself */
3639 * Suspend the threads. We waited for the target thread to suspend
3642 * The suspendAllThreads() call will double-suspend the event thread,
3643 * so we want to resume the target thread once to keep the books straight.
3650 VLOG(jdwp) << " Resuming event thread to balance the count";
3666 ScopedObjectAccess soa(Thread::Current());
3729 * the object is going to be handed off to a different thread.
3754 Thread* self = Thread::Current();
3835 Thread* self = Thread::Current();
3837 LOG(ERROR) << "DDM broadcast in thread state " << self->GetState();
3863 * Send a notification when a thread starts, stops, or changes its name.
3866 * first enabled, it's possible for "thread" to be actively executing.
3868 void Dbg::DdmSendThreadNotification(Thread* t, uint32_t type) {
3879 ScopedObjectAccessUnchecked soa(Thread::Current());
3894 // Enable/disable thread notifications.
3897 // Suspend the VM then post thread start notifications for all threads. Threads attaching will
3901 std::list<Thread*> threads;
3902 Thread* self = Thread::Current();
3909 for (Thread* thread : threads) {
3910 Dbg::DdmSendThreadNotification(thread, CHUNK_TYPE("THCR"));
3917 void Dbg::PostThreadStartOrStop(Thread* t, uint32_t type) {
3924 void Dbg::PostThreadStart(Thread* t) {
3928 void Dbg::PostThreadDeath(Thread* t) {
3946 VLOG(jdwp) << "Debugger thread not active, ignoring DDM send: " << type;
4306 Thread* self = Thread::Current();
4381 Thread* self = Thread::Current();
4418 AllocRecordStackVisitor(Thread* thread, AllocRecord* record)
4420 : StackVisitor(thread, NULL), record(record), depth(0) {}
4450 Thread* self = Thread::Current();
4493 ScopedObjectAccess soa(Thread::Current());
4510 LOG(INFO) << StringPrintf(" Thread %-2d %6zd bytes ", record->ThinLockId(), record->ByteCount())
4592 * (2b) thread id
4625 Thread* self = Thread::Current();
4688 // (2b) thread id
4735 ScopedObjectAccessUnchecked soa(Thread::Current());
4740 ScopedObjectAccessUnchecked soa(Thread::Current());