]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/llvm/tools/lldb/source/API/SBHostOS.cpp
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / llvm / tools / lldb / source / API / SBHostOS.cpp
1 //===-- SBHostOS.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 #include "lldb/API/SBHostOS.h"
11 #include "lldb/API/SBError.h"
12 #include "lldb/Host/FileSpec.h"
13 #include "lldb/Core/Log.h"
14 #include "lldb/Host/Host.h"
15
16 using namespace lldb;
17 using namespace lldb_private;
18
19
20
21 SBFileSpec
22 SBHostOS::GetProgramFileSpec ()
23 {
24     SBFileSpec sb_filespec;
25     sb_filespec.SetFileSpec (Host::GetProgramFileSpec ());
26     return sb_filespec;
27 }
28
29 SBFileSpec
30 SBHostOS::GetLLDBPythonPath ()
31 {
32     SBFileSpec sb_lldb_python_filespec;
33     FileSpec lldb_python_spec;
34     if (Host::GetLLDBPath (ePathTypePythonDir, lldb_python_spec))
35     {
36         sb_lldb_python_filespec.SetFileSpec (lldb_python_spec);
37     }
38     return sb_lldb_python_filespec;
39 }
40
41 lldb::thread_t
42 SBHostOS::ThreadCreate
43 (
44     const char *name,
45     thread_func_t thread_function,
46     void *thread_arg,
47     SBError *error_ptr
48 )
49 {
50     Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
51
52     if (log)
53         log->Printf ("SBHostOS::ThreadCreate (name=\"%s\", thread_function=%p, thread_arg=%p, error_ptr=%p)", name, 
54                      thread_function, thread_arg, error_ptr);
55
56     // FIXME: You should log the return value?
57
58     return Host::ThreadCreate (name, thread_function, thread_arg, error_ptr ? error_ptr->get() : NULL);
59 }
60
61 void
62 SBHostOS::ThreadCreated (const char *name)
63 {
64     Host::ThreadCreated (name);
65 }
66
67 bool
68 SBHostOS::ThreadCancel (lldb::thread_t thread, SBError *error_ptr)
69 {
70     return Host::ThreadCancel (thread, error_ptr ? error_ptr->get() : NULL);
71 }
72
73 bool
74 SBHostOS::ThreadDetach (lldb::thread_t thread, SBError *error_ptr)
75 {
76     return Host::ThreadDetach (thread, error_ptr ? error_ptr->get() : NULL);
77 }
78
79 bool
80 SBHostOS::ThreadJoin (lldb::thread_t thread, thread_result_t *result, SBError *error_ptr)
81 {
82     return Host::ThreadJoin (thread, result, error_ptr ? error_ptr->get() : NULL);
83 }
84
85