FinalUserspaceFrame returns the final userspace frame. This frame is typically backed by the ntdll module.
()
| 236 | // FinalUserspaceFrame returns the final userspace frame. This |
| 237 | // frame is typically backed by the ntdll module. |
| 238 | func (s *Callstack) FinalUserspaceFrame() *Frame { |
| 239 | if s.IsEmpty() { |
| 240 | return nil |
| 241 | } |
| 242 | |
| 243 | for n := s.Depth() - 1; n > 0; n-- { |
| 244 | f := (*s)[n] |
| 245 | if f.Addr.InSystemRange() { |
| 246 | continue |
| 247 | } |
| 248 | return &f |
| 249 | } |
| 250 | |
| 251 | return nil |
| 252 | } |
| 253 | |
| 254 | // FinalKernelFrame returns the final kernel space frame. |
| 255 | func (s *Callstack) FinalKernelFrame() *Frame { |