1 //===-- FreeBSDThread.cpp ---------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // C Includes 11 // C++ Includes 12 // Other libraries and framework includes 13 #include "lldb/Core/State.h" 14 15 // Project includes 16 #include "FreeBSDThread.h" 17 #include "ProcessFreeBSD.h" 18 #include "ProcessPOSIXLog.h" 19 20 using namespace lldb; 21 using namespace lldb_private; 22 23 //------------------------------------------------------------------------------ 24 // Constructors and destructors. 25 26 FreeBSDThread::FreeBSDThread(Process &process, lldb::tid_t tid) 27 : POSIXThread(process, tid) 28 { 29 } 30 31 FreeBSDThread::~FreeBSDThread() 32 { 33 } 34 35 //------------------------------------------------------------------------------ 36 // ProcessInterface protocol. 37 38 void 39 FreeBSDThread::WillResume(lldb::StateType resume_state) 40 { 41 Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD)); 42 if (log) 43 log->Printf("tid %lu resume_state = %s", GetID(), 44 lldb_private::StateAsCString(resume_state)); 45 ProcessSP process_sp(GetProcess()); 46 ProcessFreeBSD *process = static_cast<ProcessFreeBSD *>(process_sp.get()); 47 int signo = GetResumeSignal(); 48 bool signo_valid = process->GetUnixSignals().SignalIsValid(signo); 49 50 switch (resume_state) 51 { 52 case eStateSuspended: 53 case eStateStopped: 54 process->m_suspend_tids.push_back(GetID()); 55 break; 56 case eStateRunning: 57 process->m_run_tids.push_back(GetID()); 58 if (signo_valid) 59 process->m_resume_signo = signo; 60 break; 61 case eStateStepping: 62 process->m_step_tids.push_back(GetID()); 63 if (signo_valid) 64 process->m_resume_signo = signo; 65 break; 66 default: 67 break; 68 } 69 } 70