diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/Debuggers.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/Debuggers.py --- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/Debuggers.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/Debuggers.py @@ -114,6 +114,14 @@ action='store_true', default=False, help='pass the debugger paths relative to --source-root-dir') + parser.add_argument( + '--target-run-args', + type=str, + metavar='', + default='', + help='command line arguments for the test program, in addition to any ' + 'provided by DexCommandLine') + def handle_debugger_tool_base_options(context, defaults): # noqa options = context.options diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/dbgeng/dbgeng.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/dbgeng/dbgeng.py --- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/dbgeng/dbgeng.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/dbgeng/dbgeng.py @@ -96,7 +96,7 @@ raise NotImplementedError('delete_conditional_breakpoint is not yet implemented by dbgeng') def launch(self, cmdline): - assert len(cmdline) == 0, "Command lines unimplemented for dbgeng right now" + assert len(cmdline) == 0 and not self.context.options.target_run_args, "Command lines unimplemented for dbgeng right now" # We are, by this point, already launched. self.step_info = probe_process.probe_state(self.client) diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py --- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py @@ -9,6 +9,7 @@ import imp import os +import shlex from subprocess import CalledProcessError, check_output, STDOUT import sys @@ -171,6 +172,8 @@ self._target.BreakpointDelete(id) def launch(self, cmdline): + if self.context.options.target_run_args: + cmdline += shlex.split(self.context.options.target_run_args) self._process = self._target.LaunchSimple(cmdline, None, os.getcwd()) if not self._process or self._process.GetNumThreads() == 0: raise DebuggerException('could not launch process') diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/visualstudio/VisualStudio.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/visualstudio/VisualStudio.py --- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/visualstudio/VisualStudio.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/visualstudio/VisualStudio.py @@ -250,6 +250,8 @@ def launch(self, cmdline): cmdline_str = ' '.join(cmdline) + if self.context.options.target_run_args: + cmdline_str += f" {self.context.options.target_run_args}" # In a slightly baroque manner, lookup the VS project that runs when # you click "run", and set its command line options to the desired diff --git a/cross-project-tests/debuginfo-tests/dexter/feature_tests/subtools/test/target_run_args.c b/cross-project-tests/debuginfo-tests/dexter/feature_tests/subtools/test/target_run_args.c new file mode 100644 --- /dev/null +++ b/cross-project-tests/debuginfo-tests/dexter/feature_tests/subtools/test/target_run_args.c @@ -0,0 +1,14 @@ +// The dbgeng driver doesn't support --target-run-args yet. +// UNSUPPORTED: system-windows +// +// RUN: %dexter_regression_test --target-run-args "a b 'c d'" -- %s | FileCheck %s +// CHECK: target_run_args.c: + +int main(int argc, const char **argv) { + if (argc == 4) + return 0; // DexLabel('retline') + + return 1; // DexUnreachable() +} + +// DexExpectWatchValue('argc', '4', on_line=ref('retline'))