MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / getModuleInfo

Function getModuleInfo

packages/wasm/src/registry.ts:16–38  ·  view source on GitHub ↗
(module: WebAssembly.Module)

Source from the content-addressed store, hash-verified

14 * @param module
15 */
16export function getModuleInfo(module: WebAssembly.Module): ModuleInfo {
17 const buildIds = WebAssembly.Module.customSections(module, 'build_id');
18 let buildId = null;
19 let debugFile = null;
20
21 const buildId0 = buildIds[0];
22 if (buildId0) {
23 const firstBuildId = new Uint8Array(buildId0);
24 buildId = Array.from(firstBuildId).reduce((acc, x) => {
25 return acc + x.toString(16).padStart(2, '0');
26 }, '');
27 }
28
29 const externalDebugInfo = WebAssembly.Module.customSections(module, 'external_debug_info');
30 const externalDebugInfo0 = externalDebugInfo[0];
31 if (externalDebugInfo0) {
32 const firstExternalDebugInfo = new Uint8Array(externalDebugInfo0);
33 const decoder = new TextDecoder('utf-8');
34 debugFile = decoder.decode(firstExternalDebugInfo);
35 }
36
37 return { buildId, debugFile };
38}
39
40/**
41 * Records a module and returns the created debug image.

Callers 1

registerModuleFunction · 0.85

Calls 3

decodeMethod · 0.95
toStringMethod · 0.65
fromMethod · 0.45

Tested by

no test coverage detected