printStack prints to w a multi-line report containing a formatting of the call stack stk, with each line preceded by the marker for h.
(w Writer, h uint64, stk []uintptr)
| 503 | // printStack prints to w a multi-line report containing a formatting of the call stack stk, |
| 504 | // with each line preceded by the marker for h. |
| 505 | func printStack(w Writer, h uint64, stk []uintptr) error { |
| 506 | buf := make([]byte, 0, 2048) |
| 507 | |
| 508 | var prefixBuf [100]byte |
| 509 | prefix := AppendMarker(prefixBuf[:0], h) |
| 510 | |
| 511 | frames := runtime.CallersFrames(stk) |
| 512 | for { |
| 513 | f, more := frames.Next() |
| 514 | buf = append(buf, prefix...) |
| 515 | buf = append(buf, f.Func.Name()...) |
| 516 | buf = append(buf, "()\n"...) |
| 517 | buf = append(buf, prefix...) |
| 518 | buf = append(buf, '\t') |
| 519 | buf = appendFileLine(buf, f.File, f.Line) |
| 520 | buf = append(buf, '\n') |
| 521 | if !more { |
| 522 | break |
| 523 | } |
| 524 | } |
| 525 | buf = append(buf, prefix...) |
| 526 | buf = append(buf, '\n') |
| 527 | _, err := w.Write(buf) |
| 528 | return err |
| 529 | } |
| 530 | |
| 531 | // Marker returns the match marker text to use on any line reporting details |
| 532 | // about a match of the given ID. |
no test coverage detected
searching dependent graphs…