Object/Minidump: Add support for reading the ModuleList stream
authorPavel Labath <pavel@labath.sk>
Mon, 8 Apr 2019 09:57:29 +0000 (09:57 +0000)
committerPavel Labath <pavel@labath.sk>
Mon, 8 Apr 2019 09:57:29 +0000 (09:57 +0000)
commitaaff480c68cac3c363420292ff58889c366aca5c
treea4a7271cc5adc38129070a2f37877bf1b1ad6b50
parent7b30751acb9c9bfcd449c2386ab8519092700a54
Object/Minidump: Add support for reading the ModuleList stream

Summary:
The ModuleList stream consists of an integer giving the number of
entries in the list, followed by the list itself. Each entry in the list
describes a module (dynamically loaded objects which were loaded in the
process when it crashed (or when the minidump was generated).

The code for reading the list is relatively straight-forward, with a
single gotcha. Some minidump writers are emitting padding after the
"count" field in order to align the subsequent list on 8 byte boundary
(this depends on how their ModuleList type was defined and the native
alignment of various types on their platform). Fortunately, the minidump
format contains enough redundancy (in the form of the stream length
field in the stream directory), which allows us to detect this situation
and correct it.

This patch just adds the ability to parse the stream. Code for
conversion to/from yaml will come in a follow-up patch.

Reviewers: zturner, amccarth, jhenderson, clayborg

Subscribers: jdoerfert, markmentovai, lldb-commits, llvm-commits

Tags: #llvm

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

llvm-svn: 357897
llvm/include/llvm/BinaryFormat/Minidump.h
llvm/include/llvm/Object/Minidump.h
llvm/lib/Object/Minidump.cpp
llvm/unittests/Object/MinidumpTest.cpp