1use std::mem;
11
12use crate::{util::CStr, Pod};
13
14use super::Ptr;
15
16#[derive(Debug)]
20#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
21#[repr(C)]
22pub struct TypeDescriptor {
23 pub vftable: Ptr,
25 pub spare: Ptr<CStr>,
27 #[cfg_attr(feature = "serde", serde(skip))]
29 pub name: [u8; 0],
30}
31
32#[derive(Copy, Clone, Debug)]
34#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
35#[repr(C)]
36pub struct PMD {
37 pub mdisp: i32,
39 pub pdisp: i32,
41 pub vdisp: i32,
43}
44
45#[derive(Copy, Clone, Debug)]
49#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
50#[repr(C)]
51pub struct FuncInfo {
52 pub magic_number: u32,
58 pub max_state: i32,
60 pub unwind_map: Ptr,
62 pub try_blocks: u32,
64 pub try_block_map: Ptr<UnwindMapEntry>,
66 pub ip_map_entries: u32,
67 pub ip_to_state_map: Ptr,
68 pub es_type_list: Ptr<ESTypeList>,
70 pub eh_flags: i32,
72}
73
74#[derive(Copy, Clone, Debug)]
75#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
76#[repr(C)]
77pub struct UnwindMapEntry {
78 pub to_state: i32,
80 pub action: Ptr,
84}
85
86#[derive(Copy, Clone, Debug)]
90#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
91#[repr(C)]
92pub struct TryBlockMapEntry {
93 pub try_low: i32,
95 pub try_high: i32,
96 pub catch_high: i32,
98 pub catches: i32,
100 pub handler_array: Ptr<[HandlerType]>,
102}
103
104#[derive(Copy, Clone, Debug)]
108#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
109#[repr(C)]
110pub struct HandlerType {
111 pub adjectives: u32,
115 pub ty: Ptr<TypeDescriptor>,
117 pub disp_catch_obj: i32,
119 pub address_of_handler: Ptr,
123}
124
125#[derive(Copy, Clone, Debug)]
127#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
128#[repr(C)]
129pub struct ESTypeList {
130 pub count: i32,
132 pub type_array: Ptr<[HandlerType]>,
134}
135
136#[derive(Copy, Clone, Debug)]
139#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
140#[repr(C)]
141pub struct ThrowInfo {
142 pub attributes: u32,
145 pub unwind: Ptr,
149 pub forward_compat: Ptr,
153 pub catchable_type_array: Ptr<CatchableTypeArray>,
155}
156
157#[derive(Debug)]
158#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
159#[repr(C)]
160pub struct CatchableTypeArray {
161 pub catchable_types: i32,
163 #[cfg_attr(feature = "serde", serde(skip))]
165 pub array: [Ptr<CatchableType>; 0],
166}
167
168#[derive(Copy, Clone, Debug)]
170#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
171#[repr(C)]
172pub struct CatchableType {
173 pub properties: u32,
177 pub type_descriptor: Ptr<TypeDescriptor>,
179 pub pmd: PMD,
181 pub size_or_offset: i32,
183 pub copy_function: Ptr,
185}
186
187#[derive(Copy, Clone, Debug)]
196#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
197#[repr(C)]
198pub struct RTTICompleteObjectLocator {
199 pub signature: u32,
201 pub offset: u32,
203 pub cd_offset: u32,
205 pub type_descriptor: Ptr<TypeDescriptor>,
207 pub class_descriptor: Ptr<RTTIClassHierarchyDescriptor>,
209}
210
211#[derive(Copy, Clone, Debug)]
215#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
216#[repr(C)]
217pub struct RTTIClassHierarchyDescriptor {
218 pub signature: u32,
220 pub attributes: u32,
222 pub num_base_classes: u32,
224 pub base_class_array: Ptr<[Ptr<RTTIBaseClassDescriptor>]>,
226}
227
228#[derive(Copy, Clone, Debug)]
230#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
231#[repr(C)]
232pub struct RTTIBaseClassDescriptor {
233 pub type_descriptor: Ptr<TypeDescriptor>,
235 pub num_contained_bases: u32,
237 pub pmd: PMD,
239 pub attributes: u32,
241}
242
243unsafe impl Pod for TypeDescriptor {}
246unsafe impl Pod for PMD {}
247unsafe impl Pod for FuncInfo {}
248unsafe impl Pod for UnwindMapEntry {}
249unsafe impl Pod for TryBlockMapEntry {}
250unsafe impl Pod for HandlerType {}
251unsafe impl Pod for ESTypeList {}
252unsafe impl Pod for ThrowInfo {}
253unsafe impl Pod for CatchableTypeArray {}
254unsafe impl Pod for CatchableType {}
255unsafe impl Pod for RTTICompleteObjectLocator {}
256unsafe impl Pod for RTTIClassHierarchyDescriptor {}
257unsafe impl Pod for RTTIBaseClassDescriptor {}
258
259const _: [(); 8] = [(); mem::size_of::<TypeDescriptor>()]; const _: [(); 12] = [(); mem::size_of::<PMD>()];
263const _: [(); 36] = [(); mem::size_of::<FuncInfo>()];
264const _: [(); 8] = [(); mem::size_of::<UnwindMapEntry>()];
265const _: [(); 20] = [(); mem::size_of::<TryBlockMapEntry>()];
266const _: [(); 16] = [(); mem::size_of::<HandlerType>()];
267const _: [(); 8] = [(); mem::size_of::<ESTypeList>()];
268const _: [(); 16] = [(); mem::size_of::<ThrowInfo>()];
269const _: [(); 4] = [(); mem::size_of::<CatchableTypeArray>()]; const _: [(); 28] = [(); mem::size_of::<CatchableType>()];
271const _: [(); 20] = [(); mem::size_of::<RTTICompleteObjectLocator>()];
272const _: [(); 16] = [(); mem::size_of::<RTTIClassHierarchyDescriptor>()];
273const _: [(); 24] = [(); mem::size_of::<RTTIBaseClassDescriptor>()];