breakpad在linux下编译

来源:互联网 发布:阮一峰javascript 算法 编辑:程序博客网 时间:2024/05/20 07:33

我的mentor要求我去build谷歌的crash分析工具breakpad,弄了一天终于解决了,在这里记录一下。注意!国内的方法大多都是错误的!

1、首先先读breakpad的官方指南https://chromium.googlesource.com/breakpad/breakpad/+/master/docs/

2、通过https://chromium.googlesource.com/breakpad/breakpad的To request change review方法进行编译!!!这个Getting started in 32-bit mode (from trunk)提供的方法编译出来总是出错。


3、ps:

(1)为什么能找到这个方法?在breakpad的官方论坛上有一个人简单提了一下,我做了一下尝试,居然真的成功了。

(2)注意:gclient sync之后要等很久,一定要耐心等待。这个很容易就ctrl+c中止掉了或者进行git clone操作了。



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

下面是我完成breakpad集成之后,写的一个wiki:如果你要集成breakpad,就一定用得上。


How to integrate Google Breakpad for Android

1.Build to get the libbreakpad_client.a(please refer https://chromium.googlesource.com/breakpad/breakpad)

Steps:

1). Before build, Strongly recommend you to build on the prt server, cuz the environment of the specific server is perfectly right.

2). Get a copy of depot_tools repo.  (please refer https://www.chromium.org/developers/how-tos/install-depot-tools)

3). Create a new directory for checking out the source code. mkdir breakpad && cd breakpad

4). Run the fetch tool from depot_tools to download all the source repos. fetch breakpad. As the process takes long, you need to wait for about 20s and then you will get the source code.

5). Configure and build(please refer the README.ANDROID located in $GOOGLE_BREAKPAD_PATH/src/README.ANDROID)

    (a) ./configure --host=arm-linux-androideabi --disable-processor --disable-tools

    (b) make -j4

    (c) if make failed with "nullptr not declared \ error: expected nested-name-specifier" means you will need to use C++ 11 to build.   set CPPFLAGS = -std=c++11 within Makefile (the MAkefile locate in                          $GOOGLE_BREAKPAD_PATH/src/Makefile)  

6). Check if the process of building is right: there should be the libbreakpad_client.a in the google-breakpad-read-only/src/client/linux. 

7). Copy the sources to your local computer and cover the relative code loacted in the $JABBER-ANDROID/Jabber9.6/jni/native_crash_handler/breakpad_client(Note that you just need to copy the *.h code and cover)


2.Build to get the minidump_stackwalk and the dump_syms (please refer https://chromium.googlesource.com/breakpad/breakpad)

Steps:

1). Before build, Strongly recommend you to build on the prt server, cuz the environment of the specific server is perfectly right.

2). Get a copy of depot_tools repo.  (please refer https://www.chromium.org/developers/how-tos/install-depot-tools)

3). Create a new directory for checking out the source code. mkdir breakpad && cd breakpad

4). Run the fetch tool from depot_tools to download all the source repos. fetch breakpad. As the process takes long, you need to wait for about 20s and then you will get the source code.

5). Configure and build(please refer the README.md located in $GOOGLE_BREAKPAD_PATH/src/README.md)

    (a) .CXXFLAGS=-64 CFLAGS=-m64 CPPFLAGS=-m64 ./configure

    (b) make -j4

    (c) if make failed with "nullptr not declared \ error: expected nested-name-specifier" means you will need to use C++ 11 to build.   set CPPFLAGS = -std=c++11 within Makefile (the MAkefile locate in                          $GOOGLE_BREAKPAD_PATH/src/Makefile)  

6). Check if the process of building is right: there should be the dump_syms in the google-breakpad-read-only/src/tools/linux/dump_syms and the minidump_stackwalk in the google-breakpad-read-only/src/processor



3.Create a native crash to get a dmp file and analyze the dmp file.

Steps:

1). Add the following code in $JABBER-ANDROID/Jabber9.6/obj/local/armeabi/librender.so

    int a = 0; int b = 1 / a;

2). Go to the $JABBER-ANDROID/Jabber9.6/ and run the following 2 commands:

            ndk-build.cmd USE_FETCH=1 clean

           ndk-build.cmd USE_FETCH=1 NDK_DEBUG=1

3). Clean the jabber project and rebuild the jabber project(Note that the step is so critical)

4). Run the source and make a call to someone else. At this time, you should meet a crash. Next, send the prt report to your own email and unzip the accessory(there should be a *.dmp int the folder)

5). Copy the *.dmp and the $JABBER-ANDROID/Jabber9.6/jni/ librender.so to the prt server 

6) .Symbol your .so file

          $GOOGLE_BREAKPAD_PATH/src/tools/linux/dump_syms/dump_syms  libfoo.so > libfoo.so.sym

7) .Get version number of symbols using the command "head -n1 libfoo.so.sym"

8) .Save the symbol file to some place which is based on version number, like:
          $SOME_PLACE/symbols/libfoo.so/D51B4A5504974FA6ECC1869CAEE3603B0(this step is so critical that you should make the folders named after the request format)

6). Symbol your crash dump file

          $GOOGLE_BREAKPAD_PATH/src/processor/minidump_stackwalk crash.dmp $SOME_PLACE/symbols 

then,you will get the readable dump file.

 


0 0
原创粉丝点击