MCPcopy Create free account
hub / github.com/nodejs/node / loadVMSymbolsLinux

Method loadVMSymbolsLinux

deps/v8/tools/system-analyzer/lws-middleware.js:91–120  ·  view source on GitHub ↗
(query, result)

Source from the content-addressed store, hash-verified

89 }
90
91 async loadVMSymbolsLinux(query, result) {
92 let libName = query.libName;
93 if (query.apkEmbeddedLibrary && libName.endsWith('.apk')) {
94 libName = query.apkEmbeddedLibrary;
95 }
96 if (query.targetRootFS) {
97 libName = libName.substring(libName.lastIndexOf('/') + 1);
98 libName = query.targetRootFS + libName;
99 }
100 try {
101 // Fast skip files that don't exist.
102 if (libName.indexOf('/') === -1 || !fs.existsSync(libName)) return;
103 result.symbols = [
104 await sh(this.nmExec, '-C', '-n', '-S', libName),
105 await sh(this.nmExec, '-C', '-n', '-S', '-D', libName)
106 ];
107
108 const objdumpOutput = await sh(this.objdumpExec, '-h', libName);
109 for (const line of objdumpOutput.split('\n')) {
110 const [, sectionName, , vma, , fileOffset] = line.trim().split(/\s+/);
111 if (sectionName === '.text') {
112 result.fileOffsetMinusVma =
113 parseInt(fileOffset, 16) - parseInt(vma, 16);
114 }
115 }
116 } catch (e) {
117 console.log(e);
118 result.error = e.message;
119 }
120 }
121}
122
123module.exports = Symbolizer

Callers 1

parseVMSymbolsMethod · 0.95

Calls 5

shFunction · 0.70
indexOfMethod · 0.45
existsSyncMethod · 0.45
splitMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected