| ... | ... | @@ -372,18 +372,20 @@ fn printSourceAtAddressWindows(di: *DebugInfo, out_stream: var, relocated_addres |
| 372 | 372 | const frag_vaddr_start = coff_section.header.virtual_address + line_hdr.RelocOffset; |
| 373 | 373 | const frag_vaddr_end = frag_vaddr_start + line_hdr.CodeSize; |
| 374 | 374 | |
| 375 | | // There is an unknown number of LineBlockFragmentHeaders (and their accompanying line and column records) |
| 376 | | // from now on. We will iterate through them, and eventually find a LineInfo that we're interested in, |
| 377 | | // breaking out to :subsections. If not, we will make sure to not read anything outside of this subsection. |
| 378 | | const subsection_end_index = sect_offset + subsect_hdr.Length; |
| 379 | | while (line_index < subsection_end_index) { |
| 380 | | const block_hdr = @ptrCast(*pdb.LineBlockFragmentHeader, &subsect_info[line_index]); |
| 381 | | line_index += @sizeOf(pdb.LineBlockFragmentHeader); |
| 382 | | const start_line_index = line_index; |
| 383 | | |
| 384 | | const has_column = line_hdr.Flags.LF_HaveColumns; |
| 385 | | |
| 386 | | if (relative_address >= frag_vaddr_start and relative_address < frag_vaddr_end) { |
| 375 | if (relative_address >= frag_vaddr_start and relative_address < frag_vaddr_end) { |
| 376 | // There is an unknown number of LineBlockFragmentHeaders (and their accompanying line and column records) |
| 377 | // from now on. We will iterate through them, and eventually find a LineInfo that we're interested in, |
| 378 | // breaking out to :subsections. If not, we will make sure to not read anything outside of this subsection. |
| 379 | |
| 380 | const subsection_end_index = sect_offset + subsect_hdr.Length; |
| 381 | |
| 382 | while (line_index < subsection_end_index) { |
| 383 | const block_hdr = @ptrCast(*pdb.LineBlockFragmentHeader, &subsect_info[line_index]); |
| 384 | line_index += @sizeOf(pdb.LineBlockFragmentHeader); |
| 385 | const start_line_index = line_index; |
| 386 | |
| 387 | const has_column = line_hdr.Flags.LF_HaveColumns; |
| 388 | |
| 387 | 389 | // All line entries are stored inside their line block by ascending start address. |
| 388 | 390 | // Heuristic: we want to find the last line entry that has a vaddr_start <= relative_address. |
| 389 | 391 | // This is done with a simple linear search. |
| ... | ... | @@ -427,11 +429,11 @@ fn printSourceAtAddressWindows(di: *DebugInfo, out_stream: var, relocated_addres |
| 427 | 429 | }; |
| 428 | 430 | } |
| 429 | 431 | } |
| 430 | | } |
| 431 | 432 | |
| 432 | | // Checking that we are not reading garbage after the (possibly) multiple block fragments. |
| 433 | | if (line_index != subsection_end_index) { |
| 434 | | return error.InvalidDebugInfo; |
| 433 | // Checking that we are not reading garbage after the (possibly) multiple block fragments. |
| 434 | if (line_index != subsection_end_index) { |
| 435 | return error.InvalidDebugInfo; |
| 436 | } |
| 435 | 437 | } |
| 436 | 438 | }, |
| 437 | 439 | else => {}, |