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

Method FindModuleByVa

pkg/ps/types/types_windows.go:551–588  ·  view source on GitHub ↗

FindModuleByVa finds the module name by probing the range of the given virtual address.

(addr va.Address)

Source from the content-addressed store, hash-verified

549// FindModuleByVa finds the module name by
550// probing the range of the given virtual address.
551func (ps *PS) FindModuleByVa(addr va.Address) *Module {
552 mod := ps.findModuleByVa(addr)
553 if mod != nil {
554 return mod
555 }
556
557 ps.onceMods.Do(func() {
558 // query live process modules
559 ps.modules = queryLiveModules(ps.PID)
560 })
561
562 // try to find the module within the VA space
563 // and if found, add it to process modules for
564 // future lookups
565 for _, m := range ps.modules {
566 b := va.Address(m.BaseOfDll)
567 size := uint64(m.SizeOfImage)
568
569 if addr < b || addr >= b.Inc(size) {
570 continue
571 }
572
573 mod := Module{
574 Name: m.Name,
575 BaseAddress: b,
576 Size: size,
577 DefaultBaseAddress: b,
578 }
579
580 ps.Lock()
581 ps.Modules = append(ps.Modules, mod)
582 ps.Unlock()
583
584 return &mod
585 }
586
587 return nil
588}
589
590func (ps *PS) findModuleByVa(addr va.Address) *Module {
591 ps.RLock()

Callers 3

TestFindModuleByVaFunction · 0.95
processCallstackMethod · 0.80
produceFrameMethod · 0.80

Calls 5

findModuleByVaMethod · 0.95
AddressTypeAlias · 0.92
LockMethod · 0.80
UnlockMethod · 0.80
IncMethod · 0.45

Tested by 1

TestFindModuleByVaFunction · 0.76