func (ss dataSegments) findSegment(addr uint64) (dataSegment, bool) {
	k := sort.Search(len(ss), func(k int) bool {
		return addr < ss[k].addr
	})
	k--
	if k >= 0 && ss[k].contains(addr) {
		return ss[k], true
	}
	return dataSegment{}, false
}
findSegment finds the segment that contains the given address.
package corefile
import (
	"fmt"
	"sort"
)
type dataSegment struct {
	addr uint64
	data []byte  
}
func (s dataSegment) String() string {
	return fmt.Sprintf("dataSegment{addr: 0x%x, size: 0x%x}", s.addr, s.size())
}
func (s dataSegment) contains(addr uint64) bool {
	return s.addr <= addr && addr < s.addr+s.size()
}
func (s dataSegment) containsRange(addr, size uint64) bool {
	return s.contains(addr) && (size == 0 || s.contains(addr+size-1))
}
func (s dataSegment) size() uint64 {
	return uint64(len(s.data))
}
func (s dataSegment) slice(addr, size uint64) (dataSegment, bool) {
	offset := addr - s.addr
	if offset > s.size() || offset+size > s.size() {
		return dataSegment{}, false
	}
	return dataSegment{
		addr: addr,
		data: s.data[offset : offset+size : offset+size],
	}, true
}
func (s dataSegment) suffix(addr uint64) (dataSegment, bool) {
	return s.slice(addr, s.size()-(addr-s.addr))
}
type dataSegments []dataSegment
func (ss dataSegments) Len() int           { return len(ss) }
func (ss dataSegments) Swap(i, k int)      { ss[i], ss[k] = ss[k], ss[i] }
func (ss dataSegments) Less(i, k int) bool { return ss[i].addr < ss[k].addr }