diff options
| author | Austin Clements <austin@google.com> | 2023-02-06 14:13:54 -0500 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2023-03-10 17:18:31 +0000 |
| commit | 59d0de16e4f003e69403eeee969f0b4a96dd6dcb (patch) | |
| tree | 28227a7daf7ac0ef65e169befff632276e8ed77c /src/runtime/stack_test.go | |
| parent | d829b626812cfe9ee53cb71ccdd75d3fa0eda265 (diff) | |
| download | go-59d0de16e4f003e69403eeee969f0b4a96dd6dcb.tar.xz | |
runtime: add tests of printing inlined frames in tracebacks
We're about to rewrite this code and it has almost no test coverage
right now.
This test is also more complete than the existing
TestTracebackInlineExcluded, so we delete that test.
For #54466.
Change-Id: I144154282dac5eb3798f7d332b806f44c4a0bdf6
Reviewed-on: https://go-review.googlesource.com/c/go/+/466098
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/stack_test.go')
| -rw-r--r-- | src/runtime/stack_test.go | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/src/runtime/stack_test.go b/src/runtime/stack_test.go index 92d58803fc..24f8290f67 100644 --- a/src/runtime/stack_test.go +++ b/src/runtime/stack_test.go @@ -897,43 +897,3 @@ func deferHeapAndStack(n int) (r int) { // Pass a value to escapeMe to force it to escape. var escapeMe = func(x any) {} - -// Test that when F -> G is inlined and F is excluded from stack -// traces, G still appears. -func TestTracebackInlineExcluded(t *testing.T) { - defer func() { - recover() - buf := make([]byte, 4<<10) - stk := string(buf[:Stack(buf, false)]) - - t.Log(stk) - - if not := "tracebackExcluded"; strings.Contains(stk, not) { - t.Errorf("found but did not expect %q", not) - } - if want := "tracebackNotExcluded"; !strings.Contains(stk, want) { - t.Errorf("expected %q in stack", want) - } - }() - tracebackExcluded() -} - -// tracebackExcluded should be excluded from tracebacks. There are -// various ways this could come up. Linking it to a "runtime." name is -// rather synthetic, but it's easy and reliable. See issue #42754 for -// one way this happened in real code. -// -//go:linkname tracebackExcluded runtime.tracebackExcluded -//go:noinline -func tracebackExcluded() { - // Call an inlined function that should not itself be excluded - // from tracebacks. - tracebackNotExcluded() -} - -// tracebackNotExcluded should be inlined into tracebackExcluded, but -// should not itself be excluded from the traceback. -func tracebackNotExcluded() { - var x *int - *x = 0 -} |
