blob: 5e46c836beac61f51996a2e3a9a56a5c4f9fda0a [file] [log] [blame]
Ed Maste7fd845c2013-12-09 15:51:17 +00001//===-- 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 Maste8702e922015-03-03 22:44:18 +000014#include "lldb/Target/UnixSignals.h"
Ed Maste7fd845c2013-12-09 15:51:17 +000015
16// Project includes
17#include "FreeBSDThread.h"
18#include "ProcessFreeBSD.h"
19#include "ProcessPOSIXLog.h"
20
21using namespace lldb;
22using namespace lldb_private;
23
24//------------------------------------------------------------------------------
25// Constructors and destructors.
26
27FreeBSDThread::FreeBSDThread(Process &process, lldb::tid_t tid)
28 : POSIXThread(process, tid)
29{
30}
31
32FreeBSDThread::~FreeBSDThread()
33{
34}
35
36//------------------------------------------------------------------------------
37// ProcessInterface protocol.
38
39void
40FreeBSDThread::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 Line515a5a2015-07-14 03:18:23 +000049 bool signo_valid = process->GetUnixSignals()->SignalIsValid(signo);
Ed Maste7fd845c2013-12-09 15:51:17 +000050
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}