Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support dump_syms on macOS #40

Merged
merged 13 commits into from
Dec 16, 2020
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
npm install minidump
```

## Building
## Building (for development)

* `git clone --recurse-submodules https://github.com/electron/node-minidump`
* `npm install`
Expand Down
17 changes: 16 additions & 1 deletion build.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
const fs = require('fs')
const path = require('path')
const { spawnSync } = require('child_process')
const childProcess = require('child_process')

function spawnSync (...args) {
const result = childProcess.spawnSync(...args)
if (result.status !== 0) {
process.exit(result.status)
}
}

const buildDir = path.join(__dirname, 'build')
if (!fs.existsSync(buildDir)) {
fs.mkdirSync(buildDir, { recursive: true })
}

spawnSync(path.join(__dirname, 'deps', 'breakpad', 'configure'), [], {
cwd: buildDir,
env: {
Expand All @@ -18,6 +26,13 @@ const targets = ['src/processor/minidump_stackwalk', 'src/processor/minidump_dum
if (process.platform === 'linux') {
targets.push('src/tools/linux/dump_syms/dump_syms')
}

spawnSync('make', ['-C', buildDir, '-j', require('os').cpus().length, ...targets], {
stdio: 'inherit'
})

if (process.platform === 'darwin') {
spawnSync('xcodebuild', ['-project', path.join(__dirname, 'deps', 'breakpad', 'src', 'tools', 'mac', 'dump_syms', 'dump_syms.xcodeproj'), 'build'], {
stdio: 'inherit'
})
}
2 changes: 1 addition & 1 deletion lib/minidump.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const commands = {
minidump_dump: path.resolve(__dirname, '..', 'build', 'src', 'processor', 'minidump_dump') + exe,
dump_syms: (() => {
if (process.platform === 'darwin') {
return path.resolve(__dirname, '..', 'build', 'src', 'tools', 'mac', 'dump_syms', 'dump_syms_mac')
return path.resolve(__dirname, '..', 'deps', 'breakpad', 'src', 'tools', 'mac', 'dump_syms', 'build', 'Release', 'dump_syms')
} else if (process.platform === 'linux') {
return path.resolve(__dirname, '..', 'build', 'src', 'tools', 'linux', 'dump_syms', 'dump_syms')
}
Expand Down
2 changes: 0 additions & 2 deletions test/minidump-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ describe('minidump', function () {

describe('dumpSymbol()', function () {
it('calls back with a minidump', function (done) {
if (process.platform !== 'linux') return this.skip()

downloadElectron(function (error, binaryPath) {
if (error) return done(error)
minidump.dumpSymbol(binaryPath, function (error, minidump) {
Expand Down