code: func (p *Profile) massageMappings() {
  	// Merge adjacent regions with matching names, checking that the offsets match
  	if len(p.Mapping) > 1 {
  		mappings := []*Mapping{p.Mapping[0]}
  		for _, m := range p.Mapping[1:] {
  			lm := mappings[len(mappings)-1]
  			if adjacent(lm, m) {
  				lm.Limit = m.Limit
  				if m.File != "" {
  					lm.File = m.File
  				}
  				if m.BuildID != "" {
  					lm.BuildID = m.BuildID
  				}
  				p.updateLocationMapping(m, lm)
  				continue
  			}
  			mappings = append(mappings, m)
  		}
  		p.Mapping = mappings
  	}
  
  	// Use heuristics to identify main binary and move it to the top of the list of mappings
  	for i, m := range p.Mapping {
  		file := strings.TrimSpace(strings.Replace(m.File, "(deleted)", "", -1))
  		if len(file) == 0 {
  			continue
  		}
  		if len(libRx.FindStringSubmatch(file)) > 0 {
  			continue
  		}
  		if file[0] == '[' {
  			continue
  		}
  		// Swap what we guess is main to position 0.
  		p.Mapping[0], p.Mapping[i] = p.Mapping[i], p.Mapping[0]
  		break
  	}
  
  	// Keep the mapping IDs neatly sorted
  	for i, m := range p.Mapping {
  		m.ID = uint64(i + 1)
  	}
  }
docs: // massageMappings applies heuristic-based changes to the profile
  // mappings to account for quirks of some environments.