collectMappingSources saves the mapping sources of a profile.
(p *profile.Profile, source string)
| 361 | |
| 362 | // collectMappingSources saves the mapping sources of a profile. |
| 363 | func collectMappingSources(p *profile.Profile, source string) plugin.MappingSources { |
| 364 | ms := plugin.MappingSources{} |
| 365 | for _, m := range p.Mapping { |
| 366 | src := struct { |
| 367 | Source string |
| 368 | Start uint64 |
| 369 | }{ |
| 370 | source, m.Start, |
| 371 | } |
| 372 | key := m.BuildID |
| 373 | if key == "" { |
| 374 | key = m.File |
| 375 | } |
| 376 | if key == "" { |
| 377 | // If there is no build id or source file, use the source as the |
| 378 | // mapping file. This will enable remote symbolization for this |
| 379 | // mapping, in particular for Go profiles on the legacy format. |
| 380 | // The source is reset back to empty string by unsourceMapping |
| 381 | // which is called after symbolization is finished. |
| 382 | m.File = source |
| 383 | key = source |
| 384 | } |
| 385 | ms[key] = append(ms[key], src) |
| 386 | } |
| 387 | return ms |
| 388 | } |
| 389 | |
| 390 | // unsourceMappings iterates over the mappings in a profile and replaces file |
| 391 | // set to the remote source URL by collectMappingSources back to empty string. |
no outgoing calls
searching dependent graphs…