c++linuxgoogle-breakpad

Bus error while registering exception handler using google breakpad


I am trying to use google breakpad with my application. But I am getting buserror while doing so.

Sample application:

#include<iostream>
using namespace std;

#include "client/linux/handler/exception_handler.h"
static bool breakpadDumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* context, bool succeeded)
{
    return succeeded;
}


int main()
{
    cout << "Hello World! \n";

    //Adding changes for google breakpad
    static google_breakpad::ExceptionHandler* excHandler = NULL;
    cout << "Here-----------! \n";

    // delete excHandler;

    excHandler = new google_breakpad::ExceptionHandler(google_breakpad::MinidumpDescriptor("/opt/minidumps/"), NULL, breakpadDumpCallback, NULL, true, -1);

    cout << "Registered Google Breakpad exceptionHandler\n";

    int *x = NULL;
    *x = 10;

    return 0;
}

I am getting error from below line:

excHandler = new google_breakpad::ExceptionHandler(google_breakpad::MinidumpDescriptor("/opt/minidumps/"), NULL, breakpadDumpCallback, NULL, true, -1);

Output :

Hello World!
Here-----------!
Bus error (core dumped)

Am I doing anything wrong?


Solution

  • Static library (libbreakpad_client.a) which i was using was an incompatible one. That is why it shows bus error. I have replaced it with another one and it is working as expected.