# std.debug.Coverage.resolveAddressesDwarf: fix broken logic · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/b5398180d6b362346522a6067d54b90b97e23dc2)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: b5398180d6b362346522a6067d54b90b97e23dc2

Requested commit: b5398180d6b362346522a6067d54b90b97e23dc2

Commit: b5398180d6b362346522a6067d54b90b97e23dc2

Tree: 227d414866a1052fd4197bb0b32e74e173300ef9

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
std.debug.Coverage.resolveAddressesDwarf: fix broken logic

The implementation assumed that compilation units did not overlap, which
is not the case. The new implementation uses .debug_ranges to iterate
over the requested PCs.

This partially resolves #20990. The dump-cov tool is fixed but the same
fix needs to be applied to `std.Build.Fuzz.WebServer` (sorting the PC
list before passing it to be resolved by debug info).

I am observing LLVM emit multiple 8-bit counters for the same PC
addresses when enabling `-fsanitize-coverage=inline-8bit-counters`. This
seems like a bug in LLVM. I can't fathom why that would be desireable.

```

## Parents

- [0b5ea2b902b5802786cac70740e93872d2a0973d](https://git.cafe/gitcafe/zig/commit/0b5ea2b902b5802786cac70740e93872d2a0973d?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/b5398180d6b362346522a6067d54b90b97e23dc2?format=markdown)
