2010-06-09 00:52:24 +08:00
|
|
|
//===-- SBHostOS.cpp --------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "lldb/API/SBHostOS.h"
|
|
|
|
#include "lldb/API/SBError.h"
|
2011-02-08 13:05:52 +08:00
|
|
|
#include "lldb/Host/FileSpec.h"
|
2010-10-26 11:11:13 +08:00
|
|
|
#include "lldb/Core/Log.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Host/Host.h"
|
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SBFileSpec
|
|
|
|
SBHostOS::GetProgramFileSpec ()
|
|
|
|
{
|
|
|
|
SBFileSpec sb_filespec;
|
|
|
|
sb_filespec.SetFileSpec (Host::GetProgramFileSpec ());
|
|
|
|
return sb_filespec;
|
|
|
|
}
|
|
|
|
|
2012-12-22 06:22:26 +08:00
|
|
|
SBFileSpec
|
|
|
|
SBHostOS::GetLLDBPythonPath ()
|
|
|
|
{
|
|
|
|
SBFileSpec sb_lldb_python_filespec;
|
|
|
|
FileSpec lldb_python_spec;
|
|
|
|
if (Host::GetLLDBPath (ePathTypePythonDir, lldb_python_spec))
|
|
|
|
{
|
|
|
|
sb_lldb_python_filespec.SetFileSpec (lldb_python_spec);
|
|
|
|
}
|
|
|
|
return sb_lldb_python_filespec;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
lldb::thread_t
|
|
|
|
SBHostOS::ThreadCreate
|
|
|
|
(
|
|
|
|
const char *name,
|
|
|
|
void *(*thread_function)(void *),
|
|
|
|
void *thread_arg,
|
|
|
|
SBError *error_ptr
|
|
|
|
)
|
|
|
|
{
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-26 11:11:13 +08:00
|
|
|
|
|
|
|
if (log)
|
2010-10-31 11:01:06 +08:00
|
|
|
log->Printf ("SBHostOS::ThreadCreate (name=\"%s\", thread_function=%p, thread_arg=%p, error_ptr=%p)", name,
|
2010-10-27 07:49:36 +08:00
|
|
|
thread_function, thread_arg, error_ptr);
|
2010-10-26 11:11:13 +08:00
|
|
|
|
2011-06-15 00:36:12 +08:00
|
|
|
// FIXME: You should log the return value?
|
2010-10-26 11:11:13 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
return Host::ThreadCreate (name, thread_function, thread_arg, error_ptr ? error_ptr->get() : NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SBHostOS::ThreadCreated (const char *name)
|
|
|
|
{
|
|
|
|
Host::ThreadCreated (name);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SBHostOS::ThreadCancel (lldb::thread_t thread, SBError *error_ptr)
|
|
|
|
{
|
|
|
|
return Host::ThreadCancel (thread, error_ptr ? error_ptr->get() : NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SBHostOS::ThreadDetach (lldb::thread_t thread, SBError *error_ptr)
|
|
|
|
{
|
|
|
|
return Host::ThreadDetach (thread, error_ptr ? error_ptr->get() : NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SBHostOS::ThreadJoin (lldb::thread_t thread, void **result, SBError *error_ptr)
|
|
|
|
{
|
|
|
|
return Host::ThreadJoin (thread, result, error_ptr ? error_ptr->get() : NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|