mirror of
https://github.com/go-delve/delve.git
synced 2025-10-27 20:23:41 +08:00
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:
@ -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")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user