Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkit Jain <radical@gmail.com>2022-06-02 04:59:28 +0300
committerGitHub <noreply@github.com>2022-06-02 04:59:28 +0300
commit104013a3be687555af311b60b66491efd2c16f05 (patch)
treeab653a4d235093cf1dc07c625e35ff0dbbe4e8ab /src/mono/wasm/runtime
parent0f9eb653ef00042c1b8fa1f54e0b388f518c1d59 (diff)
[wasm] Add support for symbolicating traces via XHarness (#66226)
* [wasm] Add `WasmSymbolicator` project - this can be used to symbolicate traces using patterns from `src/mono/wasm/data/wasm-symbol-patterns.txt`. - Includes a wrapper that can be passed to xharness for symbolicating traces in the output. - This can be used as a command line tool also: `dotnet run /path/to/dotnet.js.symbols /path/to/traces` If `-` is passed instead of the last argument, then it reads the messages from stdin. * [wasm] Enable xharness+symbolicator for library tests * [wasm ] startup.ts: improve printing errors * [wasm] test-main.js: print 'WASM EXIT' message even for non-browser cases * [wasm] Enable symbols file generation for samples in Release config * [wasm] Fix file check * Fix build * fix dotnet-linker-tests build * Update condition for using wasmsymbolicator with xharness * Update build-commons.sh Revert unnecessary change * Update gen-buildsys.sh Revert unnecessary change * Update build.sh Revert unnecessary change
Diffstat (limited to 'src/mono/wasm/runtime')
-rw-r--r--src/mono/wasm/runtime/startup.ts25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/mono/wasm/runtime/startup.ts b/src/mono/wasm/runtime/startup.ts
index 3378084a921..2920dd8de7b 100644
--- a/src/mono/wasm/runtime/startup.ts
+++ b/src/mono/wasm/runtime/startup.ts
@@ -137,9 +137,7 @@ async function mono_wasm_pre_init(): Promise<void> {
await moduleExt.onConfigLoaded(<MonoConfig>runtimeHelpers.config);
}
catch (err: any) {
- Module.printErr("MONO_WASM: onConfigLoaded () failed: " + err);
- Module.printErr("MONO_WASM: Stacktrace: \n");
- Module.printErr(err.stack);
+ _print_error("MONO_WASM: onConfigLoaded () failed", err);
runtime_is_initialized_reject(err);
throw err;
}
@@ -169,6 +167,13 @@ function mono_wasm_after_runtime_initialized(): void {
finalize_startup(Module.config);
}
+function _print_error(message: string, err: any): void {
+ Module.printErr(`${message}: ${JSON.stringify(err)}`);
+ if (err.stack) {
+ Module.printErr("MONO_WASM: Stacktrace: \n");
+ Module.printErr(err.stack);
+ }
+}
// Set environment variable NAME to VALUE
// Should be called before mono_load_runtime_and_bcl () in most cases
@@ -331,9 +336,7 @@ function finalize_startup(config: MonoConfig | MonoConfigError | undefined): voi
cwraps.mono_wasm_load_runtime("unused", config.debug_level || 0);
runtimeHelpers.wait_for_debugger = config.wait_for_debugger;
} catch (err: any) {
- Module.printErr("MONO_WASM: mono_wasm_load_runtime () failed: " + err);
- Module.printErr("MONO_WASM: Stacktrace: \n");
- Module.printErr(err.stack);
+ _print_error("MONO_WASM: mono_wasm_load_runtime () failed", err);
runtime_is_initialized_reject(err);
if (ENVIRONMENT_IS_SHELL || ENVIRONMENT_IS_NODE) {
@@ -360,9 +363,7 @@ function finalize_startup(config: MonoConfig | MonoConfigError | undefined): voi
argsAny.loaded_cb();
}
catch (err: any) {
- Module.printErr("MONO_WASM: loaded_cb () failed: " + err);
- Module.printErr("MONO_WASM: Stacktrace: \n");
- Module.printErr(err.stack);
+ _print_error("MONO_WASM: loaded_cb () failed", err);
runtime_is_initialized_reject(err);
throw err;
}
@@ -373,9 +374,7 @@ function finalize_startup(config: MonoConfig | MonoConfigError | undefined): voi
moduleExt.onDotnetReady();
}
catch (err: any) {
- Module.printErr("MONO_WASM: onDotnetReady () failed: " + err);
- Module.printErr("MONO_WASM: Stacktrace: \n");
- Module.printErr(err.stack);
+ _print_error("MONO_WASM: onDotnetReady () failed", err);
runtime_is_initialized_reject(err);
throw err;
}
@@ -383,7 +382,7 @@ function finalize_startup(config: MonoConfig | MonoConfigError | undefined): voi
runtime_is_initialized_resolve();
} catch (err: any) {
- Module.printErr("MONO_WASM: Error in finalize_startup: " + err);
+ _print_error("MONO_WASM: Error in finalize_startup", err);
runtime_is_initialized_reject(err);
throw err;
}