[Object] Add basic minidump support
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
2019-03-21 10:18:59 +01:00
|
|
|
//===- MinidumpConstants.def - Iteration over minidump constants-*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
Object/minidump: Add support for the MemoryInfoList stream
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
2019-10-08 16:15:32 +02:00
|
|
|
#if !(defined(HANDLE_MDMP_STREAM_TYPE) || defined(HANDLE_MDMP_ARCH) || \
|
|
|
|
defined(HANDLE_MDMP_PLATFORM) || defined(HANDLE_MDMP_PROTECT) || \
|
|
|
|
defined(HANDLE_MDMP_MEMSTATE) || defined(HANDLE_MDMP_MEMTYPE))
|
[Object] Add basic minidump support
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
2019-03-21 10:18:59 +01:00
|
|
|
#error "Missing HANDLE_MDMP definition"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HANDLE_MDMP_STREAM_TYPE
|
|
|
|
#define HANDLE_MDMP_STREAM_TYPE(CODE, NAME)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HANDLE_MDMP_ARCH
|
|
|
|
#define HANDLE_MDMP_ARCH(CODE, NAME)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HANDLE_MDMP_PLATFORM
|
|
|
|
#define HANDLE_MDMP_PLATFORM(CODE, NAME)
|
|
|
|
#endif
|
|
|
|
|
Object/minidump: Add support for the MemoryInfoList stream
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
2019-10-08 16:15:32 +02:00
|
|
|
#ifndef HANDLE_MDMP_PROTECT
|
|
|
|
#define HANDLE_MDMP_PROTECT(CODE, NAME, NATIVENAME)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HANDLE_MDMP_MEMSTATE
|
|
|
|
#define HANDLE_MDMP_MEMSTATE(CODE, NAME, NATIVENAME)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HANDLE_MDMP_MEMTYPE
|
|
|
|
#define HANDLE_MDMP_MEMTYPE(CODE, NAME, NATIVENAME)
|
|
|
|
#endif
|
|
|
|
|
[Object] Add basic minidump support
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
2019-03-21 10:18:59 +01:00
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x0003, ThreadList)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x0004, ModuleList)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x0005, MemoryList)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x0006, Exception)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x0007, SystemInfo)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x0008, ThreadExList)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x0009, Memory64List)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x000a, CommentA)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x000b, CommentW)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x000c, HandleData)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x000d, FunctionTable)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x000e, UnloadedModuleList)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x000f, MiscInfo)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x0010, MemoryInfoList)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x0011, ThreadInfoList)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x0012, HandleOperationList)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x0013, Token)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x0014, JavascriptData)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x0015, SystemMemoryInfo)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x0016, ProcessVMCounters)
|
|
|
|
// Breakpad extension types. 0x4767 = "Gg"
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x47670001, BreakpadInfo)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x47670002, AssertionInfo)
|
|
|
|
// These are additional minidump stream values which are specific to the linux
|
|
|
|
// breakpad implementation.
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x47670003, LinuxCPUInfo) // /proc/cpuinfo
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x47670004, LinuxProcStatus) // /proc/$x/status
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x47670005, LinuxLSBRelease) // /etc/lsb-release
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x47670006, LinuxCMDLine) // /proc/$x/cmdline
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x47670007, LinuxEnviron) // /proc/$x/environ
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x47670008, LinuxAuxv) // /proc/$x/auxv
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x47670009, LinuxMaps) // /proc/$x/maps
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x4767000A, LinuxDSODebug)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x4767000B, LinuxProcStat) // /proc/$x/stat
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x4767000C, LinuxProcUptime) // uptime
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0x4767000D, LinuxProcFD) // /proc/$x/fd
|
|
|
|
// Facebook-defined stream types
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0xFACE1CA7, FacebookLogcat)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0xFACECAFA, FacebookAppCustomData)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0xFACECAFB, FacebookBuildID)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0xFACECAFC, FacebookAppVersionName)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0xFACECAFD, FacebookJavaStack)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0xFACECAFE, FacebookDalvikInfo)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0xFACECAFF, FacebookUnwindSymbols)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0xFACECB00, FacebookDumpErrorLog)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0xFACECCCC, FacebookAppStateLog)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0xFACEDEAD, FacebookAbortReason)
|
|
|
|
HANDLE_MDMP_STREAM_TYPE(0xFACEE000, FacebookThreadName)
|
|
|
|
|
2019-10-30 14:31:57 +01:00
|
|
|
HANDLE_MDMP_ARCH(0x0000, X86) // PROCESSOR_ARCHITECTURE_INTEL
|
|
|
|
HANDLE_MDMP_ARCH(0x0001, MIPS) // PROCESSOR_ARCHITECTURE_MIPS
|
|
|
|
HANDLE_MDMP_ARCH(0x0002, Alpha) // PROCESSOR_ARCHITECTURE_ALPHA
|
|
|
|
HANDLE_MDMP_ARCH(0x0003, PPC) // PROCESSOR_ARCHITECTURE_PPC
|
|
|
|
HANDLE_MDMP_ARCH(0x0004, SHX) // PROCESSOR_ARCHITECTURE_SHX (Super-H)
|
|
|
|
HANDLE_MDMP_ARCH(0x0005, ARM) // PROCESSOR_ARCHITECTURE_ARM
|
|
|
|
HANDLE_MDMP_ARCH(0x0006, IA64) // PROCESSOR_ARCHITECTURE_IA64
|
|
|
|
HANDLE_MDMP_ARCH(0x0007, Alpha64) // PROCESSOR_ARCHITECTURE_ALPHA64
|
|
|
|
HANDLE_MDMP_ARCH(0x0008, MSIL) // PROCESSOR_ARCHITECTURE_MSIL
|
|
|
|
HANDLE_MDMP_ARCH(0x0009, AMD64) // PROCESSOR_ARCHITECTURE_AMD64
|
|
|
|
HANDLE_MDMP_ARCH(0x000a, X86Win64) // PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
|
2019-10-31 11:05:47 +01:00
|
|
|
HANDLE_MDMP_ARCH(0x000c, ARM64) // PROCESSOR_ARCHITECTURE_ARM64
|
2019-10-30 14:31:57 +01:00
|
|
|
HANDLE_MDMP_ARCH(0x8001, BP_SPARC) // Breakpad-defined value for SPARC
|
|
|
|
HANDLE_MDMP_ARCH(0x8002, BP_PPC64) // Breakpad-defined value for PPC64
|
|
|
|
HANDLE_MDMP_ARCH(0x8003, BP_ARM64) // Breakpad-defined value for ARM64
|
|
|
|
HANDLE_MDMP_ARCH(0x8004, BP_MIPS64) // Breakpad-defined value for MIPS64
|
[Object] Add basic minidump support
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
2019-03-21 10:18:59 +01:00
|
|
|
|
|
|
|
HANDLE_MDMP_PLATFORM(0x0000, Win32S) // Win32 on Windows 3.1
|
|
|
|
HANDLE_MDMP_PLATFORM(0x0001, Win32Windows) // Windows 95-98-Me
|
|
|
|
HANDLE_MDMP_PLATFORM(0x0002, Win32NT) // Windows NT, 2000+
|
|
|
|
HANDLE_MDMP_PLATFORM(0x0003, Win32CE) // Windows CE, Windows Mobile, "Handheld"
|
|
|
|
// Breakpad-defined values.
|
|
|
|
HANDLE_MDMP_PLATFORM(0x8000, Unix) // Generic Unix-ish
|
|
|
|
HANDLE_MDMP_PLATFORM(0x8101, MacOSX) // Mac OS X/Darwin
|
|
|
|
HANDLE_MDMP_PLATFORM(0x8102, IOS) // iOS
|
|
|
|
HANDLE_MDMP_PLATFORM(0x8201, Linux) // Linux
|
|
|
|
HANDLE_MDMP_PLATFORM(0x8202, Solaris) // Solaris
|
|
|
|
HANDLE_MDMP_PLATFORM(0x8203, Android) // Android
|
|
|
|
HANDLE_MDMP_PLATFORM(0x8204, PS3) // PS3
|
|
|
|
HANDLE_MDMP_PLATFORM(0x8205, NaCl) // Native Client (NaCl)
|
|
|
|
|
Object/minidump: Add support for the MemoryInfoList stream
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
2019-10-08 16:15:32 +02:00
|
|
|
HANDLE_MDMP_PROTECT(0x01, NoAccess, PAGE_NO_ACCESS)
|
|
|
|
HANDLE_MDMP_PROTECT(0x02, ReadOnly, PAGE_READ_ONLY)
|
|
|
|
HANDLE_MDMP_PROTECT(0x04, ReadWrite, PAGE_READ_WRITE)
|
|
|
|
HANDLE_MDMP_PROTECT(0x08, WriteCopy, PAGE_WRITE_COPY)
|
|
|
|
HANDLE_MDMP_PROTECT(0x10, Execute, PAGE_EXECUTE)
|
|
|
|
HANDLE_MDMP_PROTECT(0x20, ExecuteRead, PAGE_EXECUTE_READ)
|
|
|
|
HANDLE_MDMP_PROTECT(0x40, ExecuteReadWrite, PAGE_EXECUTE_READ_WRITE)
|
|
|
|
HANDLE_MDMP_PROTECT(0x80, ExeciteWriteCopy, PAGE_EXECUTE_WRITE_COPY)
|
|
|
|
HANDLE_MDMP_PROTECT(0x100, Guard, PAGE_GUARD)
|
|
|
|
HANDLE_MDMP_PROTECT(0x200, NoCache, PAGE_NOCACHE)
|
|
|
|
HANDLE_MDMP_PROTECT(0x400, WriteCombine, PAGE_WRITECOMBINE)
|
|
|
|
HANDLE_MDMP_PROTECT(0x40000000, TargetsInvalid, PAGE_TARGETS_INVALID)
|
|
|
|
|
|
|
|
HANDLE_MDMP_MEMSTATE(0x01000, Commit, MEM_COMMIT)
|
|
|
|
HANDLE_MDMP_MEMSTATE(0x02000, Reserve, MEM_RESERVE)
|
|
|
|
HANDLE_MDMP_MEMSTATE(0x10000, Free, MEM_FREE)
|
|
|
|
|
|
|
|
HANDLE_MDMP_MEMTYPE(0x0020000, Private, MEM_PRIVATE)
|
|
|
|
HANDLE_MDMP_MEMTYPE(0x0040000, Mapped, MEM_MAPPED)
|
|
|
|
HANDLE_MDMP_MEMTYPE(0x1000000, Image, MEM_IMAGE)
|
|
|
|
|
[Object] Add basic minidump support
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
2019-03-21 10:18:59 +01:00
|
|
|
#undef HANDLE_MDMP_STREAM_TYPE
|
|
|
|
#undef HANDLE_MDMP_ARCH
|
|
|
|
#undef HANDLE_MDMP_PLATFORM
|
Object/minidump: Add support for the MemoryInfoList stream
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
2019-10-08 16:15:32 +02:00
|
|
|
#undef HANDLE_MDMP_PROTECT
|
|
|
|
#undef HANDLE_MDMP_MEMSTATE
|
|
|
|
#undef HANDLE_MDMP_MEMTYPE
|