proc,service,terminal: information about stack trace truncation

Add a flag to Stackframe that indicates where the stack frame is the
bottom-most frame of the stack. This allows clients to know whether the
stack trace terminated normally or if it was truncated because the
maximum depth was reached.
Add a truncation message to the 'stack' command.
This commit is contained in:
aarzilli
2018-08-18 12:12:39 +02:00
committed by Derek Parker
parent b8e80746e5
commit ac74944d53
6 changed files with 33 additions and 3 deletions

View File

@ -224,7 +224,7 @@ func TestExecuteFile(t *testing.T) {
func TestIssue354(t *testing.T) {
printStack([]api.Stackframe{}, "", false)
printStack([]api.Stackframe{{api.Location{PC: 0, File: "irrelevant.go", Line: 10, Function: nil}, nil, nil, 0, 0, nil, ""}}, "", false)
printStack([]api.Stackframe{{api.Location{PC: 0, File: "irrelevant.go", Line: 10, Function: nil}, nil, nil, 0, 0, nil, true, ""}}, "", false)
}
func TestIssue411(t *testing.T) {
@ -827,3 +827,20 @@ func TestOptimizationCheck(t *testing.T) {
})
}
}
func TestTruncateStacktrace(t *testing.T) {
withTestTerminal("stacktraceprog", t, func(term *FakeTerminal) {
term.MustExec("break main.stacktraceme")
term.MustExec("continue")
out1 := term.MustExec("stack")
t.Logf("untruncated output %q", out1)
if strings.Contains(out1, stacktraceTruncatedMessage) {
t.Fatalf("stacktrace was truncated")
}
out2 := term.MustExec("stack 1")
t.Logf("truncated output %q", out2)
if !strings.Contains(out2, stacktraceTruncatedMessage) {
t.Fatalf("stacktrace was not truncated")
}
})
}