-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[wasm][debugger] Implement get bytes from loaded_files using debugger protocol. #69072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
347a41c
1f22eba
72c1295
9a5d9b7
8b2a01c
a948989
b441863
e41a8aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1279,36 +1279,55 @@ public IEnumerable<SourceFile> Add(SessionId id, string name, byte[] assembly_da | |
| } | ||
| } | ||
|
|
||
| public async IAsyncEnumerable<SourceFile> Load(SessionId id, string[] loaded_files, [EnumeratorCancellation] CancellationToken token) | ||
| public async IAsyncEnumerable<SourceFile> Load(SessionId id, string[] loaded_files, ExecutionContext context, bool useDebuggerProtocol, [EnumeratorCancellation] CancellationToken token) | ||
| { | ||
| var asm_files = new List<string>(); | ||
| var pdb_files = new List<string>(); | ||
| foreach (string file_name in loaded_files) | ||
| { | ||
| if (file_name.EndsWith(".pdb", StringComparison.OrdinalIgnoreCase)) | ||
| pdb_files.Add(file_name); | ||
| else | ||
| asm_files.Add(file_name); | ||
| } | ||
|
|
||
| List<DebugItem> steps = new List<DebugItem>(); | ||
| foreach (string url in asm_files) | ||
|
|
||
| if (!useDebuggerProtocol) | ||
| { | ||
| try | ||
| var pdb_files = new List<string>(); | ||
| foreach (string file_name in loaded_files) | ||
| { | ||
| string candidate_pdb = Path.ChangeExtension(url, "pdb"); | ||
| string pdb = pdb_files.FirstOrDefault(n => n == candidate_pdb); | ||
| if (file_name.EndsWith(".pdb", StringComparison.OrdinalIgnoreCase)) | ||
| pdb_files.Add(file_name); | ||
| else | ||
| asm_files.Add(file_name); | ||
| } | ||
|
|
||
| steps.Add( | ||
| new DebugItem | ||
| { | ||
| Url = url, | ||
| Data = Task.WhenAll(MonoProxy.HttpClient.GetByteArrayAsync(url, token), pdb != null ? MonoProxy.HttpClient.GetByteArrayAsync(pdb, token) : Task.FromResult<byte[]>(null)) | ||
| }); | ||
| foreach (string url in asm_files) | ||
| { | ||
| try | ||
| { | ||
| string candidate_pdb = Path.ChangeExtension(url, "pdb"); | ||
| string pdb = pdb_files.FirstOrDefault(n => n == candidate_pdb); | ||
|
|
||
| steps.Add( | ||
| new DebugItem | ||
| { | ||
| Url = url, | ||
| Data = Task.WhenAll(MonoProxy.HttpClient.GetByteArrayAsync(url, token), pdb != null ? MonoProxy.HttpClient.GetByteArrayAsync(pdb, token) : Task.FromResult<byte[]>(null)) | ||
| }); | ||
| } | ||
| catch (Exception e) | ||
| { | ||
| logger.LogDebug($"Failed to read {url} ({e.Message})"); | ||
| } | ||
| } | ||
| catch (Exception e) | ||
| } | ||
| else | ||
| { | ||
| foreach (string file_name in loaded_files) | ||
| { | ||
| logger.LogDebug($"Failed to read {url} ({e.Message})"); | ||
| if (!file_name.EndsWith(".pdb", StringComparison.OrdinalIgnoreCase)) | ||
|
||
| { | ||
| steps.Add( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. try/catch to handle exceptions |
||
| new DebugItem | ||
| { | ||
| Url = file_name, | ||
| Data = context.SdbAgent.GetBytesFromAssemblyAndPdb(System.IO.Path.GetFileName(file_name), token) | ||
|
||
| }); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.