diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-05-07 16:57:17 +0000 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-05-07 16:57:17 +0000 |
| commit | 7ffd963834f8518a713e9d6dcabd5efe272076fe (patch) | |
| tree | 1a71cc5b92be1f867c49665181834528c12db09e | |
| parent | a9d6c32eafc645c55b07eb50698c428e14c0bffd (diff) | |
| download | bcm5719-llvm-7ffd963834f8518a713e9d6dcabd5efe272076fe.tar.gz bcm5719-llvm-7ffd963834f8518a713e9d6dcabd5efe272076fe.zip | |
[Driver] Add command line option to allow loading local lldbinit file.
This patch adds a command line flag that allows lldb to load local
lldbinit files.
Differential revision: https://reviews.llvm.org/D61578
llvm-svn: 360172
| -rw-r--r-- | lldb/lit/Driver/LocalLLDBInit.test | 7 | ||||
| -rw-r--r-- | lldb/tools/driver/Driver.cpp | 5 | ||||
| -rw-r--r-- | lldb/tools/driver/Options.td | 3 |
3 files changed, 13 insertions, 2 deletions
diff --git a/lldb/lit/Driver/LocalLLDBInit.test b/lldb/lit/Driver/LocalLLDBInit.test index 7d2e05c5323..a5961089413 100644 --- a/lldb/lit/Driver/LocalLLDBInit.test +++ b/lldb/lit/Driver/LocalLLDBInit.test @@ -1,9 +1,12 @@ # RUN: mkdir -p %t.root +# RUN: mkdir -p %t.home # RUN: cp %S/Inputs/.lldbinit %t.root # RUN: cd %t.root -# RUN: %lldb-init -o 'settings show frame-format' 2>&1 | FileCheck %s --check-prefix=INIT --check-prefix=CHECK +# RUN: env HOME=%t.home %lldb-init -o 'settings show frame-format' 2>&1 | FileCheck %s --check-prefix=WARNINIT --check-prefix=CHECK +# RUN: env HOME=%t.home %lldb-init -local-lldbinit -o 'settings show frame-format' 2>&1 | FileCheck %s --check-prefix=ALLOWINIT --check-prefix=NOINIT # RUN: %lldb -o 'settings show frame-format' 2>&1 | FileCheck %s --check-prefix=NOINIT --check-prefix=CHECK -# INIT: There is a .lldbinit file in the current directory which is not being read. +# WARNINIT: There is a .lldbinit file in the current directory which is not being read. # NOINIT-NOT: There is a .lldbinit file in the current directory which is not being read. # CHECK-NOT: bogus +# ALLOWINIT: bogus diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp index 6d73d2293a0..34711d52aa2 100644 --- a/lldb/tools/driver/Driver.cpp +++ b/lldb/tools/driver/Driver.cpp @@ -222,6 +222,11 @@ SBError Driver::ProcessArgs(const opt::InputArgList &args, bool &exiting) { m_debugger.SkipAppInitFiles(true); } + if (args.hasArg(OPT_local_lldbinit)) { + lldb::SBDebugger::SetInternalVariable("target.load-cwd-lldbinit", "true", + m_debugger.GetInstanceName()); + } + if (args.hasArg(OPT_no_use_colors)) { m_debugger.SetUseColor(false); } diff --git a/lldb/tools/driver/Options.td b/lldb/tools/driver/Options.td index 0c99f82cca3..4ea98ee48fa 100644 --- a/lldb/tools/driver/Options.td +++ b/lldb/tools/driver/Options.td @@ -95,6 +95,9 @@ def: Flag<["-"], "x">, Alias<no_lldbinit>, HelpText<"Alias for --no-lldbinit">, Group<grp_command>; +def local_lldbinit: F<"local-lldbinit">, + HelpText<"Allow the debugger to parse the .lldbinit files in the current working directory, unless --no-lldbinit is passed.">, + Group<grp_command>; def batch: F<"batch">, HelpText<"Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.">, |

