文档章节

google breakpad tutorial

莫忆往西
 莫忆往西
发布于 2016/08/02 00:35
字数 1176
阅读 146
收藏 0

###google breakpad tutorial

offical site

offical site on github

####Work on linux

  1. git clone git@github.com:google/breakpad.git
  2. Go to root directory and ./configure && make
  3. The offical repo doesn't has the file linux_syscall_support.h, there is a compile error. If we want to make the compile all pass, we should using google's VCS tool gclient sync to get the file from somewhere else. However we can't access google's server in China right now, so I fork a new repo and add this file to the proper path. The repo is git@github.com:aquar25/breakpad.git. Because mozilla is also using breakpad, we can checkout the source code from its website
  4. Using breakpad in application
#include "client/linux/handler/exception_handler.h"

static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor,
            void* context, bool succeeded) 
{
  printf("Dump path: %s\n", descriptor.path());
  return succeeded;
}

void crash() 
{ 
    volatile int* a = (int*)(NULL); 
    *a = 1; 
}

int main(int argc, char* argv[]) {
  google_breakpad::MinidumpDescriptor descriptor("/home/edison/tmp");
  google_breakpad::ExceptionHandler eh(descriptor, NULL, dumpCallback, NULL, true, -1);
  printf("Begin work:\n");
crash();
  printf("end work\n");
  return 0;
}
  1. Compile the application g++ -std=gnu++0x -g Test.cpp -I. -L./client/linux/ -lbreakpad_client -lpthread -o test
  2. Generate symbol file using tools/linux/dump_syms/dump_syms ./test > test.sym
  3. execute the application will generate the *.dmp file in /home/edison/tmp
  4. make the directory for minidump_stackwalk
    • the directory name is in the first line of *.sym file, using head -n1 test.sym to see it MODULE Linux x86_64 134EB61AC9327CA7389BD74B6E35EC000 test
    • construct the directory for stackwalk as follow:
      • mkdir -p ./symbols/test/134EB61AC9327CA7389BD74B6E35EC000
      • mv test.sym ./symbols/test/134EB61AC9327CA7389BD74B6E35EC000
  5. using minidump_stackwalk breakpad/src$ processor/minidump_stackwalk 0b5b40af-53dd-9b07-41b2f6d2-7b5a27c4.dmp ./symbols will output some infomation like:
    2016-08-01 23:51:19: minidump.cc:4286: INFO: Minidump opened minidump 0b5b40af-53dd-9b07-41b2f6d2-7b5a27c4.dmp
    2016-08-01 23:51:19: minidump.cc:4406: INFO: Minidump not byte-swapping minidump
    2016-08-01 23:51:19: minidump.cc:4883: INFO: GetStream: type 15 not present
    2016-08-01 23:51:19: minidump.cc:4883: INFO: GetStream: type 1197932545 not present
    2016-08-01 23:51:19: minidump.cc:4883: INFO: GetStream: type 1197932546 not present
    2016-08-01 23:51:19: minidump.cc:2105: INFO: MinidumpModule could not determine version for /media/edison/data/code/google/breakpad/src/test
    2016-08-01 23:51:19: minidump.cc:2105: INFO: MinidumpModule could not determine version for /lib/x86_64-linux-gnu/libm-2.23.so
    2016-08-01 23:51:19: minidump.cc:2105: INFO: MinidumpModule could not determine version for /lib/x86_64-linux-gnu/libc-2.23.so
    2016-08-01 23:51:19: minidump.cc:2105: INFO: MinidumpModule could not determine version for /lib/x86_64-linux-gnu/libgcc_s.so.1
    2016-08-01 23:51:19: minidump.cc:2105: INFO: MinidumpModule could not determine version for /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
    2016-08-01 23:51:19: minidump.cc:2105: INFO: MinidumpModule could not determine version for /lib/x86_64-linux-gnu/libpthread-2.23.so
    2016-08-01 23:51:19: minidump.cc:2105: INFO: MinidumpModule could not determine version for /lib/x86_64-linux-gnu/ld-2.23.so
    2016-08-01 23:51:19: minidump.cc:2105: INFO: MinidumpModule could not determine version for linux-gate.so
    2016-08-01 23:51:19: minidump.cc:2105: INFO: MinidumpModule could not determine version for /media/edison/data/code/google/breakpad/src/test
    2016-08-01 23:51:19: minidump.cc:2105: INFO: MinidumpModule could not determine version for /lib/x86_64-linux-gnu/libm-2.23.so
    2016-08-01 23:51:19: minidump.cc:2105: INFO: MinidumpModule could not determine version for /lib/x86_64-linux-gnu/libc-2.23.so
    2016-08-01 23:51:19: minidump.cc:2105: INFO: MinidumpModule could not determine version for /lib/x86_64-linux-gnu/libgcc_s.so.1
    2016-08-01 23:51:19: minidump.cc:2105: INFO: MinidumpModule could not determine version for /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
    2016-08-01 23:51:19: minidump.cc:2105: INFO: MinidumpModule could not determine version for /lib/x86_64-linux-gnu/libpthread-2.23.so
    2016-08-01 23:51:19: minidump.cc:2105: INFO: MinidumpModule could not determine version for /lib/x86_64-linux-gnu/ld-2.23.so
    2016-08-01 23:51:19: minidump.cc:2105: INFO: MinidumpModule could not determine version for linux-gate.so
    2016-08-01 23:51:19: minidump_processor.cc:146: INFO: Found 2 memory regions.
    2016-08-01 23:51:19: minidump_processor.cc:156: INFO: Minidump 0b5b40af-53dd-9b07-41b2f6d2-7b5a27c4.dmp has CPU info, OS info, no Breakpad info, exception, module list, thread list, no dump thread, requesting thread, and no process create time
    2016-08-01 23:51:19: minidump_processor.cc:195: INFO: Looking at thread 0b5b40af-53dd-9b07-41b2f6d2-7b5a27c4.dmp:0/1 id 0x354b
    2016-08-01 23:51:19: minidump.cc:437: INFO: MinidumpContext: looks like AMD64 context
    2016-08-01 23:51:19: minidump.cc:437: INFO: MinidumpContext: looks like AMD64 context
    2016-08-01 23:51:19: source_line_resolver_base.cc:236: INFO: Loading symbols for module /media/edison/data/code/google/breakpad/src/test from memory buffer
    2016-08-01 23:51:19: simple_symbol_supplier.cc:196: INFO: No symbol file at ./symbols/libc-2.23.so/E1E09D3633D8A6CA93AF17F17C83BA930/libc-2.23.so.sym
    2016-08-01 23:51:19: stackwalker.cc:97: INFO: Couldn't load symbols for: /lib/x86_64-linux-gnu/libc-2.23.so|E1E09D3633D8A6CA93AF17F17C83BA930
    2016-08-01 23:51:19: minidump.cc:1291: INFO: MinidumpMemoryRegion request out of range: 0x411ee8+8/0x7ffc9d0a4000+0x3000
    2016-08-01 23:51:19: basic_code_modules.cc:110: INFO: No module at 0x0
    2016-08-01 23:51:19: basic_code_modules.cc:110: INFO: No module at 0x7ffc9d0a49b8
    2016-08-01 23:51:19: basic_code_modules.cc:110: INFO: No module at 0x100000000
    2016-08-01 23:51:19: minidump_processor.cc:319: INFO: Processed 0b5b40af-53dd-9b07-41b2f6d2-7b5a27c4.dmp
    Operating system: Linux
                      0.0.0 Linux 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64
    CPU: amd64
         family 6 model 42 stepping 7
         4 CPUs
    
    GPU: UNKNOWN
    
    Crash reason:  SIGSEGV
    Crash address: 0x0
    Process uptime: not available
    
    Thread 0 (crashed)
     0  test!crash [Test.cpp : 13 + 0x4]
        rax = 0x0000000000000000   rdx = 0x00007f1497d30780
        rcx = 0x00007f1497a61a10   rbx = 0x0000000000000000
        rsi = 0x0000000000796d10   rdi = 0x0000000000000001
        rbp = 0x00007ffc9d0a4730   rsp = 0x00007ffc9d0a4730
         r8 = 0x00007f14986e8740    r9 = 0x0000000000000000
        r10 = 0x0000000000000194   r11 = 0x0000000000000246
        r12 = 0x0000000000401ec0   r13 = 0x00007ffc9d0a49b0
        r14 = 0x0000000000000000   r15 = 0x0000000000000000
        rip = 0x0000000000401fff
        Found by: given as instruction pointer in context
     1  test!main [Test.cpp : 20 + 0x5]
        rbx = 0x0000000000000000   rbp = 0x00007ffc9d0a48d0
        rsp = 0x00007ffc9d0a4740   r12 = 0x0000000000401ec0
        r13 = 0x00007ffc9d0a49b0   r14 = 0x0000000000000000
        r15 = 0x0000000000000000   rip = 0x00000000004020d6
        Found by: call frame info
     2  libc-2.23.so + 0x20830
        rbx = 0x0000000000000000   rbp = 0x0000000000411ee0
        rsp = 0x00007ffc9d0a48e0   r12 = 0x0000000000401ec0
        r13 = 0x00007ffc9d0a49b0   r14 = 0x0000000000000000
        r15 = 0x0000000000000000   rip = 0x00007f149798b830
        Found by: call frame info
     3  test!crash [Test.cpp : 14 + 0x3]
        rsp = 0x00007ffc9d0a4900   rip = 0x0000000000402008
        Found by: stack scanning
    
    Loaded modules:
    0x00400000 - 0x00416fff  test  ???  (main)
    0x7f1497662000 - 0x7f1497769fff  libm-2.23.so  ???
    0x7f149796b000 - 0x7f1497b2afff  libc-2.23.so  ???  (WARNING: No symbols, libc-2.23.so, E1E09D3633D8A6CA93AF17F17C83BA930)
    0x7f1497d34000 - 0x7f1497d49fff  libgcc_s.so.1  ???
    0x7f1497f4a000 - 0x7f14980bbfff  libstdc++.so.6.0.21  ???
    0x7f14982cc000 - 0x7f14982e3fff  libpthread-2.23.so  ???
    0x7f14984e9000 - 0x7f149850efff  ld-2.23.so  ???
    0x7ffc9d13c000 - 0x7ffc9d13dfff  linux-gate.so  ???
    2016-08-01 23:51:19: minidump.cc:4258: INFO: Minidump closing minidump
    
    

