From a12eccf959d3d89a7b061abf3e2ec76646029b3e Mon Sep 17 00:00:00 2001 From: nicklas Date: Fri, 11 May 2018 11:23:01 +0200 Subject: [PATCH] Adding new exception to list of exception breakpoints works. Updated image to make it visible both in dark and light theme. Removed unhandled exception menu as it doesn't do anything. --- .gitignore | 10 +++++- .vscodeignore | 4 ++- Changelog.txt | 4 +++ Images/dark/Unity.png | Bin 0 -> 6119 bytes UnityDebug/UnityDebugSession.cs | 55 +++----------------------------- package.json | 22 ++----------- typescript/attach.ts | 5 +-- typescript/exceptions.ts | 16 +++++++++- 8 files changed, 39 insertions(+), 77 deletions(-) create mode 100644 Images/dark/Unity.png diff --git a/.gitignore b/.gitignore index 1be8bbb..49386ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,12 @@ UnityDebug/obj bin *.zip -*.vsix \ No newline at end of file +*.vsix +*.DotSettings.user +.idea +.vscode +.vs +node_modules +oldExternal +out +packages \ No newline at end of file diff --git a/.vscodeignore b/.vscodeignore index 9dc4e79..9e2f434 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -8,4 +8,6 @@ !bin/** !Changelog.txt !README.md -!Images/unity-logo128x128.png \ No newline at end of file +!Images/unity-logo128x128.png +!Images/dark/Unity.png +!.idea \ No newline at end of file diff --git a/Changelog.txt b/Changelog.txt index 43ca1fa..e9fc843 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -6,6 +6,10 @@ Git: https://github.com/Unity-Technologies/vscode-unity-debug Changes ------- +2.5.0 +===== + - New support for halt on exception. In debug view a list of exceptions control which to break on. + 2.4.2 ===== - Added support for Library/EditorInstance.json. The correct process is attached and multiple editors are running. diff --git a/Images/dark/Unity.png b/Images/dark/Unity.png new file mode 100644 index 0000000000000000000000000000000000000000..331c37aa5688da5eb9a8e58730c0d578b19b5f3c GIT binary patch literal 6119 zcmXw7cQjmIxV?H0qmv*?bRnXb5E;GKs6(O~f@q@;AyI;8(TPrUQKOR}M9b)-_ud(V zc=z|-dV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O+H(*FJ{pNrxnQ`K`z47gLJ?lhv|A-2+#@C=B1<9*Xe-|{hB!W-QUhrPu z(S)Y$ZI#2?z8n7O1NUxniQT_3aJG%|-LcGyYF+0%Nz$`uYoQ$$C}@7;atnXNy5%aW z*4*sEeAC$}pN%<`p>c1gaJELx{?3wa)FkNyp{}c^*G=3h%RAfPLQ3m-v1g)@DFJD3 zZ+FoHn1gTJ`C8J<5O?2eC^W2BX+ZC+1B1nW{7A}g-lQ{)K$-qTp{UAUn$6qXF_`;4 z-Ew&dWCO4_TJV>qrcnh298g6?RtX9EprD|r#~q%EW4q_AWe%ItQeuA&RS6>;Adohf zkwZ8f&Lb_I0Y(g4TVwe)Li8oz*E0&;pv|wY780f>{og<=fF&JK8LU$y}fKABGi6uFo{y?ndQ5_ zTt~I*N~hRMY={aJ1JUJxka6U7LB|aXV!^=bza(;R&zYB-`%8DX0A}WWG zY}viliv$h}L%hy#UR$RoERL{<_f%sVugxdZ^9NG|6T7UwEC&6JxySNMBP}h>6Xdp6 zu!O`!$61kR@^)AP$NA+H@m~V%nY*Px za-nXfr?~0qIEyC3 zIXl!VcEmhvI||Tu5nIpM7>BNA79+V)Ch!hk;LS5>H|D95`*Qyul7n$M_1GN_ov3{V U`OueYFu(^?6}6z13Ra>217iXCDF6Tf literal 0 HcmV?d00001 diff --git a/UnityDebug/UnityDebugSession.cs b/UnityDebug/UnityDebugSession.cs index fd0ec64..3030f2a 100644 --- a/UnityDebug/UnityDebugSession.cs +++ b/UnityDebug/UnityDebugSession.cs @@ -12,6 +12,8 @@ using System.Net; using Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages; using Mono.Debugging.Client; +using Mono.Debugging.Evaluation; +using Mono.Debugging.Soft; using VSCodeDebug; using MonoDevelop.Debugger.Soft.Unity; using MonoDevelop.Unity.Debugger; @@ -192,7 +194,7 @@ public override void Initialize(Response response, dynamic args) supportsConfigurationDoneRequest = false, // This debug adapter does not support function breakpoints. - supportsFunctionBreakpoints = true, + supportsFunctionBreakpoints = false, // This debug adapter doesn't support conditional breakpoints. supportsConditionalBreakpoints = true, @@ -207,11 +209,7 @@ public override void Initialize(Response response, dynamic args) supportsSetVariable = true, // This debug adapter does not support exception breakpoint filters - exceptionBreakpointFilters = new[] - { - new ExceptionBreakpointsFilter("all_exceptions", "All Exceptions"), - new ExceptionBreakpointsFilter("unhandled", "Unhandled_exceptions"), - } + exceptionBreakpointFilters = new ExceptionBreakpointsFilter[0] }); // Mono Debug is ready to accept breakpoints immediately @@ -435,8 +433,6 @@ private void PauseDebugger() protected override void SetVariable(Response response, object args) { - SendOutput("stdout", "Found this: " + args); - SendOutput("stdout", "This is response: " + response); int reference = getInt(args, "variablesReference", -1); if (reference == -1) { SendErrorResponse(response, 3009, "variables: property 'variablesReference' is missing", null, false, true); @@ -679,45 +675,8 @@ public override void Threads(Response response, dynamic args) SendResponse(response, new ThreadsResponseBody(threads)); } - private static string ParseEvaluate(string expression) - { - // Parse expressions created by using "Add Watch" in VS Code. - // Add Watch expressions examples: - // Done_PlayerController this.UnityEngine.GameObject gameObject.UnityEngine.SceneManagement.Scene scene.bool isLoaded - // Done_PlayerController this.UnityEngine.GameObject gameObject. Static members. Non-public members.int OffsetOfInstanceIDInCPlusPlusObject - - // Replace "Static members" and "Non-public members" with strings without spaces, so we can Split the string correctly. - var exp = expression.Replace ("Static members.", "static-members").Replace ("Non-public members.", "non-public-members"); - var expStrings = exp.Split (' '); - var parsedExpression = ""; - - if (expStrings.Length > 1) - { - foreach (var subexp in expStrings) - { - // Skip static and non public members substrings - if (subexp.StartsWith ("static-members") || subexp.StartsWith ("non-public-members")) - continue; - - // If array operator, remove previous '.' - if (subexp.StartsWith ("[")) - parsedExpression = parsedExpression.Substring (0, parsedExpression.Length - 1); - - int index = subexp.IndexOf ('.'); - - if (index > 0) - parsedExpression += subexp.Substring (0, index + 1); - } - - parsedExpression += expStrings.Last (); - Log.Write ("Parsed Expression: '" + expression + "' -> '" + parsedExpression + "'"); - } - return parsedExpression; - } - public override void Evaluate(Response response, dynamic args) { - SendOutput("stdout", "Starting"); var expression = getString(args, "expression"); if (expression == null) { @@ -734,18 +693,12 @@ public override void Evaluate(Response response, dynamic args) SendError(response, "invalid expression"); return; } - SendOutput("stdout", "Valid expression " + args); var evaluationOptions = m_DebuggerSessionOptions.EvaluationOptions.Clone(); evaluationOptions.EllipsizeStrings = false; evaluationOptions.AllowMethodEvaluation = true; - m_Session.Options.EvaluationOptions = evaluationOptions; - m_Session.Options.ProjectAssembliesOnly = true; - m_Session.Options.StepOverPropertiesAndOperators = false; var val = Frame.GetExpressionValue(expression, true); - SendOutput("stdout", "Sent expression"); val.WaitHandle.WaitOne(); - SendOutput("stdout", "Waiting"); var flags = val.Flags; if (flags.HasFlag(ObjectValueFlags.Error) || flags.HasFlag(ObjectValueFlags.NotSupported)) diff --git a/package.json b/package.json index ef01a18..e2dacb2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "unity-debug", "displayName": "Debugger for Unity", - "version": "2.4.2", + "version": "2.5.0", "publisher": "Unity", "description": "Unity debugger extension", "license": "MIT", @@ -41,14 +41,13 @@ "type": "git", "url": "https://github.com/Unity-Technologies/vscode-unity-debug.git" }, - "icon": "Images/unity-logo128x128.png", + "icon": "Images/dark/Unity.png", "main": "./out/attach.js", "scripts": { "prepare": "make build", "vscode:prepublish": "make build", "compile": "make build", "watch": "tsc -w -p ./src/typescript", - "test": "make tests; mocha --timeout 10000 -u tdd ./out/tests", "postinstall": "node ./node_modules/vscode/bin/install" }, "activationEvents": [ @@ -60,12 +59,6 @@ "command": "attach.attachToDebugger", "title": "Unity Attach Debugger" }, - { - "command": "attach.configureExceptions", - "title": "Configure exception breakpoints", - "category": "Exceptions", - "icon": "Images/unity-logo128x128.png" - }, { "command": "exceptions.addEntry", "title": "Add", @@ -76,16 +69,11 @@ }, { "command": "exceptions.always", - "title": "Always", - "category": "inline" + "title": "Always" }, { "command": "exceptions.never", "title": "Never" - }, - { - "command": "exceptions.unhandled", - "title": "Unhandled" } ], "views": { @@ -112,10 +100,6 @@ { "command": "exceptions.never", "when": "view == exceptions && viewItem == exception" - }, - { - "command": "exceptions.unhandled", - "when": "view == exceptions && viewItem == exception" } ] }, diff --git a/typescript/attach.ts b/typescript/attach.ts index 21b91b6..fbbfec9 100644 --- a/typescript/attach.ts +++ b/typescript/attach.ts @@ -7,8 +7,6 @@ import {exec} from 'child_process'; import { Exceptions, ExceptionConfigurations } from './exceptions'; const localize = nls.config({locale: process.env.VSCODE_NLS_CONFIG})(); - -const configuration = workspace.getConfiguration('unity-debug'); var exceptions; const DEFAULT_EXCEPTIONS: ExceptionConfigurations = { @@ -33,7 +31,7 @@ export function activate(context: ExtensionContext) { window.registerTreeDataProvider("exceptions", exceptions); context.subscriptions.push(commands.registerCommand('exceptions.always', exception => exceptions.always(exception))); context.subscriptions.push(commands.registerCommand('exceptions.never', exception => exceptions.never(exception))); - context.subscriptions.push(commands.registerCommand('exceptions.unhandled', exception => exceptions.unhandled(exception))); + context.subscriptions.push(commands.registerCommand('exceptions.addEntry', t => exceptions.addEntry(t))); context.subscriptions.push(commands.registerCommand('attach.attachToDebugger', config => startSession(context, config))); } @@ -82,7 +80,6 @@ class UnityDebugConfigurationProvider implements DebugConfigurationProvider { if (debugConfiguration && !debugConfiguration.__exceptionOptions) { debugConfiguration.__exceptionOptions = exceptions.convertToExceptionOptionsDefault(); } - console.log("dimmer resolve"); return debugConfiguration; } } diff --git a/typescript/exceptions.ts b/typescript/exceptions.ts index f4e5b47..e7cd945 100644 --- a/typescript/exceptions.ts +++ b/typescript/exceptions.ts @@ -1,4 +1,4 @@ -import {QuickPickItem, TreeDataProvider, Event, EventEmitter, TreeItem, ProviderResult, window} from 'vscode'; +import {QuickPickItem, TreeDataProvider, Event, EventEmitter, TreeItem, ProviderResult, window, InputBoxOptions} from 'vscode'; import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; import {DebugProtocol} from 'vscode-debugprotocol'; @@ -42,6 +42,20 @@ export class Exceptions implements TreeDataProvider { this.setExceptionBreakpoints(this.exceptions); } + public addEntry(t: any) { + let options: InputBoxOptions = { + placeHolder: "(Namespace.ExceptionName)" + } + + window.showInputBox(options).then(value => { + if (!value) { + return; + } + this.exceptions[value] = "never"; + this._onDidChangeTreeData.fire(); + }); + } + setExceptionBreakpoints(model: ExceptionConfigurations) { const args: DebugProtocol.SetExceptionBreakpointsArguments = {