Skip to content

Commit d3583b8

Browse files
authored
Fix source_file bug in mono_ppdb_lookup_location_internal (#97392)
document-records affect sequence points that follow in the byte stream, not points previously read. When reading the document-record we may already be at the target offset. Do not update docname local if we have reached the end target already otherwise the wrong source_file will be reported for the requested offset
1 parent 96dd3d1 commit d3583b8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/mono/mono/metadata/debug-mono-ppdb.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,10 @@ mono_ppdb_lookup_location_internal (MonoImage *image, int idx, uint32_t offset,
409409
if (!first && delta_il == 0) {
410410
/* document-record */
411411
docidx = mono_metadata_decode_value (ptr, &ptr);
412-
docname = get_docname (ppdb, image, docidx);
412+
// check the current iloffset to ensure that we do not update docname after the target
413+
// offset has been reached (the updated docname will be for the next sequence point)
414+
if (iloffset < offset)
415+
docname = get_docname (ppdb, image, docidx);
413416
continue;
414417
}
415418
if (!first && iloffset + delta_il > offset)

0 commit comments

Comments
 (0)