Skip to content

Commit 36f7fac

Browse files
author
git apple-llvm automerger
committed
Merge commit 'd4cc859ad089' from swift/release/5.3 into swift/master
2 parents b6306aa + d4cc859 commit 36f7fac

File tree

7 files changed

+11
-66
lines changed

7 files changed

+11
-66
lines changed

lldb/docs/man/lldb.rst

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,11 @@ CONFIGURATION FILES
298298
:program:`lldb` reads things like settings, aliases and commands from the
299299
.lldbinit file.
300300

301-
First, :program:`lldb` will try to read the application specific init file
302-
whose name is ~/.lldbinit followed by a "-" and the name of the current
303-
program. This would be ~/.lldbinit-lldb for the command line :program:`lldb`
304-
and ~/.lldbinit-Xcode for Xcode. If there is no application specific init
305-
file, :program:`lldb` will look for an init file in the home directory.
306-
If launched with a `REPL`_ option, it will first look for a REPL configuration
307-
file, specific to the REPL language. If this file doesn't exist, or :program:`lldb`
308-
wasn't launch with `REPL`_, meaning there is neither a REPL init file nor an
309-
application specific init file, `lldb` will fallback to the global ~/.lldbinit.
301+
First, it will read the application specific init file whose name is
302+
~/.lldbinit followed by a "-" and the name of the current program. This would
303+
be ~/.lldbinit-lldb for the command line :program:`lldb` and ~/.lldbinit-Xcode
304+
for Xcode. If there is no application specific init file, the global
305+
~/.lldbinit is read.
310306

311307
Secondly, it will look for an .lldbinit file in the current working directory.
312308
For security reasons, :program:`lldb` will print a warning and not source this

lldb/include/lldb/API/SBCommandInterpreter.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@ class SBCommandInterpreter {
120120
const char *help, const char *syntax);
121121

122122
void SourceInitFileInHomeDirectory(lldb::SBCommandReturnObject &result);
123-
void SourceInitFileInHomeDirectory(lldb::SBCommandReturnObject &result,
124-
bool is_repl);
125123

126124
void
127125
SourceInitFileInCurrentWorkingDirectory(lldb::SBCommandReturnObject &result);

lldb/include/lldb/Interpreter/CommandInterpreter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ class CommandInterpreter : public Broadcaster,
213213
}
214214

215215
void SourceInitFileCwd(CommandReturnObject &result);
216-
void SourceInitFileHome(CommandReturnObject &result, bool is_repl = false);
216+
void SourceInitFileHome(CommandReturnObject &result);
217217

218218
bool AddCommand(llvm::StringRef name, const lldb::CommandObjectSP &cmd_sp,
219219
bool can_replace);

lldb/source/API/SBCommandInterpreter.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -574,24 +574,6 @@ void SBCommandInterpreter::SourceInitFileInHomeDirectory(
574574
}
575575
}
576576

