platform_system_core/libunwindstack/include/unwindstack
Christopher Ferris 0f40a05309 Properly handle empty map after read-only map.
Recently, the maps for an elf in memory might show up looking like:

  f0000-f1000 0 r-- /system/lib/libc.so
  f1000-f2000 0 ---
  f2000-f3000 1000 r-x /system/lib/libc.so
  f3000-f4000 2000 rw- /system/lib/libc.so

The problem is that there is logic in the code that assumed that the
map before the execute map must be the read-only map. In the case
above, this is not true. Add a new prev_real_map that will point
to the previous map that is not one of these empty maps.

This will fix the backtraces that look like this:

  #00  pc 0000000000050d58  /apex/com.android.runtime/lib64/bionic/libc.so!libc.so (offset 0x50000) (syscall+24) (BuildId: 5252408bf30e395d49ee270b54c77ca4)

To get rid of the !libc.so and the offset value, which is not correct.

Added new unit tests to verify this.
Added new offline test which an empty map between read-only and execute
map. Before this change, the backtraces had lines like
libc.so!libc.so (offset XXX) would be present.

Bug: 148075852

Test: Ran unit tests.
Change-Id: Ie04bfc96b8f91ed885cb1e655cf1e346efe48a45
2020-01-22 18:30:12 -08:00
..
DexFiles.h Revert "Check for data races when reading JIT/DEX entries." 2019-04-05 18:23:32 +00:00
DwarfError.h Add error propagation into Unwinder/Elf objects. 2018-01-24 17:50:46 -08:00
DwarfLocation.h Cache DWARF location rules for a given pc. 2018-03-29 14:47:13 +00:00
DwarfMemory.h Handle when bias is different in elf headers. 2019-10-08 17:36:06 +00:00
DwarfSection.h Fix potential bad info in eh_frame_hdr. 2019-10-29 18:39:30 -07:00
DwarfStructs.h
Elf.h Fix support finding global variables. 2019-12-03 17:35:00 -08:00
ElfInterface.h Fix support finding global variables. 2019-12-03 17:35:00 -08:00
Error.h Fix pc/function name for signal handler frame. 2019-04-12 17:23:18 -07:00
Global.h Fix support finding global variables. 2019-12-03 17:35:00 -08:00
JitDebug.h Revert "Check for data races when reading JIT/DEX entries." 2019-04-05 18:23:32 +00:00
LocalUnwinder.h Add a specialized LocalUnwinder object. 2018-05-23 20:02:30 -07:00
Log.h
MachineArm.h Expose per arch headers. 2018-02-08 19:29:08 -08:00
MachineArm64.h Include PSTATE in tombstones on arm64. 2019-11-18 17:57:37 -08:00
MachineMips.h Expose per arch headers. 2018-02-08 19:29:08 -08:00
MachineMips64.h Expose per arch headers. 2018-02-08 19:29:08 -08:00
MachineX86.h Expose per arch headers. 2018-02-08 19:29:08 -08:00
MachineX86_64.h Expose per arch headers. 2018-02-08 19:29:08 -08:00
MapInfo.h Properly handle empty map after read-only map. 2020-01-22 18:30:12 -08:00
Maps.h Fix LocalUpdatableMaps 2019-09-16 18:28:38 -07:00
Memory.h Internalize subclasses of Memory 2019-06-11 12:09:18 -07:00
Regs.h Use elf offset in signal step check. 2019-12-04 22:29:59 +00:00
RegsArm.h Use elf offset in signal step check. 2019-12-04 22:29:59 +00:00
RegsArm64.h Use elf offset in signal step check. 2019-12-04 22:29:59 +00:00
RegsGetLocal.h Allow to get raw register data on all platforms. 2018-08-08 11:19:41 +01:00
RegsMips.h Use elf offset in signal step check. 2019-12-04 22:29:59 +00:00
RegsMips64.h Use elf offset in signal step check. 2019-12-04 22:29:59 +00:00
RegsX86.h Use elf offset in signal step check. 2019-12-04 22:29:59 +00:00
RegsX86_64.h Use elf offset in signal step check. 2019-12-04 22:29:59 +00:00
UcontextArm.h Expose per arch headers. 2018-02-08 19:29:08 -08:00
UcontextArm64.h Expose per arch headers. 2018-02-08 19:29:08 -08:00
UcontextMips.h Expose per arch headers. 2018-02-08 19:29:08 -08:00
UcontextMips64.h Expose per arch headers. 2018-02-08 19:29:08 -08:00
UcontextX86.h Expose per arch headers. 2018-02-08 19:29:08 -08:00
UcontextX86_64.h Expose per arch headers. 2018-02-08 19:29:08 -08:00
Unwinder.h Move the dexfile support to implementation. 2019-11-20 14:59:55 -08:00
UserArm.h Expose per arch headers. 2018-02-08 19:29:08 -08:00
UserArm64.h Expose per arch headers. 2018-02-08 19:29:08 -08:00
UserMips.h Expose per arch headers. 2018-02-08 19:29:08 -08:00
UserMips64.h Expose per arch headers. 2018-02-08 19:29:08 -08:00
UserX86.h Expose per arch headers. 2018-02-08 19:29:08 -08:00
UserX86_64.h Expose per arch headers. 2018-02-08 19:29:08 -08:00