| 190 | } |
| 191 | |
| 192 | func (ent SinkEntry) fillLoc(skip int) SinkEntry { |
| 193 | // Copied from testing.T |
| 194 | const maxStackLen = 50 |
| 195 | var pc [maxStackLen]uintptr |
| 196 | |
| 197 | // Skip two extra frames to account for this function |
| 198 | // and runtime.Callers itself. |
| 199 | n := runtime.Callers(skip+2, pc[:]) |
| 200 | frames := runtime.CallersFrames(pc[:n]) |
| 201 | for { |
| 202 | frame, more := frames.Next() |
| 203 | _, helper := helpers.Load(frame.Function) |
| 204 | if !helper || !more { |
| 205 | // Found a frame that wasn't a helper function. |
| 206 | // Or we ran out of frames to check. |
| 207 | return ent.fillFromFrame(frame) |
| 208 | } |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | func location(skip int) (file string, line int, fn string) { |
| 213 | pc, file, line, _ := runtime.Caller(skip + 1) |