Author: jdevlieghere Date: Tue May 7 09:57:17 2019 New Revision: 360172 URL: http://llvm.org/viewvc/llvm-project?rev=360172&view=rev Log: [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 Modified: lldb/trunk/lit/Driver/LocalLLDBInit.test lldb/trunk/tools/driver/Driver.cpp lldb/trunk/tools/driver/Options.td Modified: lldb/trunk/lit/Driver/LocalLLDBInit.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/LocalLLDBInit.test?rev=360172&r1=360171&r2=360172&view=diff ============================================================================== --- lldb/trunk/lit/Driver/LocalLLDBInit.test (original) +++ lldb/trunk/lit/Driver/LocalLLDBInit.test Tue May 7 09:57:17 2019 @@ -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 Modified: lldb/trunk/tools/driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=360172&r1=360171&r2=360172&view=diff ============================================================================== --- lldb/trunk/tools/driver/Driver.cpp (original) +++ lldb/trunk/tools/driver/Driver.cpp Tue May 7 09:57:17 2019 @@ -222,6 +222,11 @@ SBError Driver::ProcessArgs(const opt::I 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); } Modified: lldb/trunk/tools/driver/Options.td URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Options.td?rev=360172&r1=360171&r2=360172&view=diff ============================================================================== --- lldb/trunk/tools/driver/Options.td (original) +++ lldb/trunk/tools/driver/Options.td Tue May 7 09:57:17 2019 @@ -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.">, _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits