LLDB mainline
RegisterContextMinidump_x86_32.h
Go to the documentation of this file.
1//===-- RegisterContextMinidump_x86_32.h ------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_SOURCE_PLUGINS_PROCESS_MINIDUMP_REGISTERCONTEXTMINIDUMP_X86_32_H
10#define LLDB_SOURCE_PLUGINS_PROCESS_MINIDUMP_REGISTERCONTEXTMINIDUMP_X86_32_H
11
12#include "MinidumpTypes.h"
13
16
18
19#include "llvm/ADT/ArrayRef.h"
20#include "llvm/ADT/BitmaskEnum.h"
21#include "llvm/Support/Endian.h"
22
23// C includes
24// C++ includes
25
26namespace lldb_private {
27
28namespace minidump {
29
30// This function receives an ArrayRef pointing to the bytes of the Minidump
31// register context and returns a DataBuffer that's ordered by the offsets
32// specified in the RegisterInfoInterface argument
33// This way we can reuse the already existing register contexts
35ConvertMinidumpContext_x86_32(llvm::ArrayRef<uint8_t> source_data,
36 RegisterInfoInterface *target_reg_interface);
37
38// Reference: see breakpad/crashpad source or WinNT.h
40 llvm::support::ulittle32_t control_word;
41 llvm::support::ulittle32_t status_word;
42 llvm::support::ulittle32_t tag_word;
43 llvm::support::ulittle32_t error_offset;
44 llvm::support::ulittle32_t error_selector;
45 llvm::support::ulittle32_t data_offset;
46 llvm::support::ulittle32_t data_selector;
47
48 enum {
50 };
51 // register_area contains eight 80-bit (x87 "long double") quantities for
52 // floating-point registers %st0 (%mm0) through %st7 (%mm7).
54 llvm::support::ulittle32_t cr0_npx_state;
55};
56
58 // The context_flags field determines which parts
59 // of the structure are populated (have valid values)
60 llvm::support::ulittle32_t context_flags;
61
62 // The next 6 registers are included with
63 // MinidumpContext_x86_32_Flags::DebugRegisters
64 llvm::support::ulittle32_t dr0;
65 llvm::support::ulittle32_t dr1;
66 llvm::support::ulittle32_t dr2;
67 llvm::support::ulittle32_t dr3;
68 llvm::support::ulittle32_t dr6;
69 llvm::support::ulittle32_t dr7;
70
71 // The next field is included with
72 // MinidumpContext_x86_32_Flags::FloatingPoint
74
75 // The next 4 registers are included with
76 // MinidumpContext_x86_32_Flags::Segments
77 llvm::support::ulittle32_t gs;
78 llvm::support::ulittle32_t fs;
79 llvm::support::ulittle32_t es;
80 llvm::support::ulittle32_t ds;
81
82 // The next 6 registers are included with
83 // MinidumpContext_x86_32_Flags::Integer
84 llvm::support::ulittle32_t edi;
85 llvm::support::ulittle32_t esi;
86 llvm::support::ulittle32_t ebx;
87 llvm::support::ulittle32_t edx;
88 llvm::support::ulittle32_t ecx;
89 llvm::support::ulittle32_t eax;
90
91 // The next 6 registers are included with
92 // MinidumpContext_x86_32_Flags::Control
93 llvm::support::ulittle32_t ebp;
94 llvm::support::ulittle32_t eip;
95 llvm::support::ulittle32_t cs; // WinNT.h says "must be sanitized"
96 llvm::support::ulittle32_t eflags; // WinNT.h says "must be sanitized"
97 llvm::support::ulittle32_t esp;
98 llvm::support::ulittle32_t ss;
99
100 // The next field is included with
101 // MinidumpContext_x86_32_Flags::ExtendedRegisters
102 // It contains vector (MMX/SSE) registers. It is laid out in the
103 // format used by the fxsave and fsrstor instructions, so it includes
104 // a copy of the x87 floating-point registers as well. See FXSAVE in
105 // "Intel Architecture Software Developer's Manual, Volume 2."
106 enum {
108 };
110};
111
113
114// For context_flags. These values indicate the type of
115// context stored in the structure. The high 24 bits identify the CPU, the
116// low 8 bits identify the type of context saved.
117enum class MinidumpContext_x86_32_Flags : uint32_t {
118 x86_32_Flag = 0x00010000, // CONTEXT_i386, CONTEXT_i486
119 Control = x86_32_Flag | 0x00000001,
120 Integer = x86_32_Flag | 0x00000002,
121 Segments = x86_32_Flag | 0x00000004,
122 FloatingPoint = x86_32_Flag | 0x00000008,
123 DebugRegisters = x86_32_Flag | 0x00000010,
124 ExtendedRegisters = x86_32_Flag | 0x00000020,
125 XState = x86_32_Flag | 0x00000040,
126
129
130 LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue = */ All)
131};
132
133} // end namespace minidump
134} // end namespace lldb_private
135#endif // LLDB_SOURCE_PLUGINS_PROCESS_MINIDUMP_REGISTERCONTEXTMINIDUMP_X86_32_H
lldb::DataBufferSP ConvertMinidumpContext_x86_32(llvm::ArrayRef< uint8_t > source_data, RegisterInfoInterface *target_reg_interface)
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:328