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 
26 namespace lldb_private {
27 
28 namespace 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
34 lldb::DataBufferSP
35 ConvertMinidumpContext_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 it 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.
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_private::minidump::MinidumpFloatingSaveAreaX86::control_word
llvm::support::ulittle32_t control_word
Definition: RegisterContextMinidump_x86_32.h:40
lldb_private::minidump::MinidumpContext_x86_32::context_flags
llvm::support::ulittle32_t context_flags
Definition: RegisterContextMinidump_x86_32.h:60
lldb_private::minidump::MinidumpContext_x86_32_Flags::XState
@ XState
lldb_private::minidump::ConvertMinidumpContext_x86_32
lldb::DataBufferSP ConvertMinidumpContext_x86_32(llvm::ArrayRef< uint8_t > source_data, RegisterInfoInterface *target_reg_interface)
Definition: RegisterContextMinidump_x86_32.cpp:24
lldb_private::minidump::MinidumpContext_x86_32_Flags::Segments
@ Segments
lldb_private::minidump::MinidumpContext_x86_32_Flags::DebugRegisters
@ DebugRegisters
lldb_private::minidump::LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE()
lldb_private::minidump::MinidumpContext_x86_32_Flags
MinidumpContext_x86_32_Flags
Definition: RegisterContextMinidump_x86_32.h:117
MinidumpTypes.h
lldb_private::minidump::MinidumpContext_x86_32::ExtendedRegistersSize
@ ExtendedRegistersSize
Definition: RegisterContextMinidump_x86_32.h:107
lldb_private::minidump::MinidumpContext_x86_32::es
llvm::support::ulittle32_t es
Definition: RegisterContextMinidump_x86_32.h:79
lldb_private::minidump::MinidumpContext_x86_32::edi
llvm::support::ulittle32_t edi
Definition: RegisterContextMinidump_x86_32.h:84
lldb_private::minidump::MinidumpContext_x86_32::dr3
llvm::support::ulittle32_t dr3
Definition: RegisterContextMinidump_x86_32.h:67
lldb_private::minidump::MinidumpContext_x86_32::float_save
MinidumpFloatingSaveAreaX86 float_save
Definition: RegisterContextMinidump_x86_32.h:73
lldb_private::minidump::MinidumpContext_x86_32::edx
llvm::support::ulittle32_t edx
Definition: RegisterContextMinidump_x86_32.h:87
lldb_private::minidump::MinidumpContext_x86_32::eflags
llvm::support::ulittle32_t eflags
Definition: RegisterContextMinidump_x86_32.h:96
lldb_private::minidump::MinidumpFloatingSaveAreaX86::RegisterAreaSize
@ RegisterAreaSize
Definition: RegisterContextMinidump_x86_32.h:49
lldb_private::minidump::MinidumpContext_x86_32::eax
llvm::support::ulittle32_t eax
Definition: RegisterContextMinidump_x86_32.h:89
lldb_private::minidump::MinidumpContext_x86_32::ebx
llvm::support::ulittle32_t ebx
Definition: RegisterContextMinidump_x86_32.h:86
lldb_private::minidump::MinidumpContext_x86_32_Flags::x86_32_Flag
@ x86_32_Flag
lldb_private::minidump::MinidumpContext_x86_32::dr2
llvm::support::ulittle32_t dr2
Definition: RegisterContextMinidump_x86_32.h:66
lldb_private::minidump::MinidumpContext_x86_32_Flags::Full
@ Full
lldb_private::minidump::MinidumpContext_x86_32_Flags::ExtendedRegisters
@ ExtendedRegisters
lldb_private::minidump::MinidumpContext_x86_32::ss
llvm::support::ulittle32_t ss
Definition: RegisterContextMinidump_x86_32.h:98
lldb_private::minidump::MinidumpContext_x86_32::eip
llvm::support::ulittle32_t eip
Definition: RegisterContextMinidump_x86_32.h:94
RegisterInfoInterface.h
lldb_private::minidump::MinidumpFloatingSaveAreaX86::data_offset
llvm::support::ulittle32_t data_offset
Definition: RegisterContextMinidump_x86_32.h:45
lldb_private::minidump::MinidumpFloatingSaveAreaX86::tag_word
llvm::support::ulittle32_t tag_word
Definition: RegisterContextMinidump_x86_32.h:42
lldb_private::minidump::MinidumpContext_x86_32::dr6
llvm::support::ulittle32_t dr6
Definition: RegisterContextMinidump_x86_32.h:68
lldb_private::minidump::MinidumpContext_x86_32::cs
llvm::support::ulittle32_t cs
Definition: RegisterContextMinidump_x86_32.h:95
lldb_private::minidump::MinidumpContext_x86_32::ebp
llvm::support::ulittle32_t ebp
Definition: RegisterContextMinidump_x86_32.h:93
lldb_private::minidump::MinidumpFloatingSaveAreaX86::error_selector
llvm::support::ulittle32_t error_selector
Definition: RegisterContextMinidump_x86_32.h:44
lldb_private::minidump::MinidumpFloatingSaveAreaX86::error_offset
llvm::support::ulittle32_t error_offset
Definition: RegisterContextMinidump_x86_32.h:43
lldb_private::minidump::MinidumpContext_x86_32::esi
llvm::support::ulittle32_t esi
Definition: RegisterContextMinidump_x86_32.h:85
lldb_private::minidump::MinidumpFloatingSaveAreaX86::status_word
llvm::support::ulittle32_t status_word
Definition: RegisterContextMinidump_x86_32.h:41
lldb_private::minidump::MinidumpContext_x86_32::dr0
llvm::support::ulittle32_t dr0
Definition: RegisterContextMinidump_x86_32.h:64
lldb_private::minidump::MinidumpContext_x86_32::extended_registers
uint8_t extended_registers[ExtendedRegistersSize]
Definition: RegisterContextMinidump_x86_32.h:109
lldb_private::minidump::MinidumpContext_x86_32::dr7
llvm::support::ulittle32_t dr7
Definition: RegisterContextMinidump_x86_32.h:69
lldb_private::minidump::MinidumpFloatingSaveAreaX86::cr0_npx_state
llvm::support::ulittle32_t cr0_npx_state
Definition: RegisterContextMinidump_x86_32.h:54
lldb_private::minidump::MinidumpFloatingSaveAreaX86::data_selector
llvm::support::ulittle32_t data_selector
Definition: RegisterContextMinidump_x86_32.h:46
lldb_private::minidump::MinidumpContext_x86_32_Flags::All
@ All
lldb_private::minidump::MinidumpContext_x86_32
Definition: RegisterContextMinidump_x86_32.h:57
lldb_private::minidump::MinidumpContext_x86_32::ecx
llvm::support::ulittle32_t ecx
Definition: RegisterContextMinidump_x86_32.h:88
uint32_t
lldb_private::minidump::MinidumpFloatingSaveAreaX86::register_area
uint8_t register_area[RegisterAreaSize]
Definition: RegisterContextMinidump_x86_32.h:53
lldb_private::minidump::MinidumpContext_x86_32_Flags::FloatingPoint
@ FloatingPoint
lldb_private::minidump::MinidumpContext_x86_32::dr1
llvm::support::ulittle32_t dr1
Definition: RegisterContextMinidump_x86_32.h:65
lldb_private::minidump::MinidumpContext_x86_32::esp
llvm::support::ulittle32_t esp
Definition: RegisterContextMinidump_x86_32.h:97
lldb-x86-register-enums.h
lldb_private::minidump::MinidumpContext_x86_32_Flags::Control
@ Control
lldb_private::minidump::MinidumpContext_x86_32::gs
llvm::support::ulittle32_t gs
Definition: RegisterContextMinidump_x86_32.h:77
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::minidump::MinidumpContext_x86_32::fs
llvm::support::ulittle32_t fs
Definition: RegisterContextMinidump_x86_32.h:78
RegisterContext.h
lldb_private::minidump::MinidumpContext_x86_32_Flags::Integer
@ Integer
lldb_private::minidump::MinidumpFloatingSaveAreaX86
Definition: RegisterContextMinidump_x86_32.h:39
lldb_private::minidump::MinidumpContext_x86_32::ds
llvm::support::ulittle32_t ds
Definition: RegisterContextMinidump_x86_32.h:80