1

我正在尝试在我的应用程序中使用 google breakpad。但是这样做时我遇到了buserror。

示例应用:

#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;
}

我从下面的行收到错误:

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

输出 :

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

我做错什么了吗?

4

2 回答 2

0

请试试这个

google_breakpad::MinidumpDescriptor(std::string("/opt/minidumps/"))

如果它仍然不起作用,请尝试使您的代码(完全)尽可能地匹配现有的工作示例:http: //fossies.org/linux/seafile-client/src/crash-handler.cpp

于 2016-06-02T09:48:09.290 回答
0

我使用的静态库(libbreakpad_client.a)是不兼容的。这就是为什么它显示总线错误。我已经用另一个替换了它,它按预期工作。

于 2016-06-03T04:17:22.407 回答