[all-commits] [llvm/llvm-project] 7c603a: lldb/minidump: Refactor memory region computation ...

plabath via All-commits all-commits at lists.llvm.org
Fri Oct 25 15:33:49 PDT 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 7c603a41e20f461cf38ec7359a9eaa118fc0db5d
      https://github.com/llvm/llvm-project/commit/7c603a41e20f461cf38ec7359a9eaa118fc0db5d
  Author: Pavel Labath <labath at google.com>
  Date:   2019-10-25 (Fri, 25 Oct 2019)

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

  Log Message:
  -----------
  lldb/minidump: Refactor memory region computation code

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.

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.

Reviewers: amccarth, clayborg

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D69035




More information about the All-commits mailing list