Ed Maste | 7fd845c | 2013-12-09 15:51:17 +0000 | [diff] [blame] | 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" |
Ed Maste | 8702e92 | 2015-03-03 22:44:18 +0000 | [diff] [blame] | 14 | #include "lldb/Target/UnixSignals.h" |
Ed Maste | 7fd845c | 2013-12-09 15:51:17 +0000 | [diff] [blame] | 15 | |
| 16 | // Project includes |
| 17 | #include "FreeBSDThread.h" |
| 18 | #include "ProcessFreeBSD.h" |
| 19 | #include "ProcessPOSIXLog.h" |
| 20 | |
| 21 | using namespace lldb; |
| 22 | using namespace lldb_private; |
| 23 | |
| 24 | //------------------------------------------------------------------------------ |
| 25 | // Constructors and destructors. |
| 26 | |
| 27 | FreeBSDThread::FreeBSDThread(Process &process, lldb::tid_t tid) |
| 28 | : POSIXThread(process, tid) |
| 29 | { |
| 30 | } |
| 31 | |
| 32 | FreeBSDThread::~FreeBSDThread() |
| 33 | { |
| 34 | } |
| 35 | |
| 36 | //------------------------------------------------------------------------------ |
| 37 | // ProcessInterface protocol. |
| 38 | |
| 39 | void |
| 40 | FreeBSDThread::WillResume(lldb::StateType resume_state) |
| 41 | { |
| 42 | Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD)); |
| 43 | if (log) |
| 44 | log->Printf("tid %lu resume_state = %s", GetID(), |
| 45 | lldb_private::StateAsCString(resume_state)); |
| 46 | ProcessSP process_sp(GetProcess()); |
| 47 | ProcessFreeBSD *process = static_cast<ProcessFreeBSD *>(process_sp.get()); |
| 48 | int signo = GetResumeSignal(); |
Chaoren Lin | e515a5a | 2015-07-14 03:18:23 +0000 | [diff] [blame^] | 49 | bool signo_valid = process->GetUnixSignals()->SignalIsValid(signo); |
Ed Maste | 7fd845c | 2013-12-09 15:51:17 +0000 | [diff] [blame] | 50 | |
| 51 | switch (resume_state) |
| 52 | { |
| 53 | case eStateSuspended: |
| 54 | case eStateStopped: |
| 55 | process->m_suspend_tids.push_back(GetID()); |
| 56 | break; |
| 57 | case eStateRunning: |
| 58 | process->m_run_tids.push_back(GetID()); |
| 59 | if (signo_valid) |
| 60 | process->m_resume_signo = signo; |
| 61 | break; |
| 62 | case eStateStepping: |
| 63 | process->m_step_tids.push_back(GetID()); |
| 64 | if (signo_valid) |
| 65 | process->m_resume_signo = signo; |
| 66 | break; |
| 67 | default: |
| 68 | break; |
| 69 | } |
| 70 | } |