android_system_core/libunwindstack/tests/files/offline
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
..
art_quick_osr_stub_arm Fix support finding global variables. 2019-12-03 17:35:00 -08:00
bad_eh_frame_hdr_arm64 Small behavioral changes to the unwinder. 2018-01-24 13:20:03 -08:00
debug_frame_first_x86 Small behavioral changes to the unwinder. 2018-01-24 13:20:03 -08:00
debug_frame_load_bias_arm Fix handling of load bias values. 2018-06-11 18:53:55 -07:00
eh_frame_bias_x86 Fix handling of PT_GNU_EH_FRAME. 2019-10-21 19:11:22 -07:00
eh_frame_hdr_begin_x86_64 Fix off by 4 error handling eh_frame hdr. 2018-02-10 17:11:23 -08:00
empty_arm64 Properly handle empty map after read-only map. 2020-01-22 18:30:12 -08:00
gnu_debugdata_arm Small test clean up. 2018-02-05 13:12:54 -08:00
invalid_elf_offset_arm Set elf_start_offset for invalid elf maps. 2019-06-10 18:39:38 -07:00
jit_debug_arm Fix support finding global variables. 2019-12-03 17:35:00 -08:00
jit_debug_x86 Fix support finding global variables. 2019-12-03 17:35:00 -08:00
jit_map_arm Support a map that represents gdb jit elf data. 2018-03-21 17:23:54 -07:00
load_bias_different_section_bias_arm64 Handle when bias is different in elf headers. 2019-10-08 17:36:06 +00:00
load_bias_ro_rx_x86_64 Fix missing load bias. 2019-07-09 10:22:36 -07:00
offset_arm Fix offsets when shared lib split across maps. 2018-12-18 11:22:14 -08:00
shared_lib_in_apk_arm64 Fix handling of ro segments for embedded libs. 2018-12-11 19:16:29 -08:00
shared_lib_in_apk_memory_only_arm64 Fix handling of ro segments for embedded libs. 2018-12-11 19:16:29 -08:00
shared_lib_in_apk_single_map_arm64 Fix missing offset for apk. 2019-03-12 16:00:55 -07:00
signal_load_bias_arm Use elf offset in signal step check. 2019-12-04 22:29:59 +00:00
straddle_arm Small test clean up. 2018-02-05 13:12:54 -08:00
straddle_arm64 Fix incorrect usage of relative pcs. 2017-11-29 16:10:08 -08:00