2016-07-01 23:43:09 +02:00
|
|
|
#include "client/linux/handler/exception_handler.h"
|
|
|
|
#include "common/linux/linux_libc_support.h"
|
|
|
|
#include "third_party/lss/linux_syscall_support.h"
|
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2016-07-02 05:53:55 +02:00
|
|
|
static bool dumpCallback(const google_breakpad::MinidumpDescriptor &descriptor, void *context, bool succeeded)
|
2016-07-01 23:43:09 +02:00
|
|
|
{
|
|
|
|
if (succeeded) {
|
|
|
|
sys_write(STDOUT_FILENO, "Wrote minidump to: ", 19);
|
|
|
|
} else {
|
|
|
|
sys_write(STDOUT_FILENO, "Failed to write minidump to: ", 29);
|
|
|
|
}
|
|
|
|
|
|
|
|
sys_write(STDOUT_FILENO, descriptor.path(), my_strlen(descriptor.path()));
|
|
|
|
sys_write(STDOUT_FILENO, "\n", 1);
|
|
|
|
|
|
|
|
return succeeded;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2016-07-02 05:53:55 +02:00
|
|
|
google_breakpad::MinidumpDescriptor descriptor(".");
|
|
|
|
google_breakpad::ExceptionHandler *handler = new google_breakpad::ExceptionHandler(descriptor, NULL, dumpCallback, NULL, true, -1);
|
2016-07-01 23:43:09 +02:00
|
|
|
|
|
|
|
// Test shit here.
|
2016-07-02 05:53:55 +02:00
|
|
|
__builtin_trap();
|
2016-07-01 23:43:09 +02:00
|
|
|
|
|
|
|
delete handler;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|