From cd3b5f5baa5838628901611fe4d7a6471ff7bcc8 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Mon, 16 Nov 2020 21:17:22 +0000 Subject: [PATCH] Update mono debug; even though it doesn't work --- python3/vimspector/breakpoints.py | 15 ++++++++--- python3/vimspector/gadgets.py | 13 +++++++--- python3/vimspector/terminal.py | 7 +++--- support/test/csharp/.vimspector.json | 6 ++++- support/test/csharp/Program.cs | 37 +++++++++++++++++++++++----- 5 files changed, 61 insertions(+), 17 deletions(-) diff --git a/python3/vimspector/breakpoints.py b/python3/vimspector/breakpoints.py index 19075ae..679cd9c 100644 --- a/python3/vimspector/breakpoints.py +++ b/python3/vimspector/breakpoints.py @@ -295,9 +295,16 @@ class ProjectBreakpoints( object ): awaiting = 0 - def response_received(): + def response_received( *failure_args ): nonlocal awaiting awaiting = awaiting - 1 + + if failure_args and self._connection: + reason, msg = failure_args + utils.UserMessage( 'Unable to set breakpoint: {0}'.format( reason ), + persist = True, + error = True ) + if awaiting == 0 and doneHandler: doneHandler() @@ -364,7 +371,7 @@ class ProjectBreakpoints( object ): }, 'sourceModified': False, # TODO: We can actually check this }, - failure_handler = lambda *_: response_received() + failure_handler = response_received ) # TODO: Add the _configured_breakpoints to function breakpoints @@ -388,7 +395,7 @@ class ProjectBreakpoints( object ): 'breakpoints': breakpoints, } }, - failure_handler = lambda *_: response_received() + failure_handler = response_received ) if self._exception_breakpoints: @@ -399,7 +406,7 @@ class ProjectBreakpoints( object ): 'command': 'setExceptionBreakpoints', 'arguments': self._exception_breakpoints }, - failure_handler = lambda *_: response_received() + failure_handler = response_received ) if awaiting == 0 and doneHandler: diff --git a/python3/vimspector/gadgets.py b/python3/vimspector/gadgets.py index 363def6..3682ab0 100644 --- a/python3/vimspector/gadgets.py +++ b/python3/vimspector/gadgets.py @@ -237,7 +237,8 @@ GADGETS = { }, 'macos': { 'file_name': 'netcoredbg-osx.tar.gz', - 'checksum': '', + 'checksum': + '71c773e34d358950f25119bade7e3081c4c2f9d71847bd49027ca5792e918beb', }, 'linux': { 'file_name': 'netcoredbg-linux-bionic.tar.gz', @@ -279,9 +280,9 @@ GADGETS = { }, 'all': { 'file_name': 'vscode-mono-debug.vsix', - 'version': '0.15.8', + 'version': '0.16.2', 'checksum': - '723eb2b621b99d65a24f215cb64b45f5fe694105613a900a03c859a62a810470', + '121eca297d83daeeb1e6e1d791305d1827998dbd595c330086b3b94d33dba3b9', }, 'adapters': { 'vscode-mono-debug': { @@ -293,6 +294,12 @@ GADGETS = { "attach": { "pidSelect": "none" }, + "configuration": { + "cwd": "${workspaceRoot}", + "console": "integratedTerminal", + "args": [], + "env": {} + } }, } }, diff --git a/python3/vimspector/terminal.py b/python3/vimspector/terminal.py index a2ed264..6ffd56a 100644 --- a/python3/vimspector/terminal.py +++ b/python3/vimspector/terminal.py @@ -1,5 +1,6 @@ from vimspector import utils, settings +import os import vim @@ -17,9 +18,9 @@ def LaunchTerminal( api_prefix, else: term = existing_term - cwd = params[ 'cwd' ] - args = params[ 'args' ] - env = params.get( 'env', {} ) + cwd = params[ 'cwd' ] or os.getcwd() + args = params[ 'args' ] or [] + env = params.get( 'env' ) or {} term_options = { 'vertical': 1, diff --git a/support/test/csharp/.vimspector.json b/support/test/csharp/.vimspector.json index d5a68b6..524ae1a 100644 --- a/support/test/csharp/.vimspector.json +++ b/support/test/csharp/.vimspector.json @@ -13,7 +13,11 @@ "adapter": "vscode-mono-debug", "configuration": { "request": "launch", - "program": "${workspaceRoot}/Program.exe" + "program": "${workspaceRoot}/Program.exe", + "console": "integratedTerminal", + "cwd": "${workspaceRoot}", + "args": [], + "env": {} } } } diff --git a/support/test/csharp/Program.cs b/support/test/csharp/Program.cs index 260d2f4..ff90ed6 100644 --- a/support/test/csharp/Program.cs +++ b/support/test/csharp/Program.cs @@ -2,11 +2,36 @@ namespace csharp { - class Program - { - static void Main(string[] args) - { - Console.WriteLine("Hello World!"); - } + class Program + { + string toaster = "Making round of toast"; + static int max_bread = 100; + int bread = max_bread; + + void PrintToast( int r ) { + int this_round = ( max_bread - bread - r); + Console.WriteLine( this.toaster + ": " + this_round ); } + + void MakeToast( int rounds ) { + if (this.bread - rounds < 0) { + throw new Exception( "No moar bread!" ); + } + + this.bread -= rounds; + for (int r = 0; r < rounds; ++r) { + this.PrintToast( r ); + } + + Console.WriteLine( "Got only " + this.bread + " left" ); + } + + static void Main(string[] args) + { + Program p = new Program(); + for (int x = 1; x < 10; ++ x) { + p.MakeToast( x ); + } + } + } }