Files
clang-p2996/lldb/test/Shell/Minidump/Inputs/basic-elf.yaml
Pavel Labath 193a7bfb69 minidump: Create memory regions from the sections of loaded modules
Summary:
Not all minidumps contain information about memory permissions. However,
it is still important to know which regions of memory contain
potentially executable code. This is particularly important for
unwinding on win32, as the default unwind method there relies on
scanning the stack for things which "look like" code pointers.

This patch enables ProcessMinidump to reconstruct the likely permissions
of memory regions using the sections of loaded object files. It only
does this if we don't have a better source (memory info list stream, or
linux /proc/maps) for this information, and only if the information in
the object files does not conflict with the information in the minidump.

Theoretically that last bit could be improved, since the permissions
obtained from the MemoryList streams is also only a very rough guess,
but it did not seem worthwhile to complicate the implementation because
of that because there will generally be no overlap in practice as the
MemoryList will contain the stack contents and not any module data.

The patch adds a test checking that the module section permissions are
entered into the memory region list, and also a test which demonstrate
that now the unwinder is able to correctly find return addresses even in
minidumps without memory info list streams.

There's one TODO left in this patch, which is that the "memory region"
output does not give any indication about the "don't know" values of
memory region permissions (it just prints them as if they permission bit
was set). I address this in a follow up.

Reviewers: amccarth, clayborg

Subscribers: mgrang, lldb-commits

Differential Revision: https://reviews.llvm.org/D69105
2019-10-31 11:24:55 +01:00

41 lines
1.1 KiB
YAML

--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Address: 0x0000000000004000
AddressAlign: 0x0000000000001000
Size: 0xb0
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_WRITE ]
Address: 0x0000000000005000
AddressAlign: 0x0000000000001000
Size: 0x42
- Name: .note.gnu.build-id
Type: SHT_NOTE
Flags: [ SHF_ALLOC ]
Address: 0x0000000000005042
AddressAlign: 0x0000000000000004
Content: 040000000800000003000000474E5500DEADBEEFBAADF00D
ProgramHeaders:
- Type: PT_LOAD
Flags: [ PF_X, PF_R ]
VAddr: 0x4000
Align: 0x1000
Sections:
- Section: .text
- Type: PT_LOAD
Flags: [ PF_W, PF_R ]
VAddr: 0x5000
Align: 0x1000
Sections:
- Section: .data
- Section: .note.gnu.build-id
...