Skip to content

Commit

Permalink
Fix source_file bug in mono_ppdb_lookup_location_internal (#97392)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bholmes committed Jan 24, 2024
1 parent 96dd3d1 commit d3583b8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/mono/mono/metadata/debug-mono-ppdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,10 @@ mono_ppdb_lookup_location_internal (MonoImage *image, int idx, uint32_t offset,
if (!first && delta_il == 0) {
/* document-record */
docidx = mono_metadata_decode_value (ptr, &ptr);
docname = get_docname (ppdb, image, docidx);
// check the current iloffset to ensure that we do not update docname after the target
// offset has been reached (the updated docname will be for the next sequence point)
if (iloffset < offset)
docname = get_docname (ppdb, image, docidx);
continue;
}
if (!first && iloffset + delta_il > offset)
Expand Down

0 comments on commit d3583b8

Please sign in to comment.