Skip to content

Commit 6edb4f4

Browse files
committed
Pass args to lldb_batchmode.py via environment variables
1 parent 5038a0a commit 6edb4f4

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/etc/lldb_batchmode.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,18 +176,22 @@ def watchdog():
176176
watchdog_thread.start()
177177

178178

179+
def get_env_arg(name):
180+
value = os.environ.get(name)
181+
if value is None:
182+
print("must set %s" % name)
183+
sys.exit(1)
184+
return value
185+
186+
179187
####################################################################################################
180188
# ~main
181189
####################################################################################################
182190

183191

184192
def main():
185-
if len(sys.argv) != 3:
186-
print("usage: python lldb_batchmode.py target-path script-path")
187-
sys.exit(1)
188-
189-
target_path = sys.argv[1]
190-
script_path = sys.argv[2]
193+
target_path = get_env_arg("LLDB_BATCHMODE_TARGET_PATH")
194+
script_path = get_env_arg("LLDB_BATCHMODE_SCRIPT_PATH")
191195

192196
print("LLDB batch-mode script")
193197
print("----------------------")

src/tools/compiletest/src/runtest/debuginfo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,8 @@ impl TestCx<'_> {
458458
self.run_command_to_procres(
459459
Command::new(&self.config.python)
460460
.arg(&lldb_script_path)
461-
.arg(test_executable)
462-
.arg(debugger_script)
461+
.env("LLDB_BATCHMODE_TARGET_PATH", test_executable)
462+
.env("LLDB_BATCHMODE_SCRIPT_PATH", debugger_script)
463463
.env("PYTHONUNBUFFERED", "1") // Help debugging #78665
464464
.env("PYTHONPATH", pythonpath),
465465
)

0 commit comments

Comments
 (0)