Skip to main content

Module sequencepoints

Module sequencepoints 

Expand description

Implementation of sequence points in methods

Sequence Points parsing and access for PortablePDB MethodDebugInformation.

This module provides types and functions to parse and expose sequence points from the PortablePDB format, mapping IL offsets to source code locations for debugging purposes.

§Architecture

Sequence points are stored in the crate::metadata::tables::MethodDebugInformation table as a compressed blob. This module parses the blob and exposes a user-friendly API for accessing sequence point data.

§Key Components

§Usage Examples

use dotscope::metadata::sequencepoints::{parse_sequence_points, SequencePoints};

let blob: &[u8] = &[1, 10, 2, 0, 5];
let points = parse_sequence_points(blob)?;
assert_eq!(points.0.len(), 1);

§Error Handling

Returns crate::Error if the blob is malformed or contains invalid compressed data.

§Thread Safety

All types in this module are Send and Sync because they contain only owned data.

§Integration

This module integrates with:

  • Method debug information tables - for exposing parsed sequence points per method
  • crate::file::parser::Parser - for binary parsing utilities

§Sequence Points Blob Format

The sequence points blob in PortablePDB is a compressed, delta-encoded list of mappings from IL offsets to source code locations. It is stored as a blob in the crate::metadata::tables::MethodDebugInformation table.

§Layout

Each sequence point entry consists of:

  • IL Offset: (compressed unsigned int)
  • Start Line: (compressed unsigned int for first entry, compressed signed int delta for subsequent entries)
  • Start Column: (compressed unsigned int for first entry, compressed signed int delta for subsequent entries)
  • End Line Delta: (compressed unsigned int, added to start line)
  • End Column Delta: (compressed unsigned int, added to start column)

The first entry uses absolute values for start line/col, subsequent entries use deltas. All values are encoded using ECMA-335 compressed integer encoding (see II.23.2).

§Example

For two sequence points:

  • First: il_offset=1, start_line=10, start_col=2, end_line_delta=0, end_col_delta=5
  • Second: il_offset_delta=2, start_line_delta=1, start_col_delta=1, end_line_delta=0, end_col_delta=2

Encoded as:

[1, 10, 2, 0, 5, 4, 2, 2, 0, 2]

Where 4 is the compressed int for delta 2, and 2 is the compressed int for delta 1.

§Hidden Sequence Points

A sequence point is considered hidden if its start line is 0xFEEFEE. This is used to mark compiler-generated or non-user code. The value 0xFEEFEE is encoded as a compressed unsigned int: [0xC0, 0xFE, 0xEF, 0xEE].

§References

Structs§

SequencePoint
Represents a single sequence point mapping IL offset to source code location.
SequencePoints
Collection of sequence points for a method.

Constants§

HIDDEN_SEQUENCE_POINT_LINE
The magic line number that indicates a hidden sequence point. This value (0xFEEFEE) is used by .NET compilers to mark compiler-generated or non-user code that should not be shown in debuggers.

Functions§

parse_sequence_points
Parses a PortablePDB sequence points blob into a SequencePoints collection.