未验证 提交 10701870 编写于 作者: T Thays Grazia 提交者: GitHub

[wasm][debugger] Fix side effect on Firefox of getting bytes from loaded_files...

[wasm][debugger] Fix side effect on Firefox of getting bytes from loaded_files using debugger protocol (#70990)

* Fix 70983

* fix typo

* Fix compilation
上级 96a7014d
......@@ -960,7 +960,7 @@ internal async Task<bool> OnGetBreakableLines(MessageId msg_id, string script_id
if (!SourceId.TryParse(script_id, out SourceId id))
return false;
SourceFile src_file = (await LoadStore(msg_id, token)).GetFileById(id);
SourceFile src_file = (await LoadStore(msg_id, false, token)).GetFileById(id);
await SendEvent(msg_id, "", JObject.FromObject(new { lines = src_file.BreakableLines.ToArray(), from = script_id }), token);
return true;
......@@ -971,7 +971,7 @@ internal override async Task<bool> OnGetScriptSource(MessageId msg_id, string sc
if (!SourceId.TryParse(script_id, out SourceId id))
return false;
SourceFile src_file = (await LoadStore(msg_id, token)).GetFileById(id);
SourceFile src_file = (await LoadStore(msg_id, false, token)).GetFileById(id);
try
{
......
......@@ -80,7 +80,7 @@ public async Task<JObject> GetValueFromObject(JToken objRet, CancellationToken t
public async Task<(JObject containerObject, ArraySegment<string> remaining)> ResolveStaticMembersInStaticTypes(ArraySegment<string> parts, CancellationToken token)
{
string classNameToFind = "";
var store = await proxy.LoadStore(sessionId, token);
var store = await proxy.LoadStore(sessionId, false, token);
var methodInfo = context.CallStack.FirstOrDefault(s => s.Id == scopeId)?.Method?.Info;
if (methodInfo == null)
......
......@@ -844,7 +844,7 @@ private async Task<bool> ProcessEnC(SessionId sessionId, ExecutionContext contex
byte[] pdb_buf = retDebuggerCmdReader.ReadBytes(pdb_size);
var assemblyName = await context.SdbAgent.GetAssemblyNameFromModule(moduleId, token);
DebugStore store = await LoadStore(sessionId, token);
DebugStore store = await LoadStore(sessionId, true, token);
AssemblyInfo asm = store.GetAssemblyByName(assemblyName);
var methods = DebugStore.EnC(asm, meta_buf, pdb_buf);
foreach (var method in methods)
......@@ -953,7 +953,7 @@ protected virtual async Task<bool> SendCallStack(SessionId sessionId, ExecutionC
var methodId = retDebuggerCmdReader.ReadInt32();
var il_pos = retDebuggerCmdReader.ReadInt32();
var flags = retDebuggerCmdReader.ReadByte();
DebugStore store = await LoadStore(sessionId, token);
DebugStore store = await LoadStore(sessionId, true, token);
var method = await context.SdbAgent.GetMethodInfo(methodId, token);
if (await ShouldSkipMethod(sessionId, context, event_kind, j, method, token))
......@@ -1252,7 +1252,7 @@ private async Task<bool> OnAssemblyLoadedJSEvent(SessionId sessionId, JObject ev
{
try
{
var store = await LoadStore(sessionId, token);
var store = await LoadStore(sessionId, true, token);
var assembly_name = eventArgs?["assembly_name"]?.Value<string>();
if (store.GetAssemblyByName(assembly_name) != null)
......@@ -1311,7 +1311,7 @@ private async Task OnSetEntrypointBreakpoint(SessionId sessionId, JObject args,
var assemblyName = assemblyAndMethodTokenArr[0];
var methodToken = Convert.ToInt32(assemblyAndMethodTokenArr[1]) & 0xffffff; //token
var store = await LoadStore(sessionId, token);
var store = await LoadStore(sessionId, true, token);
AssemblyInfo assembly = store.GetAssemblyByName(assemblyName);
if (assembly == null)
{
......@@ -1469,7 +1469,7 @@ internal virtual async Task OnSourceFileAdded(SessionId sessionId, SourceFile so
}
}
internal async Task<DebugStore> LoadStore(SessionId sessionId, CancellationToken token)
internal async Task<DebugStore> LoadStore(SessionId sessionId, bool tryUseDebuggerProtocol, CancellationToken token)
{
ExecutionContext context = GetContext(sessionId);
......@@ -1486,9 +1486,12 @@ internal async Task<DebugStore> LoadStore(SessionId sessionId, CancellationToken
else
{
var useDebuggerProtocol = false;
(int MajorVersion, int MinorVersion) = await context.SdbAgent.GetVMVersion(token);
if (MajorVersion == 2 && MinorVersion >= 61)
useDebuggerProtocol = true;
if (tryUseDebuggerProtocol)
{
(int MajorVersion, int MinorVersion) = await context.SdbAgent.GetVMVersion(token);
if (MajorVersion == 2 && MinorVersion >= 61)
useDebuggerProtocol = true;
}
await foreach (SourceFile source in context.store.Load(sessionId, loaded_files, context, useDebuggerProtocol, token))
{
......@@ -1541,7 +1544,7 @@ protected async Task<DebugStore> RuntimeReady(SessionId sessionId, CancellationT
await context.SdbAgent.EnableReceiveRequests(EventKind.EnC, token);
await context.SdbAgent.EnableReceiveRequests(EventKind.MethodUpdate, token);
DebugStore store = await LoadStore(sessionId, token);
DebugStore store = await LoadStore(sessionId, true, token);
context.ready.SetResult(store);
await SendEvent(sessionId, "Mono.runtimeReady", new JObject(), token);
await SendMonoCommand(sessionId, MonoCommands.SetDebuggerAttached(RuntimeId), token);
......@@ -1724,7 +1727,7 @@ internal virtual async Task<bool> OnGetScriptSource(MessageId msg_id, string scr
if (!SourceId.TryParse(script_id, out SourceId id))
return false;
SourceFile src_file = (await LoadStore(msg_id, token)).GetFileById(id);
SourceFile src_file = (await LoadStore(msg_id, true, token)).GetFileById(id);
try
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册