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

Function TestAddr2LinerLookup

internal/binutils/binutils_test.go:125–232  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

123}
124
125func TestAddr2LinerLookup(t *testing.T) {
126 for _, tc := range []struct {
127 desc string
128 nmOutput string
129 wantSymbolized map[uint64]string
130 wantUnsymbolized []uint64
131 }{
132 {
133 desc: "odd symbol count",
134 nmOutput: `
1350x1000 T 1000 100
1360x2000 T 2000 120
1370x3000 T 3000 130
138`,
139 wantSymbolized: map[uint64]string{
140 0x1000: "0x1000",
141 0x1001: "0x1000",
142 0x1FFF: "0x1000",
143 0x2000: "0x2000",
144 0x2001: "0x2000",
145 0x3000: "0x3000",
146 0x312f: "0x3000",
147 },
148 wantUnsymbolized: []uint64{0x0fff, 0x3130},
149 },
150 {
151 desc: "even symbol count",
152 nmOutput: `
1530x1000 T 1000 100
1540x2000 T 2000 120
1550x3000 T 3000 130
1560x4000 T 4000 140
157`,
158 wantSymbolized: map[uint64]string{
159 0x1000: "0x1000",
160 0x1001: "0x1000",
161 0x1FFF: "0x1000",
162 0x2000: "0x2000",
163 0x2fff: "0x2000",
164 0x3000: "0x3000",
165 0x3fff: "0x3000",
166 0x4000: "0x4000",
167 0x413f: "0x4000",
168 },
169 wantUnsymbolized: []uint64{0x0fff, 0x4140},
170 },
171 {
172 desc: "different symbol types",
173 nmOutput: `
174absolute_0x100 a 100
175absolute_0x200 A 200
176text_0x1000 t 1000 100
177bss_0x2000 b 2000 120
178data_0x3000 d 3000 130
179rodata_0x4000 r 4000 140
180weak_0x5000 v 5000 150
181text_0x6000 T 6000 160
182bss_0x7000 B 7000 170

Callers

nothing calls this directly

Calls 3

parseAddr2LinerNMFunction · 0.85
checkAddressFunction · 0.85
addrInfoMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…