Pay attention to 0 test!crash [Test.cpp : 13 + 0x4] which means application crashed at line 13 of file Test.cpp.

© 著作权归作者所有

莫忆往西
粉丝 2
博文 14
码字总数 17277
作品 0
西安
私信 提问
Androdi native Crash log & linux crash handler

传送: http://www.cnblogs.com/shakin/p/4268399.html http://blog.chinaunix.net/uid-1877180-id-3011232.html 其他关键字:Google Breakpad Docs: https://chromium.googlesource.com/bre......

Carlyle_Lee
2016/09/05
33
0
Android使用google breakpad捕获分析native cash

Android 开发高手课 课后练习(1) 一、Chapter01 崩溃 https://time.geekbang.org/column/article/70602 https://github.com/AndroidAdvanceWithGeektime/Chapter01 1、遇到native cash时,......

传说之美
03/28
0
0
Android开发高手课之崩溃优化

《Android开发高手课》是极客时间上为数不多的质量高的课程,通过学习确实让我开拓了眼界,之前对于Android的优化可能仅仅停留在基础的阶段,通过对这个课程的学习,确实了解了更多的监测手段...

小菜鸟程序媛
02/21
0
0
gyp安装,及breakpad上的使用方法

都是在gyp目录下 1.setup.py intall ---->console 2.gyp.bat --no-circular-check "../../client/windows/breakpad_client.gyp" -----...

