Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "deps/breakpad"]
path = deps/breakpad
url = https://github.com/electron/chromium-breakpad.git
url = https://chromium.googlesource.com/breakpad/breakpad
5 changes: 0 additions & 5 deletions .npmignore

This file was deleted.

9 changes: 0 additions & 9 deletions bin/minidump_stackwalk

This file was deleted.

17 changes: 0 additions & 17 deletions binding.gyp

This file was deleted.

23 changes: 23 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const fs = require('fs')
const path = require('path')
const {spawnSync} = require('child_process')

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: {
...process.env,
CPPFLAGS: `-I${path.relative(buildDir, path.join(__dirname, 'deps'))}`
},
stdio: 'inherit'
})
const targets = ['src/processor/minidump_stackwalk']
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'
})
21 changes: 0 additions & 21 deletions common.gypi

This file was deleted.

2 changes: 1 addition & 1 deletion deps/breakpad
Submodule breakpad updated from 64ee37 to b62101
38 changes: 13 additions & 25 deletions lib/minidump.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,21 @@ var fs = require('fs')
var path = require('path')
var spawn = require('child_process').spawn

var searchPaths = [
path.resolve(__dirname, '..', 'build', 'Release'),
path.resolve(__dirname, '..', 'build', 'Debug'),
path.resolve(__dirname, '..', 'bin')
]

function searchCommand (command) {
var binaryPath = null
if (process.platform === 'win32') {
command += '.exe'
binaryPath = path.join(__dirname, '..', 'deps', 'breakpad', command)
if (fs.existsSync(binaryPath)) {
return binaryPath
}
} else {
for (var i in searchPaths) {
binaryPath = path.join(searchPaths[i], command)
if (fs.existsSync(binaryPath)) {
return binaryPath
}
const exe = process.platform === 'win32' ? '.exe' : ''
const commands = {
minidump_stackwalk: path.resolve(__dirname, '..', 'build', 'src', 'processor', 'minidump_stackwalk') + exe,
dump_syms: (() => {
if (process.platform === 'darwin') {
return path.resolve(__dirname, '..', 'build', 'src', 'tools', 'mac', 'dump_syms', 'dump_syms_mac')
} else if (process.platform === 'linux') {
return path.resolve(__dirname, '..', 'build', 'src', 'tools', 'linux', 'dump_syms', 'dump_syms')
}
}
})()
}

function execute (command, args, callback) {
var stdout = new Buffer(0)
var stderr = new Buffer(0)
var stdout = Buffer.alloc(0)
var stderr = Buffer.alloc(0)
var child = spawn(command, args)
child.stdout.on('data', function (chunk) {
stdout = Buffer.concat([stdout, chunk])
Expand All @@ -54,7 +42,7 @@ module.exports.walkStack = function (minidump, symbolPaths, callback, commandArg
symbolPaths = []
}

var stackwalk = searchCommand('minidump_stackwalk')
var stackwalk = commands.minidump_stackwalk
if (!stackwalk) {
callback(new Error('Unable to find "minidump_stackwalk"'))
return
Expand All @@ -66,7 +54,7 @@ module.exports.walkStack = function (minidump, symbolPaths, callback, commandArg
}

module.exports.dumpSymbol = function (binary, callback) {
var dumpsyms = searchCommand('dump_syms')
var dumpsyms = commands.dump_syms
if (!dumpsyms) {
callback(new Error('Unable to find "dump_syms"'))
return
Expand Down
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,20 @@
"url": "https://github.com/electron/node-minidump/issues"
},
"scripts": {
"test": "mocha test && standard"
"test": "mocha test && standard",
"install": "node build.js"
},
"devDependencies": {
"electron-download": "^3.0.1",
"extract-zip": "^1.5.0",
"mocha": "^3.1.2",
"standard": "^8.4.0",
"temp": "^0.8.3"
}
},
"files": [
"LICENSE.md",
"README.md",
"/bin",
"/lib"
]
}
2 changes: 1 addition & 1 deletion test/minidump-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('minidump', function () {

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

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