Ed Maste 04c171520d lldb: Threaded inferior support for FreeBSD
This is in the process of being submitted to the upstream LLDB
repository.  The thread list functionality is modelled in part on
GDBRemoteCommunicationClient.

LLDB bug pr16696 and code review D2267

Sponsored by:	DARPA, AFRL
2013-12-03 21:29:45 +00:00

70 lines
1.9 KiB
C++

//===-- FreeBSDThread.cpp ---------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// C Includes
// C++ Includes
// Other libraries and framework includes
#include "lldb/Core/State.h"
// Project includes
#include "FreeBSDThread.h"
#include "ProcessFreeBSD.h"
#include "ProcessPOSIXLog.h"
using namespace lldb;
using namespace lldb_private;
//------------------------------------------------------------------------------
// Constructors and destructors.
FreeBSDThread::FreeBSDThread(Process &process, lldb::tid_t tid)
: POSIXThread(process, tid)
{
}
FreeBSDThread::~FreeBSDThread()
{
}
//------------------------------------------------------------------------------
// ProcessInterface protocol.
void
FreeBSDThread::WillResume(lldb::StateType resume_state)
{
Log *log (ProcessPOSIXLog::GetLogIfAllCategoriesSet (POSIX_LOG_THREAD));
if (log)
log->Printf("tid %lu resume_state = %s", GetID(),
lldb_private::StateAsCString(resume_state));
ProcessSP process_sp(GetProcess());
ProcessFreeBSD *process = static_cast<ProcessFreeBSD *>(process_sp.get());
int signo = GetResumeSignal();
bool signo_valid = process->GetUnixSignals().SignalIsValid(signo);
switch (resume_state)
{
case eStateSuspended:
case eStateStopped:
process->m_suspend_tids.push_back(GetID());
break;
case eStateRunning:
process->m_run_tids.push_back(GetID());
if (signo_valid)
process->m_resume_signo = signo;
break;
case eStateStepping:
process->m_step_tids.push_back(GetID());
if (signo_valid)
process->m_resume_signo = signo;
break;
default:
break;
}
}