profile: Don't try to be clever in SharedImage::ContainsAddress().

The data section could theoretically be before the text section,
but it also may not exist and have a size of 0. The commpage
image is one such image with those qualities, and so we
would thus always find it as having a hit when encountering it
in the list.

And since data_size might be 0, just do < instead of <= and -1.

This massively fixes the profiler's output.
This commit is contained in:
Augustin Cavalier
2024-07-17 12:47:07 -04:00
parent 43f2492813
commit ed79e85ae0
+2 -2
View File
@@ -106,8 +106,8 @@ SharedImage::SymbolCount() const
bool
SharedImage::ContainsAddress(addr_t address) const
{
return address >= (addr_t)fInfo.text
&& address <= (addr_t)fInfo.data + fInfo.data_size - 1;
return (address >= (addr_t)fInfo.text && address < ((addr_t)fInfo.text + fInfo.text_size))
|| (address >= (addr_t)fInfo.data && address < ((addr_t)fInfo.data + fInfo.data_size));
}