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

Function TestCallstackEnrichment

internal/etw/source_test.go:815–840  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

813func (s *NoopPsSnapshotter) RemoveMmap(pid uint32, addr va.Address) error { return nil }
814
815func TestCallstackEnrichment(t *testing.T) {
816 hsnap := new(handle.SnapshotterMock)
817 hsnap.On("FindByObject", mock.Anything).Return(htypes.Handle{}, false)
818 hsnap.On("FindHandles", mock.Anything).Return([]htypes.Handle{}, nil)
819 hsnap.On("Write", mock.Anything).Return(nil)
820 hsnap.On("Remove", mock.Anything).Return(nil)
821
822 // exercise callstack enrichment with a noop
823 // process snapshotter. This will make the
824 // symbolizer to always fall back to Debug Help
825 // API when resolving symbolic information
826 nopsnap := new(NoopPsSnapshotter)
827 log.Info("test callstack enrichment with noop ps snapshotter")
828 testCallstackEnrichment(t, hsnap, nopsnap)
829
830 // now use a real process snapshotter to
831 // enrich the callstacks. This way, we
832 // should only resort to Debug Help API
833 // when the symbol is not found in PE
834 // export directory or the module doesn't
835 // exist in process state
836 cfg := &config.Config{}
837 psnap := ps.NewSnapshotter(hsnap, cfg)
838 log.Info("test callstack enrichment with real ps snapshotter")
839 testCallstackEnrichment(t, hsnap, psnap)
840}
841
842func testCallstackEnrichment(t *testing.T, hsnap handle.Snapshotter, psnap ps.Snapshotter) {
843 event.DropCurrentProc = false

Callers

nothing calls this directly

Calls 3

NewSnapshotterFunction · 0.92
testCallstackEnrichmentFunction · 0.85
InfoMethod · 0.80

Tested by

no test coverage detected