[Lldb-commits] [PATCH] D61578: [Driver] Add command line option to allow loading local lldbinit file

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue May 7 09:54:54 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL360172: [Driver] Add command line option to allow loading local lldbinit file. (authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D61578?vs=198334&id=198494#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61578/new/

https://reviews.llvm.org/D61578

Files:
  lldb/trunk/lit/Driver/LocalLLDBInit.test
  lldb/trunk/tools/driver/Driver.cpp
  lldb/trunk/tools/driver/Options.td


Index: lldb/trunk/tools/driver/Options.td
===================================================================
--- lldb/trunk/tools/driver/Options.td
+++ lldb/trunk/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 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.">,
Index: lldb/trunk/tools/driver/Driver.cpp
===================================================================
--- lldb/trunk/tools/driver/Driver.cpp
+++ lldb/trunk/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/trunk/lit/Driver/LocalLLDBInit.test
===================================================================
--- lldb/trunk/lit/Driver/LocalLLDBInit.test
+++ lldb/trunk/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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61578.198494.patch
Type: text/x-patch
Size: 2288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190507/0b197c9a/attachment.bin>


More information about the lldb-commits mailing list