diff options
author | Larry Ewing <lewing@microsoft.com> | 2020-01-29 07:12:08 +0300 |
---|---|---|
committer | Larry Ewing <lewing@microsoft.com> | 2020-01-29 07:17:07 +0300 |
commit | c6e9369de28efedd4271bfcd78409b822c1b71b3 (patch) | |
tree | 3af429072fadd46959da9ebb2bff3b9e8d1e99de /sdks | |
parent | edfe20ffc74dc1918a8fc3416a37404a9ad3d35b (diff) | |
parent | 883162e861c95b7be7c3e830f1d70ff1c8e74fa9 (diff) |
Merge remote-tracking branch 'upstream/master' into checkpoint
Diffstat (limited to 'sdks')
-rw-r--r-- | sdks/wasm/Mono.WebAssembly.DebuggerProxy/DebugStore.cs | 21 | ||||
-rw-r--r-- | sdks/wasm/Mono.WebAssembly.DebuggerProxy/MonoProxy.cs | 2 |
2 files changed, 18 insertions, 5 deletions
diff --git a/sdks/wasm/Mono.WebAssembly.DebuggerProxy/DebugStore.cs b/sdks/wasm/Mono.WebAssembly.DebuggerProxy/DebugStore.cs index c8494518ad7..1088307b338 100644 --- a/sdks/wasm/Mono.WebAssembly.DebuggerProxy/DebugStore.cs +++ b/sdks/wasm/Mono.WebAssembly.DebuggerProxy/DebugStore.cs @@ -10,6 +10,7 @@ using Mono.Cecil.Pdb; using Newtonsoft.Json; using System.Text.RegularExpressions; using System.Threading.Tasks; +using System.Threading; namespace WebAssembly.Net.Debugging { internal class BreakPointRequest { @@ -24,7 +25,9 @@ namespace WebAssembly.Net.Debugging { public static BreakPointRequest Parse (JObject args, DebugStore store) { - if (args == null) + // Events can potentially come out of order, so DebugStore may not be initialized + // The BP being set in these cases are JS ones, which we can safely ignore + if (args == null || store == null) return null; var url = args? ["url"]?.Value<string> (); @@ -492,6 +495,7 @@ namespace WebAssembly.Net.Debugging { } internal class DebugStore { + MonoProxy proxy; List<AssemblyInfo> assemblies = new List<AssemblyInfo> (); HttpClient client = new HttpClient (); @@ -500,7 +504,7 @@ namespace WebAssembly.Net.Debugging { public Task<byte[][]> Data { get; set; } } - public async Task Load (string [] loaded_files) + public async Task Load (SessionId sessionId, string [] loaded_files, CancellationToken token) { static bool MatchPdb (string asm, string pdb) => Path.ChangeExtension (asm, "pdb") == pdb; @@ -525,6 +529,15 @@ namespace WebAssembly.Net.Debugging { }); } catch (Exception e) { Console.WriteLine ($"Failed to read {url} ({e.Message})"); + var o = JObject.FromObject (new { + entry = new { + source = "other", + level = "warning", + text = $"Failed to read {url} ({e.Message})" + } + }); + proxy.SendEvent (sessionId, "Log.entryAdded", o, token); + } } @@ -547,7 +560,7 @@ namespace WebAssembly.Net.Debugging { public AssemblyInfo GetAssemblyByName (string name) => assemblies.FirstOrDefault (a => a.Name.Equals (name, StringComparison.InvariantCultureIgnoreCase)); - /* + /* V8 uses zero based indexing for both line and column. PPDBs uses one based indexing for both line and column. */ @@ -600,7 +613,7 @@ namespace WebAssembly.Net.Debugging { PPDBs uses one based indexing for both line and column. */ static bool Match (SequencePoint sp, int line, int column) - { + { var bp = (line: line + 1, column: column + 1); if (sp.StartLine > bp.line || sp.EndLine < bp.line) diff --git a/sdks/wasm/Mono.WebAssembly.DebuggerProxy/MonoProxy.cs b/sdks/wasm/Mono.WebAssembly.DebuggerProxy/MonoProxy.cs index 9cdb0549002..623cdeb0353 100644 --- a/sdks/wasm/Mono.WebAssembly.DebuggerProxy/MonoProxy.cs +++ b/sdks/wasm/Mono.WebAssembly.DebuggerProxy/MonoProxy.cs @@ -596,7 +596,7 @@ namespace WebAssembly.Net.Debugging { var the_pdbs = the_value?.ToObject<string[]> (); store = new DebugStore (); - await store.Load(the_pdbs); + await store.Load(sessionId, the_pdbs, token); } async Task RuntimeReady (SessionId sessionId, CancellationToken token) |