MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / syncModules

Method syncModules

pkg/symbolize/symbolizer.go:261–287  ·  view source on GitHub ↗

syncModules reconciles the state of loaded modules. When the module is unloaded from the process address space, its information is pruned from the cache. If the new module is loaded and not already present in the map, we get its export directory and insert into the map.

(e *event.Event)

Source from the content-addressed store, hash-verified

259// the map, we get its export directory and insert
260// into the map.
261func (s *Symbolizer) syncModules(e *event.Event) error {
262 base := e.Params.TryGetAddress(params.ModuleBase)
263 size := e.Params.TryGetUint64(params.ModuleSize)
264
265 if e.IsUnloadModule() {
266 s.mu.Lock()
267 defer s.mu.Unlock()
268 if _, ok := s.mods[e.PID][base]; ok {
269 symModulesCount.Add(-1)
270 delete(s.mods[e.PID], base)
271 // prune symbol entry from the cache if
272 // the symbol address falls within the
273 // unmapped module
274 syms, ok := s.symbols[e.PID]
275 if !ok {
276 return nil
277 }
278 for addr := range syms {
279 if addr >= base && addr <= base.Inc(size) {
280 delete(s.symbols[e.PID], base)
281 }
282 }
283 }
284 }
285
286 return nil
287}
288
289func (s *Symbolizer) processCallstack(e *event.Event) error {
290 addrs := e.Params.MustGetSliceAddrs(params.Callstack)

Callers 1

ProcessEventMethod · 0.95

Calls 7

TryGetAddressMethod · 0.80
TryGetUint64Method · 0.80
IsUnloadModuleMethod · 0.80
LockMethod · 0.80
UnlockMethod · 0.80
AddMethod · 0.65
IncMethod · 0.45

Tested by

no test coverage detected