aadsm updated this revision to Diff 231807.
aadsm added a comment.
Put the logic into a function
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
@@ -454,6 +454,11 @@
}
}
+const bool GetSkipInitFiles() {
+ static const bool skip_init_files = getenv("LLDBVSCODE_SKIP_INIT_FILES") !=
NULL;
+ return skip_init_files;
+}
+
// "AttachRequest": {
// "allOf": [ { "$ref": "#/definitions/Request" }, {
// "type": "object",
@@ -1194,7 +1199,9 @@
// }]
// }
void request_initialize(const llvm::json::Object &request) {
- g_vsc.debugger = lldb::SBDebugger::Create(true /*source_init_files*/);
+ const bool skip_init_files = GetSkipInitFiles();
+ 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:
Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===================================================================
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -454,6 +454,11 @@
}
}
+const bool GetSkipInitFiles() {
+ static const bool skip_init_files = getenv("LLDBVSCODE_SKIP_INIT_FILES") != NULL;
+ return skip_init_files;
+}
+
// "AttachRequest": {
// "allOf": [ { "$ref": "#/definitions/Request" }, {
// "type": "object",
@@ -1194,7 +1199,9 @@
// }]
// }
void request_initialize(const llvm::json::Object &request) {
- g_vsc.debugger = lldb::SBDebugger::Create(true /*source_init_files*/);
+ const bool skip_init_files = GetSkipInitFiles();
+ 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:
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits