| author | |
| committer | |
| log | 8dae629c4f89155b6945ee952ee2aeb5bfa1d271 |
| tree | 481c61cda9711fbded6f52442c3ac95f42c3084c |
| parent | 529df8c0075a1a91860523ed33c475473d332ae3 |
2 files changed, 10 insertions(+), 2 deletions(-)
lib/std/Build/Fuzz/WebServer.zig+5-1| ... | ... | @@ -649,7 +649,11 @@ fn addEntryPoint(ws: *WebServer, coverage_id: u64, addr: u64) error{ AlreadyRepo |
| 649 | 649 | const ptr = coverage_map.mapped_memory; |
| 650 | 650 | const pcs_bytes = ptr[@sizeOf(abi.SeenPcsHeader)..][0 .. coverage_map.source_locations.len * @sizeOf(usize)]; |
| 651 | 651 | const pcs: []const usize = @alignCast(std.mem.bytesAsSlice(usize, pcs_bytes)); |
| 652 | const index = std.sort.upperBound(usize, addr, pcs, {}, std.sort.asc(usize)); | |
| 652 | const index = std.sort.upperBound(usize, pcs, addr, struct { | |
| 653 | fn order(context: usize, item: usize) std.math.Order { | |
| 654 | return std.math.order(item, context); | |
| 655 | } | |
| 656 | }.order); | |
| 653 | 657 | if (index >= pcs.len) { |
| 654 | 658 | log.err("unable to find unit test entry address 0x{x} in source locations (range: 0x{x} to 0x{x})", .{ |
| 655 | 659 | addr, pcs[0], pcs[pcs.len - 1], |
lib/std/debug/Dwarf.zig+5-1| ... | ... | @@ -157,7 +157,11 @@ pub const CompileUnit = struct { |
| 157 | 157 | }; |
| 158 | 158 | |
| 159 | 159 | pub fn findSource(slc: *const SrcLocCache, address: u64) !LineEntry { |
| 160 | const index = std.sort.upperBound(u64, address, slc.line_table.keys(), {}, std.sort.asc(u64)); | |
| 160 | const index = std.sort.upperBound(u64, slc.line_table.keys(), address, struct { | |
| 161 | fn order(context: u64, item: u64) std.math.Order { | |
| 162 | return std.math.order(item, context); | |
| 163 | } | |
| 164 | }.order); | |
| 161 | 165 | if (index == 0) return missing(); |
| 162 | 166 | return slc.line_table.values()[index - 1]; |
| 163 | 167 | } |