小熊猫大暴走
2016/11/03
29
0
(ubuntu 16.04)Linux中启动Steam报错libGL error的解决办法

Linux中启动Steam报错libGL error的解决办法 安装好Steam之后,点击启动器一直没有反应,所以去终端用命令steam启动Steam查看日志,发现终端输出如下内容,然后一直卡着,使用Ctrl C结束进程...

RickyHuL
2018/01/07
0
0

没有更多内容

加载失败,请刷新页面

加载更多

cleanLastUpdated.bat

@echo offrem create by AnXiaole rem 这里写你的仓库路径set REPOSITORY_PATH=C:\Users\AnXiaole\.m2\repositoryrem 正在搜索...for /f "delims=" %%i in ('dir /b /s "%REPO......

安小乐
2分钟前
0
0
操作放大器的用法是什么?

  有区别   1、单级放大的倍数比较有限,一般在100倍以下。放大倍数很大的话,负反馈就比较浅,对于放大倍数的稳定性不利。假如需要放大倍数更高,就不得不动用多级放大电路了。单级放大...

仙溪
5分钟前
0
0
c++ 上传文件 curl

bool uploadFile(std::string url, std::string file, std::string auth) { boost::filesystem::path p(file); CURL *curl; CURLcode res; struct curl_httppost *for......

青黑
11分钟前
2
0
冒泡与插入排序的代码实现

// 冒泡排序,a 表示数组,n 表示数组大小public void bubbleSort(int[] a, int n) { if (n <= 1) return; for (int i = 0; i < n; ++i) { // 提前退出冒泡循环的标志位 ...

无名氏的程序员
14分钟前
3
0
centos7.6 +mhvtl1.6安装

以前的mhvtl都是在centos6.x,5.x上安装的mhvtl以前版本为1.4,现在最新的1.6出来,可以安装在centos7.6上,下面是安装过程: 1.安装基础包 centos7.6只要能上外网,默认是配置了yun源的,这些...

突突突酱
15分钟前
2
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部