1
0
Fork 0

try to get stacktraces on mac

This commit is contained in:
Wilfried Goesgens 2017-03-16 14:56:55 +01:00
parent 215937a884
commit ae50e4ca1c
1 changed files with 37 additions and 0 deletions

View File

@ -464,6 +464,39 @@ function analyzeCoreDump (instanceInfo, options, storeArangodPath, pid) {
}
// //////////////////////////////////////////////////////////////////////////////
// / @brief analyzes a core dump using lldb (macos)
// /
// / We assume the system has core files in /cores/, and we have a lldb.
// //////////////////////////////////////////////////////////////////////////////
function analyzeCoreDumpMac (instanceInfo, options, storeArangodPath, pid) {
let lldbOutputFile = fs.getTempFile();
let command;
command = '(';
command += "printf 'bt \n\n";
// LLDB doesn't have an equivilant of `bt full` so we try to show the upper
// most 5 frames with all variables
for (i = 0; i < 5; i ++)
command += 'frame variable\\n up \\n';
command += " bt full\\n thread backtrace all\\n';";
command += 'sleep 10;';
command += 'echo quit;';
command += 'sleep 2';
command += ') | lldb ' + storeArangodPath;
command += ' -c /cores/core.' + pid;
command += " > " + lldbOutputFile + " 2>&1";
const args = ['-c', command];
print(JSON.stringify(args));
executeExternalAndWait('/bin/bash', args);
GDB_OUTPUT = fs.read(lldbOutputFile);
print(GDB_OUTPUT);
}
// //////////////////////////////////////////////////////////////////////////////
// / @brief analyzes a core dump using cdb (Windows)
// / cdb is part of the WinDBG package.
@ -545,6 +578,10 @@ function analyzeServerCrash (arangod, options, checkStr) {
// Windows: wait for procdump to do its job...
statusExternal(arangod.monitor, true);
analyzeCoreDumpWindows(arangod);
}
else if (platform === 'darwin') {
fs.copyFile(ARANGOD_BIN, storeArangodPath);
analyzeCoreDumpMac(arangod, options, storeArangodPath, arangod.pid);
} else {
fs.copyFile(ARANGOD_BIN, storeArangodPath);
analyzeCoreDump(arangod, options, storeArangodPath, arangod.pid);