[Lldb-commits] [PATCH] D70882: Add environment var LLDBVSCODE_SKIP_INIT_FILES to lldb-vscode

António Afonso via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 2 12:25:13 PST 2019


aadsm updated this revision to Diff 231759.
aadsm added a comment.

Use an env var instead


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70882

Files:
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/tools/lldb-vscode/lldb-vscode.cpp


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===================================================================
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -61,6 +61,8 @@
 
 #endif
 
+const bool skip_init_files = getenv("LLDBVSCODE_SKIP_INIT_FILES") != NULL;
+
 using namespace lldb_vscode;
 
 namespace {
@@ -1194,7 +1196,8 @@
 //   }]
 // }
 void request_initialize(const llvm::json::Object &request) {
-  g_vsc.debugger = lldb::SBDebugger::Create(true /*source_init_files*/);
+  g_vsc.debugger =
+      lldb::SBDebugger::Create(!skip_init_files /*source_init_files*/);
   // Create an empty target right away since we might get breakpoint requests
   // before we are given an executable to launch in a "launch" request, or a
   // executable when attaching to a process by process ID in a "attach"
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -839,13 +839,19 @@
 
 
 class DebugAdaptor(DebugCommunication):
-    def __init__(self, executable=None, port=None, init_commands=[]):
+    def __init__(
+        self, executable=None, port=None, init_commands=[], skip_init_files=True
+    ):
         self.process = None
         if executable is not None:
+            env = os.environ.copy()
+            if skip_init_files:
+                env['LLDBVSCODE_SKIP_INIT_FILES'] = "1"
             self.process = subprocess.Popen([executable],
                                             stdin=subprocess.PIPE,
                                             stdout=subprocess.PIPE,
-                                            stderr=subprocess.PIPE)
+                                            stderr=subprocess.PIPE,
+                                            env=env)
             DebugCommunication.__init__(self, self.process.stdout,
                                         self.process.stdin, init_commands)
         elif port is not None:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70882.231759.patch
Type: text/x-patch
Size: 2127 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191202/26016d74/attachment.bin>


More information about the lldb-commits mailing list