1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//! Owned `CustomDebugInformation` table representation for Portable PDB format.
//!
//! This module provides the [`crate::metadata::tables::customdebuginformation::CustomDebugInformation`] struct that represents
//! a fully resolved `CustomDebugInformation` table entry with all indices converted
//! to actual data for immediate use in debugging scenarios. The owned representation
//! enables direct access to custom debug information without requiring additional
//! heap lookups or index resolution.
//!
//! # Key Components
//!
//! - [`crate::metadata::tables::customdebuginformation::CustomDebugInformation`] - Main struct representing resolved custom debug information
//!
//! # Thread Safety
//!
//! All types in this module are [`Send`] and [`Clone`], enabling safe sharing
//! across threads and efficient copying when needed.
use crate;
use Guid;
/// Owned representation of a `CustomDebugInformation` table entry
///
/// This structure contains the processed `CustomDebugInformation` data with all heap indices
/// resolved to their actual data. Custom debug information provides extensibility for
/// debugging scenarios beyond the standard Portable PDB tables, allowing compilers
/// and tools to store implementation-specific debugging metadata.
///
/// # Custom Debug Information Types
///
/// The Kind field contains a GUID that identifies the specific type of custom debug
/// information. Microsoft compilers define several well-known types:
///
/// ## State Machine Information
/// - **`{6DA9A61E-F8C7-4874-BE62-68BC5630DF71}`**: State Machine Hoisted Local Scopes
/// Associates variables hoisted to state machine fields with their scope information.
///
/// - **`{755F52A8-91C5-45BE-B4B8-209571E552BD}`**: Edit and Continue Local Slot Map
/// Maps local variables to their syntax positions for edit-and-continue debugging.
///
/// - **`{A643004C-0240-496F-A783-30D64F4979DE}`**: Edit and Continue Lambda and Closure Map
/// Maps lambdas and closures to their implementing methods and syntax positions.
///
/// ## Dynamic and Source Information
/// - **`{83C563C4-B4F3-47D5-B824-BA5441477EA8}`**: Dynamic Local Variables (C#)
/// Tracks which System.Object types were originally declared as `dynamic` in source code.
///
/// - **`{58b2eab6-209f-4e4e-a22c-b2d0f910c782}`**: Default Namespace (VB)
/// Stores the default namespace for VB.NET projects/modules.
///
/// - **`{0E8A571B-6926-466E-B4AD-8AB04611F5FE}`**: Embedded Source
/// Contains source code embedded directly in the PDB file.
///
/// - **`{CC110556-A091-4D38-9FEC-25AB9A351A6A}`**: Source Link
/// JSON configuration for retrieving source files from version control systems.
///
/// # Parent Element
///
/// The Parent field identifies which metadata element this custom debug information
/// is associated with. It can reference methods, types, fields, parameters, and many
/// other metadata elements through the `HasCustomDebugInformation` coded index.
///
/// # Usage Examples
///
/// ```rust,ignore
/// use dotscope::metadata::tables::CustomDebugInformation;
/// use dotscope::metadata::customdebuginformation::types::CustomDebugInfo;
///
/// # fn process_custom_debug(custom_debug: &CustomDebugInformation) -> crate::Result<()> {
/// // Example: Processing different types of custom debug information
/// match &custom_debug.value {
/// CustomDebugInfo::SourceLink { document } => {
/// println!("Source Link JSON: {}", document);
/// // Parse JSON to get source server mappings
/// }
/// CustomDebugInfo::EmbeddedSource { filename, content } => {
/// println!("Embedded source file: {}", filename);
/// println!("Content: {} characters", content.len());
/// }
/// CustomDebugInfo::CompilationMetadata { metadata } => {
/// println!("Compilation metadata: {}", metadata);
/// }
/// CustomDebugInfo::Unknown { kind, data } => {
/// println!("Unknown debug info type: {:?}", kind);
/// println!("Raw data: {} bytes", data.len());
/// // Handle custom or unsupported debug information types
/// }
/// }
/// # Ok(())
/// # }
/// ```
///
/// # References
///
/// - [Portable PDB Format - CustomDebugInformation Table](https://github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md#customdebuginformation-table-0x37)
/// - [Custom Debug Information Records](https://github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PortablePdb-Metadata.md#language-specific-custom-debug-information-records)