(t *testing.T)
| 813 | func (s *NoopPsSnapshotter) RemoveMmap(pid uint32, addr va.Address) error { return nil } |
| 814 | |
| 815 | func 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 | |
| 842 | func testCallstackEnrichment(t *testing.T, hsnap handle.Snapshotter, psnap ps.Snapshotter) { |
| 843 | event.DropCurrentProc = false |
nothing calls this directly
no test coverage detected