MCPcopy Create free account
hub / github.com/google/pprof / SourceLine

Method SourceLine

internal/driver/driver_test.go:1683–1731  ·  view source on GitHub ↗

SourceLine reports the source line information for a given address in the file. Due to inlining, the source line information is in general a list of positions representing a call stack, with the leaf function first.

(addr uint64)

Source from the content-addressed store, hash-verified

1681// is in general a list of positions representing a call stack,
1682// with the leaf function first.
1683func (*mockFile) SourceLine(addr uint64) ([]plugin.Frame, error) {
1684 // Return enough data to support the SourceLine() calls needed for
1685 // weblist on cpuProfile() contents.
1686 frame := func(fn, file string, num int) plugin.Frame {
1687 // Reuse the same num for line number and column number.
1688 return plugin.Frame{Func: fn, File: file, Line: num, Column: num}
1689 }
1690 switch addr {
1691 case 0x1000:
1692 return []plugin.Frame{
1693 frame("mangled1000", "testdata/file1000.src", 1),
1694 }, nil
1695 case 0x1001:
1696 return []plugin.Frame{
1697 frame("mangled1000", "testdata/file1000.src", 1),
1698 }, nil
1699 case 0x1002:
1700 return []plugin.Frame{
1701 frame("mangled1000", "testdata/file1000.src", 2),
1702 }, nil
1703 case 0x1003:
1704 return []plugin.Frame{
1705 frame("mangled1000", "testdata/file1000.src", 1),
1706 }, nil
1707 case 0x2000:
1708 return []plugin.Frame{
1709 frame("mangled2001", "testdata/file2000.src", 9),
1710 frame("mangled2000", "testdata/file2000.src", 4),
1711 }, nil
1712 case 0x3000:
1713 return []plugin.Frame{
1714 frame("mangled3002", "testdata/file3000.src", 2),
1715 frame("mangled3001", "testdata/file3000.src", 5),
1716 frame("mangled3000", "testdata/file3000.src", 6),
1717 }, nil
1718 case 0x3001:
1719 return []plugin.Frame{
1720 frame("mangled3001", "testdata/file3000.src", 8),
1721 frame("mangled3000", "testdata/file3000.src", 9),
1722 }, nil
1723 case 0x3002:
1724 return []plugin.Frame{
1725 frame("mangled3002", "testdata/file3000.src", 5),
1726 frame("mangled3000", "testdata/file3000.src", 9),
1727 }, nil
1728 }
1729
1730 return nil, nil
1731}
1732
1733// Symbols returns a list of symbols in the object file.
1734// If r is not nil, Symbols restricts the list to symbols

Callers

nothing calls this directly

Calls 1

frameFunction · 0.85

Tested by

no test coverage detected