| ... | ... | @@ -145,6 +145,7 @@ pub const ResolveAddressesDwarfError = Dwarf.ScanError; |
| 145 | 145 | pub fn resolveAddressesDwarf( |
| 146 | 146 | cov: *Coverage, |
| 147 | 147 | gpa: Allocator, |
| 148 | /// Asserts the addresses are in ascending order. |
| 148 | 149 | sorted_pc_addrs: []const u64, |
| 149 | 150 | /// Asserts its length equals length of `sorted_pc_addrs`. |
| 150 | 151 | output: []SourceLocation, |
| ... | ... | @@ -156,11 +157,15 @@ pub fn resolveAddressesDwarf( |
| 156 | 157 | var range_i: usize = 0; |
| 157 | 158 | var range: *std.debug.Dwarf.Range = &d.ranges.items[0]; |
| 158 | 159 | var line_table_i: usize = undefined; |
| 160 | var prev_pc: u64 = 0; |
| 159 | 161 | var prev_cu: ?*std.debug.Dwarf.CompileUnit = null; |
| 160 | 162 | // Protects directories and files tables from other threads. |
| 161 | 163 | cov.mutex.lock(); |
| 162 | 164 | defer cov.mutex.unlock(); |
| 163 | 165 | next_pc: for (sorted_pc_addrs, output) |pc, *out| { |
| 166 | assert(pc >= prev_pc); |
| 167 | prev_pc = pc; |
| 168 | |
| 164 | 169 | while (pc >= range.end) { |
| 165 | 170 | range_i += 1; |
| 166 | 171 | if (range_i >= d.ranges.items.len) { |