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
//! Owned `MethodDebugInformation` table representation for Portable PDB format.
//!
//! This module provides the [`MethodDebugInformation`] struct which contains
//! fully resolved method debugging metadata with owned data and resolved heap references.
//! This is the primary data structure for representing Portable PDB method debugging
//! information in a usable form, with parsed sequence points after the dual variant
//! resolution phase.
//!
//! # Architecture
//!
//! The owned representation provides several key advantages over the raw format:
//! - **Memory Independence**: All data is owned and can be used without lifetime constraints
//! - **Resolved References**: Heap indices are resolved to concrete data values
//! - **Structured Access**: Direct field access without additional parsing overhead
//! - **Integration Ready**: Compatible with debugger interfaces and analysis tools
//!
//! # Portable PDB Integration
//!
//! Method debug information is a core component of the Portable PDB format:
//! - **Source Mapping**: Links IL instructions to source code locations
//! - **Document References**: Associates methods with source files
//! - **Debugging Support**: Enables step-through debugging and stack trace resolution
//! - **Tool Compatibility**: Standard format supported by .NET debugging tools
//!
//! # Thread Safety
//!
//! All types in this module are thread-safe for concurrent read access:
//! - [`MethodDebugInformation`] is [`std::marker::Send`] and [`std::marker::Sync`]
//! - All fields contain owned data with no shared mutable state
//! - Instances can be safely shared across threads and accessed concurrently
//! - No synchronization required for read operations
//!
//! # Integration
//!
//! This module integrates with:
//! - [`crate::metadata::tables::methoddebuginformation::raw`] - Raw table representation for parsing
//! - [`crate::metadata::tables::document`] - Document table for source file references
//! - [`crate::metadata::streams`] - Metadata streams for heap data resolution
//! - [`crate::metadata::token`] - Token system for metadata references
use crate;
/// Represents a Portable PDB method debug information entry with fully resolved metadata.
///
/// This structure contains the complete debugging information for a method from the
/// `MethodDebugInformation` metadata table (0x31), with all heap indices resolved to
/// concrete data values. Unlike [`crate::metadata::tables::methoddebuginformation::raw::MethodDebugInformationRaw`],
/// this provides immediate access to structured debug data without requiring additional parsing.
///
/// # Debug Information Structure
///
/// A method debug information entry consists of:
/// - **Document**: Simple index referencing the source document in the Document table
/// - **Sequence Points**: Optional binary data containing IL-to-source mappings
/// - **Metadata Context**: Token and offset information for cross-reference resolution
///
/// # Sequence Points Format
///
/// The sequence points blob contains compressed data that maps IL instruction offsets
/// to source code locations (line/column numbers). This enables debuggers to provide
/// accurate step-through debugging by correlating executable code with source text.
/// The format follows the Portable PDB specification for efficient storage and parsing.
///
/// # Usage Patterns
///
/// ```rust,ignore
/// use dotscope::metadata::tables::methoddebuginformation::owned::MethodDebugInformation;
///
/// # fn process_debug_info(debug_info: &MethodDebugInformation) {
/// // Access document reference
/// if debug_info.document != 0 {
/// println!("Method has source document: {}", debug_info.document);
/// }
///
/// // Process sequence points if available
/// if let Some(sequence_data) = &debug_info.sequence_points {
/// println!("Method has {} bytes of sequence point data", sequence_data.len());
/// }
///
/// // Use token for cross-references
/// println!("Method debug token: {}", debug_info.token);
/// # }
/// ```
///
/// # Thread Safety
///
/// [`MethodDebugInformation`] is [`std::marker::Send`] and [`std::marker::Sync`] as it contains only owned data.
/// Instances can be safely shared across threads and accessed concurrently without synchronization.
///
/// # Reference
/// - [Portable PDB Format - `MethodDebugInformation` Table](https://github.com/dotnet/core/blob/main/Documentation/diagnostics/portable_pdb.md#methoddebuginformation-table-0x31)