LLDB mainline
SBHostOS.cpp
Go to the documentation of this file.
1//===-- SBHostOS.cpp ------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "lldb/API/SBHostOS.h"
10#include "lldb/API/SBError.h"
12#include "lldb/Host/Config.h"
14#include "lldb/Host/Host.h"
15#include "lldb/Host/HostInfo.h"
21
23
24#include "llvm/ADT/SmallString.h"
25#include "llvm/Support/Path.h"
26
27using namespace lldb;
28using namespace lldb_private;
29
32
33 SBFileSpec sb_filespec;
34 sb_filespec.SetFileSpec(HostInfo::GetProgramFileSpec());
35 return sb_filespec;
36}
37
43
46
47 SBFileSpec sb_fspec;
48 sb_fspec.SetFileSpec(
50 return sb_fspec;
51}
52
54 LLDB_INSTRUMENT_VA(path_type);
55
56 FileSpec fspec;
57 switch (path_type) {
59 fspec = HostInfo::GetShlibDir();
60 break;
62 fspec = HostInfo::GetSupportExeDir();
63 break;
65 fspec = HostInfo::GetHeaderDir();
66 break;
70 break;
72 fspec = HostInfo::GetSystemPluginDir();
73 break;
75 fspec = HostInfo::GetUserPluginDir();
76 break;
78 fspec = HostInfo::GetProcessTempDir();
79 break;
81 fspec = HostInfo::GetGlobalTempDir();
82 break;
84 fspec = GetClangResourceDir();
85 break;
86 }
87
88 SBFileSpec sb_fspec;
89 sb_fspec.SetFileSpec(fspec);
90 return sb_fspec;
91}
92
95 return HostInfo::GetUserHomeDir();
96}
97
98lldb::thread_t SBHostOS::ThreadCreate(const char *name,
99 lldb::thread_func_t thread_function,
100 void *thread_arg, SBError *error_ptr) {
101 LLDB_INSTRUMENT_VA(name, thread_function, thread_arg, error_ptr);
103}
104
105void SBHostOS::ThreadCreated(const char *name) { LLDB_INSTRUMENT_VA(name); }
106
107bool SBHostOS::ThreadCancel(lldb::thread_t thread, SBError *error_ptr) {
108 LLDB_INSTRUMENT_VA(thread, error_ptr);
109 return false;
110}
111
112bool SBHostOS::ThreadDetach(lldb::thread_t thread, SBError *error_ptr) {
113 LLDB_INSTRUMENT_VA(thread, error_ptr);
114 return false;
115}
116
117bool SBHostOS::ThreadJoin(lldb::thread_t thread, lldb::thread_result_t *result,
118 SBError *error_ptr) {
119 LLDB_INSTRUMENT_VA(thread, result, error_ptr);
120 return false;
121}
#define LLDB_INSTRUMENT()
#define LLDB_INSTRUMENT_VA(...)
void SetFileSpec(const lldb_private::FileSpec &fspec)
static lldb::SBFileSpec GetUserHomeDirectory()
Definition SBHostOS.cpp:93
static lldb::SBFileSpec GetProgramFileSpec()
Definition SBHostOS.cpp:30
static lldb::SBFileSpec GetLLDBPythonPath()
Definition SBHostOS.cpp:38
static lldb::SBFileSpec GetScriptPath(lldb::ScriptLanguage language)
Definition SBHostOS.cpp:44
static lldb::SBFileSpec GetLLDBPath(lldb::PathType path_type)
Definition SBHostOS.cpp:53
A file utility class.
Definition FileSpec.h:57
static FileSpec GetScriptInterpreterLibraryPath(lldb::ScriptLanguage script_lang)
#define LLDB_INVALID_HOST_THREAD
Definition lldb-types.h:69
A class that represents a running process on the host machine.
FileSpec GetClangResourceDir()
ScriptLanguage
Script interpreter types.
@ eScriptLanguagePython
void * thread_result_t
Definition lldb-types.h:62
PathType
Used with SBHostOS::GetLLDBPath (lldb::PathType) to find files that are related to LLDB on the curren...
@ ePathTypeGlobalLLDBTempSystemDir
The LLDB temp directory for this system, NOT cleaned up on a process exit.
@ ePathTypeHeaderDir
Find LLDB header file directory.
@ ePathTypeLLDBSystemPlugins
System plug-ins directory.
@ ePathTypeLLDBTempSystemDir
The LLDB temp directory for this system that will be cleaned up on exit.
@ ePathTypeClangDir
Find path to Clang builtin headers.
@ ePathTypeLLDBUserPlugins
User plug-ins directory.
@ ePathTypeSupportExecutableDir
Find LLDB support executable directory (debugserver, etc)
@ ePathTypePythonDir
Find Python modules (PYTHONPATH) directory.
@ ePathTypeLLDBShlibDir
The directory where the lldb.so (unix) or LLDB mach-o file in LLDB.framework (MacOSX) exists.
pthread_t thread_t
Definition lldb-types.h:58
void *(* thread_func_t)(void *)
Definition lldb-types.h:63