summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/Minidump.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Object/minidump: Add support for the MemoryInfoList streamPavel Labath2019-10-081-14/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds the definitions of the constants and structures necessary to interpret the MemoryInfoList minidump stream, as well as the object::MinidumpFile interface to access the stream. While the code is fairly simple, there is one important deviation from the other minidump streams, which is worth calling out explicitly. Unlike other "List" streams, the size of the records inside MemoryInfoList stream is not known statically. Instead it is described in the stream header. This makes it impossible to return ArrayRef<MemoryInfo> from the accessor method, as it is done with other streams. Instead, I create an iterator class, which can be parameterized by the runtime size of the structure, and return iterator_range<iterator> instead. Reviewers: amccarth, jhenderson, clayborg Subscribers: JosephTremoulet, zturner, markmentovai, lldb-commits, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68210 llvm-svn: 374051
* Minidump: Add support for the MemoryList streamPavel Labath2019-05-161-0/+2
| | | | | | | | | | | | | | | | | | Summary: the stream format is exactly the same as for ThreadList and ModuleList streams, only the entry types are slightly different, so the changes in this patch are just straight-forward applications of established patterns. Reviewers: amccarth, jhenderson, clayborg Subscribers: markmentovai, lldb-commits, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61885 llvm-svn: 360908
* Object/Minidump: Add support for the ThreadList streamPavel Labath2019-05-021-7/+12
| | | | | | | | | | | | | | | | | | Summary: The stream contains the list of threads belonging to the process described by the minidump. Its structure is the same as the ModuleList stream, and in fact, I have generalized the ModuleList reading code to handle this stream too. Reviewers: amccarth, jhenderson, clayborg Subscribers: llvm-commits, lldb-commits, markmentovai, zturner Tags: #llvm Differential Revision: https://reviews.llvm.org/D61064 llvm-svn: 359762
* Object/Minidump: Add support for reading the ModuleList streamPavel Labath2019-04-081-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix r357749 for big-endian architecturesPavel Labath2019-04-051-2/+6
| | | | | | | | | | | | | We need to read the strings from the minidump files as little-endian, regardless of the host byte order. I definitely remember thinking about this case while writing the patch (and in fact, I have implemented that for the "write" case), but somehow I have ended up not implementing the byte swapping when reading the data. This adds the necessary byte-swapping and should hopefully fix test failures on big-endian bots. llvm-svn: 357754
* Minidump: Add support for reading/writing stringsPavel Labath2019-04-051-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Strings in minidump files are stored as a 32-bit length field, giving the length of the string in *bytes*, which is followed by the appropriate number of UTF16 code units. The string is also supposed to be null-terminated, and the null-terminator is not a part of the length field. This patch: - adds support for reading these strings out of the minidump file (this implementation does not depend on proper null-termination) - adds support for writing them to a minidump file - using the previous two pieces implements proper (de)serialization of the CSDVersion field of the SystemInfo stream. Previously, this was only read/written as hex, and no attempt was made to access the referenced string -- now this string is read and written correctly. The changes are tested via yaml2obj|obj2yaml round-trip as well as a unit test which checks the corner cases of the string deserialization logic. Reviewers: jhenderson, zturner, clayborg Subscribers: llvm-commits, aprantl, markmentovai, amccarth, lldb-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59775 llvm-svn: 357749
* [Object] Add basic minidump supportPavel Labath2019-03-211-0/+77
Summary: This patch adds basic support for reading minidump files. It contains the definitions of various important minidump data structures (header, stream directory), and of one minidump stream (SystemInfo). The ability to read other streams will be added in follow-up patches. However, all streams can be read even now as raw data, which means lldb's minidump support (where this code is taken from) can be immediately rebased on top of this patch as soon as it lands. As we don't have any support for generating minidump files (yet), this tests the code via unit tests with some small handcrafted binaries in the form of c char arrays. Reviewers: Bigcheese, jhenderson, zturner Subscribers: srhines, dschuff, mgorny, fedor.sergeev, lemo, clayborg, JDevlieghere, aprantl, lldb-commits, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59291 llvm-svn: 356652
OpenPOWER on IntegriCloud