[Lldb-commits] [PATCH] D69035: minidump: Refactor memory region computation code

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 16 06:51:10 PDT 2019


labath created this revision.
labath added reviewers: clayborg, amccarth.
Herald added subscribers: mgrang, mgorny.

The goal of this refactor is to enable ProcessMinidump to take into
account the loaded modules and their sections when computing the
permissions of various ranges of memory, as discussed in D66638 <https://reviews.llvm.org/D66638>.

This patch moves some of the responsibility for computing the ranges
from MinidumpParser into ProcessMinidump. MinidumpParser still does the
parsing, but ProcessMinidump becomes responsible for answering the
actual queries about memory ranges. This will enable it (in a follow-up
patch) to augment the information obtained from the parser with data
obtained from actual object files.

The changes in the actual code are fairly straight-forward and just
involve moving code around. MinidumpParser::GetMemoryRegions is renamed
to BuildMemoryRegions to emphasize that it does no caching. The only new
thing is the additional bool flag returned from this function. This
indicates whether the returned regions describe all memory mapped into
the target process. Data obtained from /proc/maps and the MemoryInfoList
stream is considered to be exhaustive. Data obtained from Memory(64)List
is not. This will be used to determine whether we need to augment the
data or not.

This reshuffle means that it is no longer possible/easy to test some of
this code via unit tests, as constructing a ProcessMinidump instance is
hard. Instead, I update the unit tests to only test the parsing of the
actual data, and test the answering of queries through a lit test using
the "memory region" command. The patch also includes some tweaks to the
MemoryRegion class to make the unit tests easier to write.


https://reviews.llvm.org/D69035

Files:
  include/lldb/Target/MemoryRegionInfo.h
  source/Plugins/Process/minidump/MinidumpParser.cpp
  source/Plugins/Process/minidump/MinidumpParser.h
  source/Plugins/Process/minidump/ProcessMinidump.cpp
  source/Plugins/Process/minidump/ProcessMinidump.h
  source/Target/CMakeLists.txt
  source/Target/MemoryRegionInfo.cpp
  test/Shell/Minidump/memory-region.yaml
  unittests/Process/minidump/MinidumpParserTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69035.225212.patch
Type: text/x-patch
Size: 24121 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191016/e3877714/attachment-0001.bin>


More information about the lldb-commits mailing list