Skip to content
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

Revert "[wasm][debugger] Implement get bytes from loaded_files using debugger protocol." #70787

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,662 changes: 831 additions & 831 deletions eng/pipelines/common/platform-matrix.yml

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions eng/pipelines/runtime-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,30 +60,30 @@ jobs:
# WebAssembly legs - run windows builds. Also, debugger tests which are currently
# unstable
#
- template: /eng/pipelines/common/templates/wasm-library-tests.yml
parameters:
platforms:
- Browser_wasm_win
alwaysRun: ${{ variables.isRollingBuild }}
scenarios:
- normal
- WasmTestOnBrowser
#- template: /eng/pipelines/common/templates/wasm-library-tests.yml
#parameters:
#platforms:
#- Browser_wasm_win
#alwaysRun: ${{ variables.isRollingBuild }}
#scenarios:
#- normal
#- WasmTestOnBrowser

# AOT Library tests
- template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml
parameters:
platforms:
- Browser_wasm_win
nameSuffix: _AOT
runSmokeOnlyArg: $(_runSmokeTestsOnlyArg)
runAOT: true
alwaysRun: ${{ variables.isRollingBuild }}
## AOT Library tests
#- template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml
#parameters:
#platforms:
#- Browser_wasm_win
#nameSuffix: _AOT
#runSmokeOnlyArg: $(_runSmokeTestsOnlyArg)
#runAOT: true
#alwaysRun: ${{ variables.isRollingBuild }}

- template: /eng/pipelines/common/templates/wasm-build-tests.yml
parameters:
platforms:
- Browser_wasm_win
alwaysRun: ${{ variables.isRollingBuild }}
#- template: /eng/pipelines/common/templates/wasm-build-tests.yml
#parameters:
#platforms:
#- Browser_wasm_win
#alwaysRun: ${{ variables.isRollingBuild }}

- template: /eng/pipelines/common/templates/wasm-debugger-tests.yml
parameters:
Expand Down
102 changes: 51 additions & 51 deletions eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -353,63 +353,63 @@ jobs:
#
# WebAssembly legs
#
- template: /eng/pipelines/common/templates/wasm-library-tests.yml
parameters:
platforms:
- Browser_wasm
alwaysRun: ${{ variables.isRollingBuild }}
scenarios:
- normal
- WasmTestOnBrowser
#- template: /eng/pipelines/common/templates/wasm-library-tests.yml
#parameters:
#platforms:
#- Browser_wasm
#alwaysRun: ${{ variables.isRollingBuild }}
#scenarios:
#- normal
#- WasmTestOnBrowser

# EAT Library tests - only run on linux
- template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml
parameters:
platforms:
- Browser_wasm
nameSuffix: _EAT
runAOT: false
runSmokeOnlyArg: $(_runSmokeTestsOnlyArg)
alwaysRun: ${{ variables.isRollingBuild }}
## EAT Library tests - only run on linux
#- template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml
#parameters:
#platforms:
#- Browser_wasm
#nameSuffix: _EAT
#runAOT: false
#runSmokeOnlyArg: $(_runSmokeTestsOnlyArg)
#alwaysRun: ${{ variables.isRollingBuild }}

# AOT Library tests
- template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml
parameters:
platforms:
- Browser_wasm
nameSuffix: _AOT
runAOT: true
runSmokeOnlyArg: $(_runSmokeTestsOnlyArg)
alwaysRun: ${{ variables.isRollingBuild }}
## AOT Library tests
#- template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml
#parameters:
#platforms:
#- Browser_wasm
#nameSuffix: _AOT
#runAOT: true
#runSmokeOnlyArg: $(_runSmokeTestsOnlyArg)
#alwaysRun: ${{ variables.isRollingBuild }}

- template: /eng/pipelines/common/templates/wasm-build-tests.yml
parameters:
platforms:
- Browser_wasm
alwaysRun: ${{ variables.isRollingBuild }}
#- template: /eng/pipelines/common/templates/wasm-build-tests.yml
#parameters:
#platforms:
#- Browser_wasm
#alwaysRun: ${{ variables.isRollingBuild }}

