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"
11#include "lldb/Host/Config.h"
13#include "lldb/Host/Host.h"
14#include "lldb/Host/HostInfo.h"
20
22#if LLDB_ENABLE_PYTHON
24#endif
25
26#include "llvm/ADT/SmallString.h"
27#include "llvm/Support/Path.h"
28
29using namespace lldb;
30using namespace lldb_private;
31
34
35 SBFileSpec sb_filespec;
36 sb_filespec.SetFileSpec(HostInfo::GetProgramFileSpec());
37 return sb_filespec;
38}
39
42
44}
45
47 LLDB_INSTRUMENT_VA(path_type);
48
49 FileSpec fspec;
50 switch (path_type) {
52 fspec = HostInfo::GetShlibDir();
53 break;
55 fspec = HostInfo::GetSupportExeDir();
56 break;
58 fspec = HostInfo::GetHeaderDir();
59 break;
61#if LLDB_ENABLE_PYTHON
62 fspec = ScriptInterpreterPython::GetPythonDir();
63#endif
64 break;
66 fspec = HostInfo::GetSystemPluginDir();
67 break;
69 fspec = HostInfo::GetUserPluginDir();
70 break;
72 fspec = HostInfo::GetProcessTempDir();
73 break;
75 fspec = HostInfo::GetGlobalTempDir();
76 break;
78 fspec = GetClangResourceDir();
79 break;
80 }
81
82 SBFileSpec sb_fspec;
83 sb_fspec.SetFileSpec(fspec);
84 return sb_fspec;
85}
86
89
90 FileSpec homedir;
93
94 SBFileSpec sb_fspec;
95 sb_fspec.SetFileSpec(homedir);
96
97 return sb_fspec;
98}
99
100lldb::thread_t SBHostOS::ThreadCreate(const char *name,
101 lldb::thread_func_t thread_function,
102 void *thread_arg, SBError *error_ptr) {
103 LLDB_INSTRUMENT_VA(name, thread_function, thread_arg, error_ptr);
105}
106
107void SBHostOS::ThreadCreated(const char *name) { LLDB_INSTRUMENT_VA(name); }
108
109bool SBHostOS::ThreadCancel(lldb::thread_t thread, SBError *error_ptr) {
110 LLDB_INSTRUMENT_VA(thread, error_ptr);
111 return false;
112}
113
114bool SBHostOS::ThreadDetach(lldb::thread_t thread, SBError *error_ptr) {
115 LLDB_INSTRUMENT_VA(thread, error_ptr);
116 return false;
117}
118
119bool SBHostOS::ThreadJoin(lldb::thread_t thread, lldb::thread_result_t *result,
120 SBError *error_ptr) {
121 LLDB_INSTRUMENT_VA(thread, result, error_ptr);
122 return false;
123}
#define LLDB_INSTRUMENT()
#define LLDB_INSTRUMENT_VA(...)
void SetFileSpec(const lldb_private::FileSpec &fspec)
Definition: SBFileSpec.cpp:164
static lldb::SBFileSpec GetUserHomeDirectory()
Definition: SBHostOS.cpp:87
static lldb::SBFileSpec GetProgramFileSpec()
Definition: SBHostOS.cpp:32
static lldb::SBFileSpec GetLLDBPythonPath()
Definition: SBHostOS.cpp:40
static lldb::SBFileSpec GetLLDBPath(lldb::PathType path_type)
Definition: SBHostOS.cpp:46
A file utility class.
Definition: FileSpec.h:56
void Resolve(llvm::SmallVectorImpl< char > &path)
Resolve path to make it canonical.
bool GetHomeDirectory(llvm::SmallVectorImpl< char > &path) const
Get the user home directory.
static FileSystem & Instance()
#define LLDB_INVALID_HOST_THREAD
Definition: lldb-types.h:69
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
FileSpec GetClangResourceDir()
Definition: ClangHost.cpp:159
Definition: SBAddress.h:15
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