577-
void SBCommandInterpreter::SourceInitFileInHomeDirectory(
578-
SBCommandReturnObject &result, bool is_repl) {
579-
LLDB_RECORD_METHOD(void, SBCommandInterpreter, SourceInitFileInHomeDirectory,
580-
(lldb::SBCommandReturnObject &, bool), result, is_repl);
581-
582-
result.Clear();
583-
if (IsValid()) {
584-
TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
585-
std::unique_lock<std::recursive_mutex> lock;
586-
if (target_sp)
587-
lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
588-
m_opaque_ptr->SourceInitFileHome(result.ref(), is_repl);
589-
} else {
590-
result->AppendError("SBCommandInterpreter is not valid");
591-
result->SetStatus(eReturnStatusFailed);
592-
}
593-
}
594-
595577
void SBCommandInterpreter::SourceInitFileInCurrentWorkingDirectory(
596578
SBCommandReturnObject &result) {
597579
LLDB_RECORD_METHOD(void, SBCommandInterpreter,
@@ -940,9 +922,6 @@ void RegisterMethods<SBCommandInterpreterRunOptions>(Registry &R) {
940922
LLDB_REGISTER_METHOD(void, SBCommandInterpreter,
941923
SourceInitFileInHomeDirectory,
942924
(lldb::SBCommandReturnObject &));
943-
LLDB_REGISTER_METHOD(void, SBCommandInterpreter,
944-
SourceInitFileInHomeDirectory,
945-
(lldb::SBCommandReturnObject &, bool));
946925
LLDB_REGISTER_METHOD(void, SBCommandInterpreter,
947926
SourceInitFileInCurrentWorkingDirectory,
948927
(lldb::SBCommandReturnObject &));

lldb/source/API/SBDebugger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ SBDebugger SBDebugger::Create(bool source_init_files,
219219
interp.get()->SkipLLDBInitFiles(false);
220220
interp.get()->SkipAppInitFiles(false);
221221
SBCommandReturnObject result;
222-
interp.SourceInitFileInHomeDirectory(result, false);
222+
interp.SourceInitFileInHomeDirectory(result);
223223
} else {
224224
interp.get()->SkipLLDBInitFiles(true);
225225
interp.get()->SkipAppInitFiles(true);

lldb/source/Interpreter/CommandInterpreter.cpp

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,22 +2060,6 @@ static void GetHomeInitFile(llvm::SmallVectorImpl<char> &init_file,
20602060
FileSystem::Instance().Resolve(init_file);
20612061
}
20622062

2063-
static void GetHomeREPLInitFile(llvm::SmallVectorImpl<char> &init_file,
2064-
LanguageType language) {
2065-
std::string init_file_name;
2066-
2067-
switch (language) {
2068-
// TODO: Add support for a language used with a REPL.
2069-
default:
2070-
return;
2071-
}
2072-
2073-
llvm::sys::path::home_directory(init_file);
2074-
llvm::sys::path::append(init_file, init_file_name);
2075-
2076-
FileSystem::Instance().Resolve(init_file);
2077-
}
2078-
20792063
static void GetCwdInitFile(llvm::SmallVectorImpl<char> &init_file) {
20802064
llvm::StringRef s = ".lldbinit";
20812065
init_file.assign(s.begin(), s.end());
@@ -2150,27 +2134,15 @@ void CommandInterpreter::SourceInitFileCwd(CommandReturnObject &result) {
21502134

21512135
/// We will first see if there is an application specific ".lldbinit" file
21522136
/// whose name is "~/.lldbinit" followed by a "-" and the name of the program.
2153-
/// If this file doesn't exist, we fall back to the REPL init file or the
2154-
/// default home init file in "~/.lldbinit".
2155-
void CommandInterpreter::SourceInitFileHome(CommandReturnObject &result,
2156-
bool is_repl) {
2137+
/// If this file doesn't exist, we fall back to just the "~/.lldbinit" file.
2138+
void CommandInterpreter::SourceInitFileHome(CommandReturnObject &result) {
21572139
if (m_skip_lldbinit_files) {
21582140
result.SetStatus(eReturnStatusSuccessFinishNoResult);
21592141
return;
21602142
}
21612143

21622144
llvm::SmallString<128> init_file;
2163-
2164-
if (is_repl) {
2165-
LanguageType language = {};
2166-
TargetSP target_sp = GetDebugger().GetSelectedTarget();
2167-
if (target_sp)
2168-
language = target_sp->GetLanguage();
2169-
GetHomeREPLInitFile(init_file, language);
2170-
}
2171-
2172-
if (init_file.empty())
2173-
GetHomeInitFile(init_file);
2145+
GetHomeInitFile(init_file);
21742146

21752147
if (!m_skip_app_init_files) {
21762148
llvm::StringRef program_name =

lldb/tools/driver/Driver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ int Driver::MainLoop() {
492492
// Before we handle any options from the command line, we parse the
493493
// .lldbinit file in the user's home directory.
494494
SBCommandReturnObject result;
495-
sb_interpreter.SourceInitFileInHomeDirectory(result, m_option_data.m_repl);
495+
sb_interpreter.SourceInitFileInHomeDirectory(result);
496496
if (m_option_data.m_debug_mode) {
497497
result.PutError(m_debugger.GetErrorFile());
498498
result.PutOutput(m_debugger.GetOutputFile());

0 commit comments

Comments
 (0)