MCPcopy Index your code
hub / github.com/rabbitstack/fibratus / FinalUserFrame

Method FinalUserFrame

pkg/callstack/callstack.go:212–234  ·  view source on GitHub ↗

FinalUserFrame returns the final frame that corresponds to the user code execution. That usually translates to the last frame before ntdll or kernel32 modules.

()

Source from the content-addressed store, hash-verified

210// to the user code execution. That usually translates to
211// the last frame before ntdll or kernel32 modules.
212func (s *Callstack) FinalUserFrame() *Frame {
213 if s.IsEmpty() {
214 return nil
215 }
216
217 var n int
218 for n = s.Depth() - 1; n > 0; n-- {
219 f := (*s)[n]
220 if f.Addr.InSystemRange() {
221 continue
222 }
223 mod := filepath.Base(strings.ToLower(f.Module))
224 if mod != "ntdll.dll" && mod != "kernel32.dll" && mod != "kernelbase.dll" {
225 break
226 }
227 }
228
229 if n >= 0 && n < s.Depth()-1 {
230 return &(*s)[n]
231 }
232
233 return nil
234}
235
236// FinalUserspaceFrame returns the final userspace frame. This
237// frame is typically backed by the ntdll module.

Callers 3

TestCallstackFunction · 0.95
GetMethod · 0.80

Calls 3

IsEmptyMethod · 0.95
DepthMethod · 0.95
InSystemRangeMethod · 0.80

Tested by 2

TestCallstackFunction · 0.76