[英]Bus error while registering exception handler using google breakpad
我正在嘗試使用google breakpad和我的應用程序。 但是這樣做我得到了很多錯誤。
樣品申請:
#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)
我做錯了嗎?
請試試這個
google_breakpad::MinidumpDescriptor(std::string("/opt/minidumps/"))
如果它仍然無效,請嘗試盡可能使您的代碼(完全)與現有的工作示例匹配: http : //fossies.org/linux/seafile-client/src/crash-handler.cpp
我使用的靜態庫(libbreakpad_client.a)是一個不兼容的庫。 這就是它顯示總線錯誤的原因。 我用另一個替換它,它按預期工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.