Index: include/lldb/Formats/MinidumpEnums.def =================================================================== --- /dev/null +++ include/lldb/Formats/MinidumpEnums.def @@ -0,0 +1,107 @@ +//===-- MinidumpEnums.def ---------------------------------------*- 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 +// +//===----------------------------------------------------------------------===// + +#if !(defined LLDB_HANDLE_STREAM_TYPE || defined LLDB_HANDLE_ARCH || \ + defined LLDB_HANDLE_PLATFORM) +#error "Missing LLDB_HANDLE definition" +#endif + +#ifndef LLDB_HANDLE_STREAM_TYPE +#define LLDB_HANDLE_STREAM_TYPE(CODE, NAME) +#endif + +#ifndef LLDB_HANDLE_ARCH +#define LLDB_HANDLE_ARCH(CODE, NAME) +#endif + +#ifndef LLDB_HANDLE_PLATFORM +#define LLDB_HANDLE_PLATFORM(CODE, NAME) +#endif + +LLDB_HANDLE_STREAM_TYPE(0x0003, ThreadList) +LLDB_HANDLE_STREAM_TYPE(0x0004, ModuleList) +LLDB_HANDLE_STREAM_TYPE(0x0005, MemoryList) +LLDB_HANDLE_STREAM_TYPE(0x0006, Exception) +LLDB_HANDLE_STREAM_TYPE(0x0007, SystemInfo) +LLDB_HANDLE_STREAM_TYPE(0x0008, ThreadExList) +LLDB_HANDLE_STREAM_TYPE(0x0009, Memory64List) +LLDB_HANDLE_STREAM_TYPE(0x000a, CommentA) +LLDB_HANDLE_STREAM_TYPE(0x000b, CommentW) +LLDB_HANDLE_STREAM_TYPE(0x000c, HandleData) +LLDB_HANDLE_STREAM_TYPE(0x000d, FunctionTable) +LLDB_HANDLE_STREAM_TYPE(0x000e, UnloadedModuleList) +LLDB_HANDLE_STREAM_TYPE(0x000f, MiscInfo) +LLDB_HANDLE_STREAM_TYPE(0x0010, MemoryInfoList) +LLDB_HANDLE_STREAM_TYPE(0x0011, ThreadInfoList) +LLDB_HANDLE_STREAM_TYPE(0x0012, HandleOperationList) +LLDB_HANDLE_STREAM_TYPE(0x0013, Token) +LLDB_HANDLE_STREAM_TYPE(0x0014, JavascriptData) +LLDB_HANDLE_STREAM_TYPE(0x0015, SystemMemoryInfo) +LLDB_HANDLE_STREAM_TYPE(0x0016, ProcessVMCounters) +// Breakpad extension types. 0x4767 = "Gg" +LLDB_HANDLE_STREAM_TYPE(0x47670001, BreakpadInfo) +LLDB_HANDLE_STREAM_TYPE(0x47670002, AssertionInfo) +// These are additional minidump stream values which are specific to the linux +// breakpad implementation. +LLDB_HANDLE_STREAM_TYPE(0x47670003, LinuxCPUInfo) // /proc/cpuinfo +LLDB_HANDLE_STREAM_TYPE(0x47670004, LinuxProcStatus) // /proc/$x/status +LLDB_HANDLE_STREAM_TYPE(0x47670005, LinuxLSBRelease) // /etc/lsb-release +LLDB_HANDLE_STREAM_TYPE(0x47670006, LinuxCMDLine) // /proc/$x/cmdline +LLDB_HANDLE_STREAM_TYPE(0x47670007, LinuxEnviron) // /proc/$x/environ +LLDB_HANDLE_STREAM_TYPE(0x47670008, LinuxAuxv) // /proc/$x/auxv +LLDB_HANDLE_STREAM_TYPE(0x47670009, LinuxMaps) // /proc/$x/maps +LLDB_HANDLE_STREAM_TYPE(0x4767000A, LinuxDSODebug) +LLDB_HANDLE_STREAM_TYPE(0x4767000B, LinuxProcStat) // /proc/$x/stat +LLDB_HANDLE_STREAM_TYPE(0x4767000C, LinuxProcUptime) // uptime +LLDB_HANDLE_STREAM_TYPE(0x4767000D, LinuxProcFD) // /proc/$x/fd +// Facebook-defined stream types +LLDB_HANDLE_STREAM_TYPE(0xFACE1CA7, FacebookLogcat) +LLDB_HANDLE_STREAM_TYPE(0xFACECAFA, FacebookAppCustomData) +LLDB_HANDLE_STREAM_TYPE(0xFACECAFB, FacebookBuildID) +LLDB_HANDLE_STREAM_TYPE(0xFACECAFC, FacebookAppVersionName) +LLDB_HANDLE_STREAM_TYPE(0xFACECAFD, FacebookJavaStack) +LLDB_HANDLE_STREAM_TYPE(0xFACECAFE, FacebookDalvikInfo) +LLDB_HANDLE_STREAM_TYPE(0xFACECAFF, FacebookUnwindSymbols) +LLDB_HANDLE_STREAM_TYPE(0xFACECB00, FacebookDumpErrorLog) +LLDB_HANDLE_STREAM_TYPE(0xFACECCCC, FacebookAppStateLog) +LLDB_HANDLE_STREAM_TYPE(0xFACEDEAD, FacebookAbortReason) +LLDB_HANDLE_STREAM_TYPE(0xFACEE000, FacebookThreadName) + +LLDB_HANDLE_ARCH(0x0000, X86) // PROCESSOR_ARCHITECTURE_INTEL +LLDB_HANDLE_ARCH(0x0001, MIPS) // PROCESSOR_ARCHITECTURE_MIPS +LLDB_HANDLE_ARCH(0x0002, Alpha) // PROCESSOR_ARCHITECTURE_ALPHA +LLDB_HANDLE_ARCH(0x0003, PPC) // PROCESSOR_ARCHITECTURE_PPC +LLDB_HANDLE_ARCH(0x0004, SHX) // PROCESSOR_ARCHITECTURE_SHX (Super-H) +LLDB_HANDLE_ARCH(0x0005, ARM) // PROCESSOR_ARCHITECTURE_ARM +LLDB_HANDLE_ARCH(0x0006, IA64) // PROCESSOR_ARCHITECTURE_IA64 +LLDB_HANDLE_ARCH(0x0007, Alpha64) // PROCESSOR_ARCHITECTURE_ALPHA64 +LLDB_HANDLE_ARCH(0x0008, MSIL) // PROCESSOR_ARCHITECTURE_MSIL +LLDB_HANDLE_ARCH(0x0009, AMD64) // PROCESSOR_ARCHITECTURE_AMD64 +LLDB_HANDLE_ARCH(0x000a, X86Win64) // PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 +LLDB_HANDLE_ARCH(0x8001, SPARC) // Breakpad-defined value for SPARC +LLDB_HANDLE_ARCH(0x8002, PPC64) // Breakpad-defined value for PPC64 +LLDB_HANDLE_ARCH(0x8003, ARM64) // Breakpad-defined value for ARM64 +LLDB_HANDLE_ARCH(0x8004, MIPS64) // Breakpad-defined value for MIPS64 + +LLDB_HANDLE_PLATFORM(0x0000, Win32S) // Windows 3.1 +LLDB_HANDLE_PLATFORM(0x0001, Win32Windows) // Windows 95-98-Me +LLDB_HANDLE_PLATFORM(0x0002, Win32NT) // Windows NT, 2000+ +LLDB_HANDLE_PLATFORM(0x0003, Win32CE) // Windows CE, Windows Mobile, "Handheld" +// Breakpad-defined values. +LLDB_HANDLE_PLATFORM(0x8000, Unix) // Generic Unix-ish +LLDB_HANDLE_PLATFORM(0x8101, MacOSX) // Mac OS X/Darwin +LLDB_HANDLE_PLATFORM(0x8102, IOS) // iOS +LLDB_HANDLE_PLATFORM(0x8201, Linux) // Linux +LLDB_HANDLE_PLATFORM(0x8202, Solaris) // Solaris +LLDB_HANDLE_PLATFORM(0x8203, Android) // Android +LLDB_HANDLE_PLATFORM(0x8204, PS3) // PS3 +LLDB_HANDLE_PLATFORM(0x8205, NaCl) // Native Client (NaCl) + +#undef LLDB_HANDLE_STREAM_TYPE +#undef LLDB_HANDLE_ARCH +#undef LLDB_HANDLE_PLATFORM Index: include/lldb/Formats/MinidumpTypes.h =================================================================== --- include/lldb/Formats/MinidumpTypes.h +++ include/lldb/Formats/MinidumpTypes.h @@ -53,99 +53,22 @@ // Reference: // https://msdn.microsoft.com/en-us/library/windows/desktop/ms680394.aspx enum class MinidumpStreamType : uint32_t { - Unused = 0, - Reserved0 = 1, - Reserved1 = 2, - ThreadList = 3, - ModuleList = 4, - MemoryList = 5, - Exception = 6, - SystemInfo = 7, - ThreadExList = 8, - Memory64List = 9, - CommentA = 10, - CommentW = 11, - HandleData = 12, - FunctionTable = 13, - UnloadedModuleList = 14, - MiscInfo = 15, - MemoryInfoList = 16, - ThreadInfoList = 17, - HandleOperationList = 18, - Token = 19, - JavascriptData = 20, - SystemMemoryInfo = 21, - ProcessVMCounters = 22, +#define LLDB_HANDLE_STREAM_TYPE(CODE, NAME) NAME = CODE, +#include "lldb/Formats/MinidumpEnums.def" LastReserved = 0x0000ffff, - - /* Breakpad extension types. 0x4767 = "Gg" */ - BreakpadInfo = 0x47670001, - AssertionInfo = 0x47670002, - /* These are additional minidump stream values which are specific to - * the linux breakpad implementation. */ - LinuxCPUInfo = 0x47670003, /* /proc/cpuinfo */ - LinuxProcStatus = 0x47670004, /* /proc/$x/status */ - LinuxLSBRelease = 0x47670005, /* /etc/lsb-release */ - LinuxCMDLine = 0x47670006, /* /proc/$x/cmdline */ - LinuxEnviron = 0x47670007, /* /proc/$x/environ */ - LinuxAuxv = 0x47670008, /* /proc/$x/auxv */ - LinuxMaps = 0x47670009, /* /proc/$x/maps */ - LinuxDSODebug = 0x4767000A, - LinuxProcStat = 0x4767000B, /* /proc/$x/stat */ - LinuxProcUptime = 0x4767000C, /* uptime */ - LinuxProcFD = 0x4767000D, /* /proc/$x/fb */ - FacebookAppCustomData = 0xFACECAFA, - FacebookBuildID = 0xFACECAFB, - FacebookAppVersionName = 0xFACECAFC, - FacebookJavaStack = 0xFACECAFD, - FacebookDalvikInfo = 0xFACECAFE, - FacebookUnwindSymbols = 0xFACECAFF, - FacebookDumpErrorLog = 0xFACECB00, - FacebookAppStateLog = 0xFACECCCC, - FacebookAbortReason = 0xFACEDEAD, - FacebookThreadName = 0xFACEE000, - FacebookLogcat = 0xFACE1CA7, - }; // for MinidumpSystemInfo.processor_arch enum class MinidumpCPUArchitecture : uint16_t { - X86 = 0, /* PROCESSOR_ARCHITECTURE_INTEL */ - MIPS = 1, /* PROCESSOR_ARCHITECTURE_MIPS */ - Alpha = 2, /* PROCESSOR_ARCHITECTURE_ALPHA */ - PPC = 3, /* PROCESSOR_ARCHITECTURE_PPC */ - SHX = 4, /* PROCESSOR_ARCHITECTURE_SHX (Super-H) */ - ARM = 5, /* PROCESSOR_ARCHITECTURE_ARM */ - IA64 = 6, /* PROCESSOR_ARCHITECTURE_IA64 */ - Alpha64 = 7, /* PROCESSOR_ARCHITECTURE_ALPHA64 */ - MSIL = 8, /* PROCESSOR_ARCHITECTURE_MSIL - * (Microsoft Intermediate Language) */ - AMD64 = 9, /* PROCESSOR_ARCHITECTURE_AMD64 */ - X86Win64 = 10, /* PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 (WoW64) */ - SPARC = 0x8001, /* Breakpad-defined value for SPARC */ - PPC64 = 0x8002, /* Breakpad-defined value for PPC64 */ - ARM64 = 0x8003, /* Breakpad-defined value for ARM64 */ - MIPS64 = 0x8004, /* Breakpad-defined value for MIPS64 */ +#define LLDB_HANDLE_ARCH(CODE, NAME) NAME = CODE, +#include "lldb/Formats/MinidumpEnums.def" Unknown = 0xffff /* PROCESSOR_ARCHITECTURE_UNKNOWN */ }; // for MinidumpSystemInfo.platform_id enum class MinidumpOSPlatform : uint32_t { - Win32S = 0, /* VER_PLATFORM_WIN32s (Windows 3.1) */ - Win32Windows = 1, /* VER_PLATFORM_WIN32_WINDOWS (Windows 95-98-Me) */ - Win32NT = 2, /* VER_PLATFORM_WIN32_NT (Windows NT, 2000+) */ - Win32CE = 3, /* VER_PLATFORM_WIN32_CE, VER_PLATFORM_WIN32_HH - * (Windows CE, Windows Mobile, "Handheld") */ - - /* The following values are Breakpad-defined. */ - Unix = 0x8000, /* Generic Unix-ish */ - MacOSX = 0x8101, /* Mac OS X/Darwin */ - IOS = 0x8102, /* iOS */ - Linux = 0x8201, /* Linux */ - Solaris = 0x8202, /* Solaris */ - Android = 0x8203, /* Android */ - PS3 = 0x8204, /* PS3 */ - NaCl = 0x8205 /* Native Client (NaCl) */ +#define LLDB_HANDLE_PLATFORM(CODE, NAME) NAME = CODE, +#include "lldb/Formats/MinidumpEnums.def" }; // For MinidumpCPUInfo.arm_cpu_info.elf_hwcaps. Index: include/lldb/module.modulemap =================================================================== --- include/lldb/module.modulemap +++ include/lldb/module.modulemap @@ -11,6 +11,9 @@ umbrella "Formats" module * { export * } + + // This header is intended for (repeated) textual inclusion. + textual header "Formats/MinidumpEnums.def" } module lldb_Host { Index: source/Formats/MinidumpParser.cpp =================================================================== --- source/Formats/MinidumpParser.cpp +++ source/Formats/MinidumpParser.cpp @@ -649,58 +649,14 @@ return m_regions; } -#define ENUM_TO_CSTR(ST) case (uint32_t)MinidumpStreamType::ST: return #ST - llvm::StringRef MinidumpParser::GetStreamTypeAsString(uint32_t stream_type) { - switch (stream_type) { - ENUM_TO_CSTR(Unused); - ENUM_TO_CSTR(Reserved0); - ENUM_TO_CSTR(Reserved1); - ENUM_TO_CSTR(ThreadList); - ENUM_TO_CSTR(ModuleList); - ENUM_TO_CSTR(MemoryList); - ENUM_TO_CSTR(Exception); - ENUM_TO_CSTR(SystemInfo); - ENUM_TO_CSTR(ThreadExList); - ENUM_TO_CSTR(Memory64List); - ENUM_TO_CSTR(CommentA); - ENUM_TO_CSTR(CommentW); - ENUM_TO_CSTR(HandleData); - ENUM_TO_CSTR(FunctionTable); - ENUM_TO_CSTR(UnloadedModuleList); - ENUM_TO_CSTR(MiscInfo); - ENUM_TO_CSTR(MemoryInfoList); - ENUM_TO_CSTR(ThreadInfoList); - ENUM_TO_CSTR(HandleOperationList); - ENUM_TO_CSTR(Token); - ENUM_TO_CSTR(JavascriptData); - ENUM_TO_CSTR(SystemMemoryInfo); - ENUM_TO_CSTR(ProcessVMCounters); - ENUM_TO_CSTR(BreakpadInfo); - ENUM_TO_CSTR(AssertionInfo); - ENUM_TO_CSTR(LinuxCPUInfo); - ENUM_TO_CSTR(LinuxProcStatus); - ENUM_TO_CSTR(LinuxLSBRelease); - ENUM_TO_CSTR(LinuxCMDLine); - ENUM_TO_CSTR(LinuxEnviron); - ENUM_TO_CSTR(LinuxAuxv); - ENUM_TO_CSTR(LinuxMaps); - ENUM_TO_CSTR(LinuxDSODebug); - ENUM_TO_CSTR(LinuxProcStat); - ENUM_TO_CSTR(LinuxProcUptime); - ENUM_TO_CSTR(LinuxProcFD); - ENUM_TO_CSTR(FacebookAppCustomData); - ENUM_TO_CSTR(FacebookBuildID); - ENUM_TO_CSTR(FacebookAppVersionName); - ENUM_TO_CSTR(FacebookJavaStack); - ENUM_TO_CSTR(FacebookDalvikInfo); - ENUM_TO_CSTR(FacebookUnwindSymbols); - ENUM_TO_CSTR(FacebookDumpErrorLog); - ENUM_TO_CSTR(FacebookAppStateLog); - ENUM_TO_CSTR(FacebookAbortReason); - ENUM_TO_CSTR(FacebookThreadName); - ENUM_TO_CSTR(FacebookLogcat); + switch (MinidumpStreamType(stream_type)) { +#define LLDB_HANDLE_STREAM_TYPE(CODE, NAME) \ + case MinidumpStreamType::NAME: \ + return #NAME; +#include "lldb/Formats/MinidumpEnums.def" + default: + return "unknown stream type"; } - return "unknown stream type"; }