Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit a12eccf

Browse files
committed
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.
1 parent c030eea commit a12eccf

File tree

8 files changed

+39
-77
lines changed

8 files changed

+39
-77
lines changed

Diff for: .gitignore

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
UnityDebug/obj
22
bin
33
*.zip
4-
*.vsix
4+
*.vsix
5+
*.DotSettings.user
6+
.idea
7+
.vscode
8+
.vs
9+
node_modules
10+
oldExternal
11+
out
12+
packages

Diff for: .vscodeignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88
!bin/**
99
!Changelog.txt
1010
!README.md
11-
!Images/unity-logo128x128.png
11+
!Images/unity-logo128x128.png
12+
!Images/dark/Unity.png
13+
!.idea

Diff for: Changelog.txt

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Git: https://github.com/Unity-Technologies/vscode-unity-debug
66
Changes
77
-------
88

9+
2.5.0
10+
=====
11+
- New support for halt on exception. In debug view a list of exceptions control which to break on.
12+
913
2.4.2
1014
=====
1115
- Added support for Library/EditorInstance.json. The correct process is attached and multiple editors are running.

Diff for: Images/dark/Unity.png

5.98 KB
Loading

Diff for: UnityDebug/UnityDebugSession.cs

+4-51
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
using System.Net;
1313
using Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages;
1414
using Mono.Debugging.Client;
15+
using Mono.Debugging.Evaluation;
16+
using Mono.Debugging.Soft;
1517
using VSCodeDebug;
1618
using MonoDevelop.Debugger.Soft.Unity;
1719
using MonoDevelop.Unity.Debugger;
@@ -192,7 +194,7 @@ public override void Initialize(Response response, dynamic args)
192194
supportsConfigurationDoneRequest = false,
193195

194196
// This debug adapter does not support function breakpoints.
195-
supportsFunctionBreakpoints = true,
197+
supportsFunctionBreakpoints = false,
196198

197199
// This debug adapter doesn't support conditional breakpoints.
198200
supportsConditionalBreakpoints = true,
@@ -207,11 +209,7 @@ public override void Initialize(Response response, dynamic args)
207209
supportsSetVariable = true,
208210

209211
// This debug adapter does not support exception breakpoint filters
210-
exceptionBreakpointFilters = new[]
211-
{
212-
new ExceptionBreakpointsFilter("all_exceptions", "All Exceptions"),
213-
new ExceptionBreakpointsFilter("unhandled", "Unhandled_exceptions"),
214-
}
212+
exceptionBreakpointFilters = new ExceptionBreakpointsFilter[0]
215213
});
216214

217215
// Mono Debug is ready to accept breakpoints immediately
@@ -435,8 +433,6 @@ private void PauseDebugger()
435433

436434
protected override void SetVariable(Response response, object args)
437435
{
438-
SendOutput("stdout", "Found this: " + args);
439-
SendOutput("stdout", "This is response: " + response);
440436
int reference = getInt(args, "variablesReference", -1);
441437
if (reference == -1) {
442438
SendErrorResponse(response, 3009, "variables: property 'variablesReference' is missing", null, false, true);
@@ -679,45 +675,8 @@ public override void Threads(Response response, dynamic args)
679675
SendResponse(response, new ThreadsResponseBody(threads));
680676
}
681677

682-
private static string ParseEvaluate(string expression)
683-
{
684-
// Parse expressions created by using "Add Watch" in VS Code.
685-
// Add Watch expressions examples:
686-
// Done_PlayerController this.UnityEngine.GameObject gameObject.UnityEngine.SceneManagement.Scene scene.bool isLoaded
687-
// Done_PlayerController this.UnityEngine.GameObject gameObject. Static members. Non-public members.int OffsetOfInstanceIDInCPlusPlusObject
688-
689-
// Replace "Static members" and "Non-public members" with strings without spaces, so we can Split the string correctly.
690-
var exp = expression.Replace ("Static members.", "static-members").Replace ("Non-public members.", "non-public-members");
691-
var expStrings = exp.Split (' ');
692-
var parsedExpression = "";
693-
694-
if (expStrings.Length > 1)
695-
{
696-
foreach (var subexp in expStrings)
697-
{
698-
// Skip static and non public members substrings
699-
if (subexp.StartsWith ("static-members") || subexp.StartsWith ("non-public-members"))
700-
continue;
701-
702-
// If array operator, remove previous '.'
703-
if (subexp.StartsWith ("["))
704-
parsedExpression = parsedExpression.Substring (0, parsedExpression.Length - 1);
705-
706-
int index = subexp.IndexOf ('.');
707-
708-
if (index > 0)
709-
parsedExpression += subexp.Substring (0, index + 1);
710-
}
711-
712-
parsedExpression += expStrings.Last ();
713-
Log.Write ("Parsed Expression: '" + expression + "' -> '" + parsedExpression + "'");
714-
}
715-
return parsedExpression;
716-
}
717-
718678
public override void Evaluate(Response response, dynamic args)
719679
{
720-
SendOutput("stdout", "Starting");
721680
var expression = getString(args, "expression");
722681

723682
if (expression == null) {
@@ -734,18 +693,12 @@ public override void Evaluate(Response response, dynamic args)
734693
SendError(response, "invalid expression");
735694
return;
736695
}
737-
SendOutput("stdout", "Valid expression " + args);
738696

739697
var evaluationOptions = m_DebuggerSessionOptions.EvaluationOptions.Clone();
740698
evaluationOptions.EllipsizeStrings = false;
741699
evaluationOptions.AllowMethodEvaluation = true;
742-
m_Session.Options.EvaluationOptions = evaluationOptions;
743-
m_Session.Options.ProjectAssembliesOnly = true;
744-
m_Session.Options.StepOverPropertiesAndOperators = false;
745700
var val = Frame.GetExpressionValue(expression, true);
746-
SendOutput("stdout", "Sent expression");
747701
val.WaitHandle.WaitOne();
748-
SendOutput("stdout", "Waiting");
749702

750703
var flags = val.Flags;
751704
if (flags.HasFlag(ObjectValueFlags.Error) || flags.HasFlag(ObjectValueFlags.NotSupported))

Diff for: package.json

+3-19
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "unity-debug",
33
"displayName": "Debugger for Unity",
4-
"version": "2.4.2",
4+
"version": "2.5.0",
55
"publisher": "Unity",
66
"description": "Unity debugger extension",
77
"license": "MIT",
@@ -41,14 +41,13 @@
4141
"type": "git",
4242
"url": "https://github.com/Unity-Technologies/vscode-unity-debug.git"
4343
},
44-
"icon": "Images/unity-logo128x128.png",
44+
"icon": "Images/dark/Unity.png",
4545
"main": "./out/attach.js",
4646
"scripts": {
4747
"prepare": "make build",
4848
"vscode:prepublish": "make build",
4949
"compile": "make build",
5050
"watch": "tsc -w -p ./src/typescript",
51-
"test": "make tests; mocha --timeout 10000 -u tdd ./out/tests",
5251
"postinstall": "node ./node_modules/vscode/bin/install"
5352
},
5453
"activationEvents": [
@@ -60,12 +59,6 @@
6059
"command": "attach.attachToDebugger",
6160
"title": "Unity Attach Debugger"
6261
},
63-
{
64-
"command": "attach.configureExceptions",
65-
"title": "Configure exception breakpoints",
66-
"category": "Exceptions",
67-
"icon": "Images/unity-logo128x128.png"
68-
},
6962
{
7063
"command": "exceptions.addEntry",
7164
"title": "Add",
@@ -76,16 +69,11 @@
7669
},
7770
{
7871
"command": "exceptions.always",
79-
"title": "Always",
80-
"category": "inline"
72+
"title": "Always"
8173
},
8274
{
8375
"command": "exceptions.never",
8476
"title": "Never"
85-
},
86-
{
87-
"command": "exceptions.unhandled",
88-
"title": "Unhandled"
8977
}
9078
],
9179
"views": {
@@ -112,10 +100,6 @@
112100
{
113101
"command": "exceptions.never",
114102
"when": "view == exceptions && viewItem == exception"
115-
},
116-
{
117-
"command": "exceptions.unhandled",
118-
"when": "view == exceptions && viewItem == exception"
119103
}
120104
]
121105
},

Diff for: typescript/attach.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import {exec} from 'child_process';
77
import { Exceptions, ExceptionConfigurations } from './exceptions';
88

99
const localize = nls.config({locale: process.env.VSCODE_NLS_CONFIG})();
10-
11-
const configuration = workspace.getConfiguration('unity-debug');
1210
var exceptions;
1311

1412
const DEFAULT_EXCEPTIONS: ExceptionConfigurations = {
@@ -33,7 +31,7 @@ export function activate(context: ExtensionContext) {
3331
window.registerTreeDataProvider("exceptions", exceptions);
3432
context.subscriptions.push(commands.registerCommand('exceptions.always', exception => exceptions.always(exception)));
3533
context.subscriptions.push(commands.registerCommand('exceptions.never', exception => exceptions.never(exception)));
36-
context.subscriptions.push(commands.registerCommand('exceptions.unhandled', exception => exceptions.unhandled(exception)));
34+
context.subscriptions.push(commands.registerCommand('exceptions.addEntry', t => exceptions.addEntry(t)));
3735
context.subscriptions.push(commands.registerCommand('attach.attachToDebugger', config => startSession(context, config)));
3836
}
3937

@@ -82,7 +80,6 @@ class UnityDebugConfigurationProvider implements DebugConfigurationProvider {
8280
if (debugConfiguration && !debugConfiguration.__exceptionOptions) {
8381
debugConfiguration.__exceptionOptions = exceptions.convertToExceptionOptionsDefault();
8482
}
85-
console.log("dimmer resolve");
8683
return debugConfiguration;
8784
}
8885
}

Diff for: typescript/exceptions.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {QuickPickItem, TreeDataProvider, Event, EventEmitter, TreeItem, ProviderResult, window} from 'vscode';
1+
import {QuickPickItem, TreeDataProvider, Event, EventEmitter, TreeItem, ProviderResult, window, InputBoxOptions} from 'vscode';
22
import * as vscode from 'vscode';
33
import * as nls from 'vscode-nls';
44
import {DebugProtocol} from 'vscode-debugprotocol';
@@ -42,6 +42,20 @@ export class Exceptions implements TreeDataProvider<Exception> {
4242
this.setExceptionBreakpoints(this.exceptions);
4343
}
4444

45+
public addEntry(t: any) {
46+
let options: InputBoxOptions = {
47+
placeHolder: "(Namespace.ExceptionName)"
48+
}
49+
50+
window.showInputBox(options).then(value => {
51+
if (!value) {
52+
return;
53+
}
54+
this.exceptions[value] = "never";
55+
this._onDidChangeTreeData.fire();
56+
});
57+
}
58+
4559
setExceptionBreakpoints(model: ExceptionConfigurations) {
4660

4761
const args: DebugProtocol.SetExceptionBreakpointsArguments = {

0 commit comments

Comments
 (0)