(e *event.Event)
| 287 | } |
| 288 | |
| 289 | func (s *Symbolizer) processCallstack(e *event.Event) error { |
| 290 | addrs := e.Params.MustGetSliceAddrs(params.Callstack) |
| 291 | e.Callstack.Init(len(addrs)) |
| 292 | |
| 293 | // skip stack enrichment for the events generated by the System process |
| 294 | // except the LoadModule event which may prove to be useful when the |
| 295 | // driver is loaded and the kernel address symbolization is enabled |
| 296 | if e.IsSystemPid() && !e.IsLoadModule() { |
| 297 | return nil |
| 298 | } |
| 299 | |
| 300 | s.mu.Lock() |
| 301 | defer s.mu.Unlock() |
| 302 | |
| 303 | if e.PS != nil { |
| 304 | var ( |
| 305 | addr va.Address |
| 306 | pid uint32 |
| 307 | ) |
| 308 | |
| 309 | // get the address that we want to symbolize |
| 310 | switch e.Type { |
| 311 | case event.CreateThread: |
| 312 | pid = e.Params.MustGetPid() |
| 313 | addr = e.Params.TryGetAddress(params.StartAddress) |
| 314 | case event.SubmitThreadpoolWork, event.SubmitThreadpoolCallback: |
| 315 | pid = e.PID |
| 316 | addr = e.Params.TryGetAddress(params.ThreadpoolCallback) |
| 317 | } |
| 318 | |
| 319 | // symbolize thread start or thread pool callback address |
| 320 | // and resolve the module name that contains the function |
| 321 | if addr != 0 { |
| 322 | mod := e.PS.FindModuleByVa(addr) |
| 323 | // perform lookup against parent modules |
| 324 | if mod == nil && e.PS.Parent != nil { |
| 325 | mod = e.PS.Parent.FindModuleByVa(addr) |
| 326 | } |
| 327 | symbol := s.symbolizeAddress(pid, addr, mod) |
| 328 | |
| 329 | if symbol != "" && symbol != "?" { |
| 330 | switch e.Type { |
| 331 | case event.CreateThread: |
| 332 | e.Params.Append(params.StartAddressSymbol, params.UnicodeString, symbol) |
| 333 | case event.SubmitThreadpoolWork, event.SubmitThreadpoolCallback: |
| 334 | e.Params.Append(params.ThreadpoolCallbackSymbol, params.UnicodeString, symbol) |
| 335 | |
| 336 | ctx := e.Params.TryGetAddress(params.ThreadpoolContext) |
| 337 | |
| 338 | // if the callback resolves to one of the functions |
| 339 | // that receive the CONTEXT structure as a parameter |
| 340 | // try to read the thread context and resolve the |
| 341 | // function address stored in the instruction pointer |
| 342 | if ctx != 0 && threadcontext.IsParamOfFunc(symbol) { |
| 343 | rip := threadcontext.Rip(pid, ctx) |
| 344 | if rip != 0 { |
| 345 | e.Params.Append(params.ThreadpoolContextRip, params.Address, rip.Uint64()) |
| 346 |
no test coverage detected