JDevlieghere created this revision. JDevlieghere added reviewers: clayborg, labath, jingham. Herald added a project: LLDB. JDevlieghere added a parent revision: D61577: [Driver] Change the way we deal with local lldbinit files..
This patch adds a command line flag that allows lldb to load local lldbinit files. Repository: rLLDB LLDB https://reviews.llvm.org/D61578 Files: lldb/lit/Driver/LocalLLDBInit.test lldb/tools/driver/Driver.cpp lldb/tools/driver/Options.td Index: lldb/tools/driver/Options.td =================================================================== --- lldb/tools/driver/Options.td +++ lldb/tools/driver/Options.td @@ -95,6 +95,9 @@ Alias<no_lldbinit>, HelpText<"Alias for --no-lldbinit">, Group<grp_command>; +def local_lldbinit: F<"local-lldbinit">, + HelpText<"Allow the debugger to load the local lldbinit files.">, + Group<grp_command>; def batch: F<"batch">, HelpText<"Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.">, Index: lldb/tools/driver/Driver.cpp =================================================================== --- lldb/tools/driver/Driver.cpp +++ lldb/tools/driver/Driver.cpp @@ -222,6 +222,11 @@ 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); } Index: lldb/lit/Driver/LocalLLDBInit.test =================================================================== --- lldb/lit/Driver/LocalLLDBInit.test +++ lldb/lit/Driver/LocalLLDBInit.test @@ -1,9 +1,11 @@ # RUN: mkdir -p %t.root # 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: %lldb-init -o 'settings show frame-format' 2>&1 | FileCheck %s --check-prefix=WARNINIT --check-prefix=CHECK +# RUN: %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
Index: lldb/tools/driver/Options.td =================================================================== --- lldb/tools/driver/Options.td +++ lldb/tools/driver/Options.td @@ -95,6 +95,9 @@ Alias<no_lldbinit>, HelpText<"Alias for --no-lldbinit">, Group<grp_command>; +def local_lldbinit: F<"local-lldbinit">, + HelpText<"Allow the debugger to load the local lldbinit files.">, + Group<grp_command>; def batch: F<"batch">, HelpText<"Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.">, Index: lldb/tools/driver/Driver.cpp =================================================================== --- lldb/tools/driver/Driver.cpp +++ lldb/tools/driver/Driver.cpp @@ -222,6 +222,11 @@ 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); } Index: lldb/lit/Driver/LocalLLDBInit.test =================================================================== --- lldb/lit/Driver/LocalLLDBInit.test +++ lldb/lit/Driver/LocalLLDBInit.test @@ -1,9 +1,11 @@ # RUN: mkdir -p %t.root # 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: %lldb-init -o 'settings show frame-format' 2>&1 | FileCheck %s --check-prefix=WARNINIT --check-prefix=CHECK +# RUN: %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
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits