code: func trimPath(path, trimPath, searchPath string) string {
  	// Keep path variable intact as it's used below to form the return value.
  	sPath, searchPath := filepath.ToSlash(path), filepath.ToSlash(searchPath)
  	if trimPath == "" {
  		// If the trim path is not configured, try to guess it heuristically:
  		// search for basename of each search path in the original path and, if
  		// found, strip everything up to and including the basename. So, for
  		// example, given original path "/some/remote/path/my-project/foo/bar.c"
  		// and search path "/my/local/path/my-project" the heuristic will return
  		// "/my/local/path/my-project/foo/bar.c".
  		for _, dir := range filepath.SplitList(searchPath) {
  			want := "/" + filepath.Base(dir) + "/"
  			if found := strings.Index(sPath, want); found != -1 {
  				return path[found+len(want):]
  			}
  		}
  	}
  	// Trim configured trim prefixes.
  	trimPaths := append(filepath.SplitList(filepath.ToSlash(trimPath)), "/proc/self/cwd/./", "/proc/self/cwd/")
  	for _, trimPath := range trimPaths {
  		if !strings.HasSuffix(trimPath, "/") {
  			trimPath += "/"
  		}
  		if strings.HasPrefix(sPath, trimPath) {
  			return path[len(trimPath):]
  		}
  	}
  	return path
  }
docs: // trimPath cleans up a path by removing prefixes that are commonly
  // found on profiles plus configured prefixes.
  // TODO(aalexand): Consider optimizing out the redundant work done in this
  // function if it proves to matter.