aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/API/SBCommandInterpreter.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2022-02-15 13:28:34 +0100
committerPavel Labath <pavel@labath.sk>2022-02-18 12:30:22 +0100
commit6c99a3469d9c0a48fb2a9fec845d284ef39338ee (patch)
treeb1e96bbcb832da178538c54e6724f852057926fe /lldb/source/API/SBCommandInterpreter.cpp
parentde2c0a2e6139e621d5781b3bb1e14c52ac81cf87 (diff)
downloadllvm-6c99a3469d9c0a48fb2a9fec845d284ef39338ee.zip
llvm-6c99a3469d9c0a48fb2a9fec845d284ef39338ee.tar.gz
llvm-6c99a3469d9c0a48fb2a9fec845d284ef39338ee.tar.bz2
[lldb] Add support for a "global" lldbinit file
This patch adds introduces a new kind of an lldbinit file. Unlike the lldbinit in the home directory (useful for customizing lldb to the needs of a particular user), or the cwd lldbinit file (useful for project-specific settings), this file can be used to customize an entire lldb installation to a particular environment. The feature is enabled at build time, by setting the LLDB_GLOBAL_INIT_DIRECTORY variable to a path to a directory which should contain an "lldbinit" file. Lldb will then load the file at startup, if it exists, and if automatic init loading has not been disabled. Relative paths will be resolved (at runtime) relative to the location of the lldb library (liblldb or LLDB.framework). The system-wide lldbinit file will be loaded first, before any $HOME/.lldbinit and $CWD/.lldbinit files are processed, so that those can override any system-wide settings. More information can be found on the RFC thread at <https://discourse.llvm.org/t/rfc-system-wide-lldbinit/59933>. Differential Revision: https://reviews.llvm.org/D119831
Diffstat (limited to 'lldb/source/API/SBCommandInterpreter.cpp')
-rw-r--r--lldb/source/API/SBCommandInterpreter.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp
index 0a8c83f..a19ad48 100644
--- a/lldb/source/API/SBCommandInterpreter.cpp
+++ b/lldb/source/API/SBCommandInterpreter.cpp
@@ -423,6 +423,22 @@ void SBCommandInterpreter::reset(
m_opaque_ptr = interpreter;
}
+void SBCommandInterpreter::SourceInitFileInGlobalDirectory(
+ SBCommandReturnObject &result) {
+ LLDB_INSTRUMENT_VA(this, result);
+
+ result.Clear();
+ if (IsValid()) {
+ TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
+ std::unique_lock<std::recursive_mutex> lock;
+ if (target_sp)
+ lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
+ m_opaque_ptr->SourceInitFileGlobal(result.ref());
+ } else {
+ result->AppendError("SBCommandInterpreter is not valid");
+ }
+}
+
void SBCommandInterpreter::SourceInitFileInHomeDirectory(
SBCommandReturnObject &result) {
LLDB_INSTRUMENT_VA(this, result);