diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/builder/ParserOptions.py b/cross-project-tests/debuginfo-tests/dexter/dex/builder/ParserOptions.py --- a/cross-project-tests/debuginfo-tests/dexter/dex/builder/ParserOptions.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/builder/ParserOptions.py @@ -48,6 +48,8 @@ type=str, choices=sorted(_find_build_scripts().keys()), help='test builder to use') + build_group.add_argument('--vs-solution', metavar="", + help='provide a path to an already existing visual studio solution.') parser.add_argument( '--cflags', type=str, default='', help='compiler flags') parser.add_argument('--ldflags', type=str, default='', help='linker flags') diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py --- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerBase.py @@ -30,6 +30,7 @@ self._interface = None self.has_loaded = False self._loading_error = NotYetLoadedDebuggerException() + self.init_success = False try: self._interface = self._load_interface() self.has_loaded = True @@ -41,8 +42,9 @@ try: self._custom_init() self.clear_breakpoints() - except DebuggerException: - self._loading_error = sys.exc_info() + self.init_success = True + except DebuggerException as e: + self._loading_error = e.msg return self def __exit__(self, *args): @@ -64,7 +66,7 @@ @property def loading_error(self): - return (str(self._loading_error[1]) + return (str(self._loading_error) if self._loading_error is not None else None) @property diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/DebuggerControllerBase.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/DebuggerControllerBase.py --- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/DebuggerControllerBase.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/DebuggerControllerBase.py @@ -21,7 +21,10 @@ """ self.debugger = debugger with self.debugger: - self._run_debugger_custom() + if self.debugger.init_success: + self._run_debugger_custom() + else: + raise Exception(self.debugger.loading_error) # We may need to pickle this debugger controller after running the # debugger. Debuggers are not picklable objects, so set to None. self.debugger = None 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 @@ -67,6 +67,23 @@ super(VisualStudio, self).__init__(*args) + def _create_solution(self): + self._solution.Create(self.context.working_directory.path, + 'DexterSolution') + try: + self._solution.AddFromFile(self._project_file) + except OSError: + raise LoadDebuggerException( + 'could not debug the specified executable', sys.exc_info()) + + def _load_solution(self): + try: + self._solution.Open(self.context.options.vs_solution) + except: + raise LoadDebuggerException( + 'could not load specified vs solution at {}'. + format(self.context.options.vs_solution), sys.exc_info()) + def _custom_init(self): try: self._debugger = self._interface.Debugger @@ -76,14 +93,10 @@ self.context.options.show_debugger) self._solution = self._interface.Solution - self._solution.Create(self.context.working_directory.path, - 'DexterSolution') - - try: - self._solution.AddFromFile(self._project_file) - except OSError: - raise LoadDebuggerException( - 'could not debug the specified executable', sys.exc_info()) + if self.context.options.vs_solution is None: + self._create_solution() + else: + self._load_solution() self._fn_step = self._debugger.StepInto self._fn_go = self._debugger.Go diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/tools/TestToolBase.py b/cross-project-tests/debuginfo-tests/dexter/dex/tools/TestToolBase.py --- a/cross-project-tests/debuginfo-tests/dexter/dex/tools/TestToolBase.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/tools/TestToolBase.py @@ -58,7 +58,12 @@ warn(self.context, '--cflags and --ldflags will be ignored when not' ' using --builder') - if options.binary: + if options.vs_solution: + options.vs_solution = os.path.abspath(options.vs_solution) + if not os.path.isfile(options.vs_solution): + raise Error('could not find VS solution file "{}"' + .format(options.vs_solution)) + elif options.binary: options.binary = os.path.abspath(options.binary) if not os.path.isfile(options.binary): raise Error('could not find binary file "{}"' diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/tools/test/Tool.py b/cross-project-tests/debuginfo-tests/dexter/dex/tools/test/Tool.py --- a/cross-project-tests/debuginfo-tests/dexter/dex/tools/test/Tool.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/tools/test/Tool.py @@ -108,9 +108,13 @@ """Build an executable from the test source with the given --builder script and flags (--cflags, --ldflags) in the working directory. Or, if the --binary option has been given, copy the executable provided - into the working directory and rename it to match the --builder output. + into the working directory and rename it to match the --builder output + or skip if --vs-solution was passed on the command line. """ + if self.context.options.vs_solution: + return + options = self.context.options if options.binary: # Copy user's binary into the tmp working directory