MCPcopy Create free account
hub / github.com/google/gapid / Entries

Method Entries

core/fault/stacktrace/stacktrace.go:66–98  ·  view source on GitHub ↗

Entries returns all the entries for the stack trace.

()

Source from the content-addressed store, hash-verified

64
65// Entries returns all the entries for the stack trace.
66func (c Callstack) Entries() []Entry {
67 frames := runtime.CallersFrames([]uintptr(c))
68 out := []Entry{}
69 for {
70 frame, more := frames.Next()
71 dir, file := path.Split(frame.File)
72 fullname := frame.Function
73 var pkg, name string
74 if i := strings.LastIndex(fullname, "/"); i > 0 {
75 i += strings.IndexRune(fullname[i+1:], '.')
76 // name is of the form github.com/google/gapid/framework/log.StacktraceOnError
77 // we find the last /, then find the next . to split the function name from the package name
78 pkg, name = fullname[:i+1], fullname[i+2:]
79 }
80 out = append(out, Entry{
81 Location: Location{
82 Directory: dir,
83 File: file,
84 Line: frame.Line,
85 },
86 Function: Function{
87 Package: pkg,
88 Name: name,
89 },
90 PC: frame.PC,
91 })
92 if !more {
93 break
94 }
95 }
96
97 return out
98}
99
100func (c Callstack) String() string {
101 entries := c.Entries()

Callers 7

FilterMethod · 0.95
StringMethod · 0.95
TestDictionaryFunction · 0.80
TestCaptureFunction · 0.80
TestReferencesFunction · 0.80
TestCloneReferencesFunction · 0.80
unpackMapWithAllocatorFunction · 0.80

Calls 2

NextMethod · 0.65
SplitMethod · 0.45

Tested by 4

TestDictionaryFunction · 0.64
TestCaptureFunction · 0.64
TestReferencesFunction · 0.64
TestCloneReferencesFunction · 0.64