- template: /eng/pipelines/common/templates/wasm-runtime-tests.yml
parameters:
platforms:
- Browser_wasm
alwaysRun: ${{ variables.isRollingBuild }}
#- template: /eng/pipelines/common/templates/wasm-runtime-tests.yml
#parameters:
#platforms:
#- Browser_wasm
#alwaysRun: ${{ variables.isRollingBuild }}

# BUILD ONLY - Wasm Threading Legs
- template: /eng/pipelines/common/templates/wasm-build-only.yml
parameters:
platforms:
- Browser_wasm
nameSuffix: _Threading
extraBuildArgs: /p:WasmEnableThreads=true
alwaysRun: ${{ variables.isRollingBuild }}
## BUILD ONLY - Wasm Threading Legs
#- template: /eng/pipelines/common/templates/wasm-build-only.yml
#parameters:
#platforms:
#- Browser_wasm
#nameSuffix: _Threading
#extraBuildArgs: /p:WasmEnableThreads=true
#alwaysRun: ${{ variables.isRollingBuild }}

- template: /eng/pipelines/common/templates/wasm-build-only.yml
parameters:
platforms:
- Browser_wasm
nameSuffix: _Threading_PerfTracing
extraBuildArgs: /p:WasmEnablePerfTracing=true
alwaysRun: ${{ variables.isRollingBuild }}
#- template: /eng/pipelines/common/templates/wasm-build-only.yml
#parameters:
#platforms:
#- Browser_wasm
#nameSuffix: _Threading_PerfTracing
#extraBuildArgs: /p:WasmEnablePerfTracing=true
#alwaysRun: ${{ variables.isRollingBuild }}

#
# iOS/tvOS devices - Full AOT + AggressiveTrimming to reduce size
Expand Down
5 changes: 2 additions & 3 deletions src/mono/mono/component/debugger-protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

#define MAJOR_VERSION 2
#define MINOR_VERSION 61
#define MINOR_VERSION 60

