Prefer to use .note.gnu.build-id section as ElfBuildId

Summary:
Android prefers `.note.gnu-build-id`[0] as BuildId than anyother PT_NOTE
phdrs. This CL tries to read ElfBuildId from `.note.gnu.build-id` first
to fix the BuildId mismatch issue between Android tombstone report and
breakpad symbol file.

e.g
```
Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       0000000000000000  0000000000000000           0     0     0
  [ 1] .note.androi[...] NOTE             0000000000000270  00000270
       0000000000000018  0000000000000000   A       0     0     4
  [ 2] .note.hwasan[...] NOTE             0000000000000288  00000288
       000000000000001c  0000000000000000   A       0     0     4
  [ 3] .note.gnu.bu[...] NOTE             00000000000002a4  000002a4
       0000000000000020  0000000000000000   A       0     0     4

$ readelf -x .note.hwasan.globals
Hex dump of section '.note.hwasan.globals':
  0x00000288 08000000 08000000 03000000 4c4c564d ............LLVM
  0x00000298 00000000 98890100 409d0100          ........@...

$ readelf -x .note.gnu.build-id
Hex dump of section '.note.gnu.build-id':
  0x000002a4 04000000 10000000 03000000 474e5500 ............GNU.
  0x000002b4 a4eb3625 c1db6452 1e881973 bfdff9bd ..6%..dR...s....
```

The BuildId in tombstone:
```
libartbase.so (BuildId: c7e463b51b0898d442269a421353bdbd)
```

But the breakpad dump_syms got:
```
MODULE Linux arm64 000189989D40000100000000000000000 libartbase.so
INFO CODE_ID 98890100409D0100
`````

[0]
https://cs.android.com/android/platform/superproject/main/+/main:system/unwinding/libunwindstack/ElfInterface.cpp;l=423-427;drc=3d19fbcc09b1b44928639b06cd0b88f735cd988d

Change-Id: I01e3514e0e2a1ea163c03093055284448ed4e89c
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/5463566
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
2 files changed
tree: 671324d486fa0de9d36e29ba30ea4f16100659aa
  1. .github/
  2. android/
  3. autotools/
  4. docs/
  5. m4/
  6. src/
  7. .clang-format
  8. .gitattributes
  9. .gitignore
  10. aclocal.m4
  11. appveyor.yml
  12. AUTHORS
  13. breakpad-client.pc.in
  14. breakpad.pc.in
  15. ChangeLog
  16. codereview.settings
  17. configure
  18. configure.ac
  19. default.xml
  20. DEPS
  21. DIR_METADATA
  22. INSTALL
  23. LICENSE
  24. Makefile.am
  25. Makefile.in
  26. NEWS
  27. OWNERS
  28. README.ANDROID
  29. README.md
README.md

Breakpad

Breakpad is a set of client and server components which implement a crash-reporting system.

Getting started (from main)

  1. First, download depot_tools and ensure that they’re in your PATH.

  2. Create a new directory for checking out the source code (it must be named breakpad).

    mkdir breakpad && cd breakpad
    
  3. Run the fetch tool from depot_tools to download all the source repos.

    fetch breakpad
    cd src
    
  4. Build the source.

    ./configure && make
    

    You can also cd to another directory and run configure from there to build outside the source tree.

    This will build the processor tools (src/processor/minidump_stackwalk, src/processor/minidump_dump, etc), and when building on Linux it will also build the client libraries and some tools (src/tools/linux/dump_syms/dump_syms, src/tools/linux/md2core/minidump-2-core, etc).

  5. Optionally, run tests.

    make check
    
  6. Optionally, install the built libraries

    make install
    

If you need to reconfigure your build be sure to run make distclean first.

To update an existing checkout to a newer revision, you can git pull as usual, but then you should run gclient sync to ensure that the dependent repos are up-to-date.

To request change review

  1. Follow the steps above to get the source and build it.

  2. Make changes. Build and test your changes. For core code like processor use methods above. For linux/mac/windows, there are test targets in each project file.

  3. Commit your changes to your local repo and upload them to the server. http://dev.chromium.org/developers/contributing-code e.g. git commit ... && git cl upload ... You will be prompted for credential and a description.

  4. At https://chromium-review.googlesource.com/ you'll find your issue listed; click on it, then “Add reviewer”, and enter in the code reviewer. Depending on your settings, you may not see an email, but the reviewer has been notified with google-breakpad-dev@googlegroups.com always CC’d.