(query, result)
| 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 | |
| 123 | module.exports = Symbolizer |
no test coverage detected