Fix md_parse_sequence_points document and rolling value bugs#68
Conversation
aa2eb84 to
d65ed1a
Compare
|
Updated: The force-pushed commit now fixes a second bug in the same function — the |
There was a problem hiding this comment.
Pull request overview
Fixes Portable PDB SequencePoints parsing so md_parse_sequence_points() correctly sets the initial document cursor from the MethodDebugInformation.Document column (the common single-document case), aligning behavior with the Portable PDB spec.
Changes:
- Set
sequence_points->documentfrom the non-nullMethodDebugInformation.Documentcolumn; only readInitialDocumentfrom the blob when the column is null. - Accumulate delta-encoded ILOffset/StartLine/StartColumn into rolling (absolute) values for output records.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Two bugs in sequence point parsing:
1. When the MethodDebugInformation row has a non-null Document
column (the common case for single-document methods), the parser
read the cursor into a local variable but never copied it to
sequence_points->document. The field was left at an invalid row-0
default, causing callers to fail when resolving the document name.
2. The rolling_il_offset, rolling_start_line, and rolling_start_column
fields were not accumulated. The Portable PDB spec delta-encodes
these values (absolute for the first record, signed deltas for
subsequent records), but the parser stored raw deltas instead of
running sums. This caused incorrect source locations for any
sequence point after the first.
Fix both by:
- Copying the Document column cursor directly when non-null.
- Maintaining running accumulators for IL offset, start line,
and start column across records.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
d65ed1a to
4fc99a4
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@jkoritzinsky I'm going to commit this to unblock myself. If this doesn't make sense to you, we can revert and put up a proper fix. We should do some brain storming on testing shortly though. |
|
Yeah we don't have a good testing story for the portable PDB blob formats at the moment. |
Problem
Two bugs in
md_parse_sequence_points():Bug 1: Document cursor not set from row column
When the
MethodDebugInformationrow has a non-nullDocumentcolumn (the common case for single-document methods), the parser reads it into a localdocumentcursor but never copies it tosequence_points->document. The field is left at the invalid row-0 default fromcreate_cursor(&cxt->tables[mdtid_Document], 0), causing callers that try to resolve the document name to fail.Bug 2: Rolling values not accumulated
The
rolling_il_offset,rolling_start_line, androlling_start_columnfields store raw blob values instead of accumulated running sums. The Portable PDB spec delta-encodes these values — the first record is absolute, subsequent records are signed deltas from the previous — but the parser stored the raw deltas. This caused incorrect source locations for any sequence point after the first in a method.Example: A method starting at line 69 with sequence points at lines 69, 70, 71 would instead report lines 69, 1, 1 (the raw deltas).
Fix
sequence_points->document.running_il,running_line, andrunning_colaccumulators across the record loop.