typedef enum {
MDBGPROT_CMD_COMPOSITE = 100
Expand All @@ -36,8 +36,7 @@ typedef enum {
MDBGPROT_CMD_VM_READ_MEMORY = 16,
MDBGPROT_CMD_VM_WRITE_MEMORY = 17,
MDBGPROT_CMD_GET_ASSEMBLY_BY_NAME = 18,
MDBGPROT_CMD_GET_MODULE_BY_GUID = 19,
MDBGPROT_CMD_GET_ASSEMBLY_BYTES = 20, //wasm specific
MDBGPROT_CMD_GET_MODULE_BY_GUID = 19
} MdbgProtCmdVM;

typedef enum {
Expand Down
18 changes: 0 additions & 18 deletions src/mono/mono/component/mini-wasm-debugger.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,24 +418,6 @@ mono_wasm_send_dbg_command (int id, MdbgProtCommandSet command_set, int command,
invoke_data.endp = data + size;
error = mono_do_invoke_method (tls, &buf, &invoke_data, data, &data);
}
else if (command_set == MDBGPROT_CMD_SET_VM && (command == MDBGPROT_CMD_GET_ASSEMBLY_BYTES))
{
char* assembly_name = m_dbgprot_decode_string (data, &data, data + size);
if (assembly_name == NULL)
{
m_dbgprot_buffer_add_int (&buf, 0);
m_dbgprot_buffer_add_int (&buf, 0);
}
else
{
unsigned int assembly_size = 0;
int symfile_size = 0;
const unsigned char* assembly_bytes = mono_wasm_get_assembly_bytes (assembly_name, &assembly_size);
const unsigned char* pdb_bytes = mono_get_symfile_bytes_from_bundle (assembly_name, &symfile_size);
m_dbgprot_buffer_add_byte_array (&buf, (uint8_t *) assembly_bytes, assembly_size);
m_dbgprot_buffer_add_byte_array (&buf, (uint8_t *) pdb_bytes, symfile_size);
}
}
else
error = mono_process_dbg_packet (id, command_set, command, &no_reply, data, data + size, &buf);

Expand Down
13 changes: 0 additions & 13 deletions src/mono/mono/metadata/mono-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -1112,19 +1112,6 @@ open_symfile_from_bundle (MonoImage *image)
return NULL;
}

const mono_byte *
mono_get_symfile_bytes_from_bundle (const char *assembly_name, int *size)
{
BundledSymfile *bsymfile;
for (bsymfile = bundled_symfiles; bsymfile; bsymfile = bsymfile->next) {
if (strcmp (bsymfile->aname, assembly_name))
continue;
*size = bsymfile->size;
return bsymfile->raw_contents;
}
return NULL;
}

void
mono_debugger_lock (void)
{
Expand Down
2 changes: 0 additions & 2 deletions src/mono/mono/mini/mini-wasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ G_EXTERN_C void mono_wasm_enable_debugging (int log_level);
void mono_wasm_set_timeout (int timeout);

int mono_wasm_assembly_already_added (const char *assembly_name);
const unsigned char *mono_wasm_get_assembly_bytes (const char *name, unsigned int *size);

void mono_wasm_print_stack_trace (void);

gboolean
Expand Down
74 changes: 22 additions & 52 deletions src/mono/wasm/debugger/BrowserDebugProxy/DebugStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1366,61 +1366,36 @@ public IEnumerable<SourceFile> Add(SessionId id, string name, byte[] assembly_da
}
}

public async IAsyncEnumerable<SourceFile> Load(SessionId id, string[] loaded_files, ExecutionContext context, bool useDebuggerProtocol, [EnumeratorCancellation] CancellationToken token)
public async IAsyncEnumerable<SourceFile> Load(SessionId id, string[] loaded_files, [EnumeratorCancellation] CancellationToken token)
{
var asm_files = new List<string>();
List<DebugItem> steps = new List<DebugItem>();

if (!useDebuggerProtocol)
var pdb_files = new List<string>();
foreach (string file_name in loaded_files)
{
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);
}
if (file_name.EndsWith(".pdb", StringComparison.OrdinalIgnoreCase))
pdb_files.Add(file_name);
else
asm_files.Add(file_name);
}

foreach (string url in asm_files)
List<DebugItem> steps = new List<DebugItem>();
foreach (string url in asm_files)
{
try
{
try
{
string candidate_pdb = Path.ChangeExtension(url, "pdb");
string pdb = pdb_files.FirstOrDefault(n => n == candidate_pdb);
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})");
}
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))
});
}
}
else
{
foreach (string file_name in loaded_files)
catch (Exception e)
{
if (file_name.EndsWith(".pdb", StringComparison.OrdinalIgnoreCase))
continue;
try
{
steps.Add(
new DebugItem
{
Url = file_name,
Data = context.SdbAgent.GetBytesFromAssemblyAndPdb(Path.GetFileName(file_name), token)
});
}
catch (Exception e)
{
logger.LogDebug($"Failed to read {file_name} ({e.Message})");
}
logger.LogDebug($"Failed to read {url} ({e.Message})");
}
}

Expand All @@ -1430,11 +1405,6 @@ public async IAsyncEnumerable<SourceFile> Load(SessionId id, string[] loaded_fil
try
{
byte[][] bytes = await step.Data.ConfigureAwait(false);
if (bytes[0] == null)
{
logger.LogDebug($"Bytes from assembly {step.Url} is NULL");
continue;
}
assembly = new AssemblyInfo(monoProxy, id, step.Url, bytes[0], bytes[1], logger, token);
}
catch (Exception e)
Expand Down
7 changes: 1 addition & 6 deletions src/mono/wasm/debugger/BrowserDebugProxy/MonoProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1509,12 +1509,7 @@ 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;

await foreach (SourceFile source in context.store.Load(sessionId, loaded_files, context, useDebuggerProtocol, token))
await foreach (SourceFile source in context.store.Load(sessionId, loaded_files, token).WithCancellation(token))
{
await OnSourceFileAdded(sessionId, source, context, token);
}
Expand Down
Loading