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

Method loadSymbols

deps/v8/tools/tickprocessor.mjs:203–248  ·  view source on GitHub ↗
(libName)

Source from the content-addressed store, hash-verified

201 }
202
203 async loadSymbols(libName) {
204 this.parsePos = 0;
205 if (this.apkEmbeddedLibrary && libName.endsWith('.apk')) {
206 libName = this.apkEmbeddedLibrary;
207 }
208 if (this.targetRootFS) {
209 libName = libName.substring(libName.lastIndexOf('/') + 1);
210 libName = this.targetRootFS + libName;
211 }
212 try {
213 this.symbols = [
214 os.system(this.nmExec, ['-C', '-n', '-S', libName], -1, -1),
215 os.system(this.nmExec, ['-C', '-n', '-S', '-D', libName], -1, -1)
216 ];
217
218 try {
219 // Try to find separate debug symbols for the library in
220 // /usr/lib/debug/.build-id, getting the build-id from the binary
221 // notes using readelf.
222 const binaryNotes = os.system(this.readelfExec, ['-n', libName], -1, -1)
223 const buildId = /Build ID: ([a-zA-Z0-9]+)/.exec(binaryNotes)?.[1]?.toLowerCase() ?? null;
224
225 if (buildId) {
226 const debugLibName = `/usr/lib/debug/.build-id/${buildId.slice(0, 2)}/${buildId.slice(2)}.debug`;
227 this.symbols.push(
228 os.system(this.nmExec, ['-C', '-n', '-S', debugLibName], -1, -1),
229 os.system(this.nmExec, ['-C', '-n', '-S', '-D', debugLibName], -1, -1)
230 );
231 }
232 } catch {
233 // Ignore errors.
234 }
235
236 const objdumpOutput = os.system(this.objdumpExec, ['-h', libName], -1, -1);
237 for (const line of objdumpOutput.split('\n')) {
238 const [, sectionName, , vma, , fileOffset] = line.trim().split(/\s+/);
239 if (sectionName === ".text") {
240 this.fileOffsetMinusVma =
241 this.parseHexAddr(fileOffset) - this.parseHexAddr(vma);
242 }
243 }
244 } catch (e) {
245 // If the library cannot be found on this system let's not panic.
246 this.symbols = ['', ''];
247 }
248 }
249
250 parseNextLine() {
251 if (this.symbols.length == 0) return false;

Callers

nothing calls this directly

Calls 4

sliceMethod · 0.65
execMethod · 0.45
pushMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected