[elf-core] Improve reading memory from core file
authorDjordje Todorovic <djordje.todorovic@syrmia.com>
Wed, 30 Dec 2020 08:38:20 +0000 (00:38 -0800)
committerDjordje Todorovic <djtodoro@cisco.com>
Mon, 8 Feb 2021 08:14:32 +0000 (00:14 -0800)
commit9abd8c1a4c3870f2831ee805cd3c0cec516a1c17
tree7fe874c18da7834037ee25c15824fa0a30ab7df0
parent035abe30c9a55c08229f53aa63745a9ba87892d1
[elf-core] Improve reading memory from core file

This patch tries to improve memory-read from core files
(in order to improve disassembly functionality).

I am using RHEL 7.7 (linux kernel 3.10) and for a lot of cases,
I was not able to disassemble some functions from backtrace when
debugging crashes from core files. It outputs some dummy code.

The cause of the problem was the fact we are returning all the zeros
from ProcessElfCore::ReadMemory() that is being called within
Disassembler::ParseInstructions() and it disassembles some dummy
opcodes from the buffer returned. Therefore, we are removing zero
bytes filling (padding) completely.

Differential Revision: https://reviews.llvm.org/D93939
lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py