facebookexperimental / object-introspection

Object Introspection (OI) enables on-demand, hierarchical profiling of objects in arbitrary C/C++ programs with no recompilation.
Apache License 2.0
163 stars 14 forks source link

ignore whole types in addition to members (fully qualified) #480

Closed tyroguru closed 8 months ago

tyroguru commented 8 months ago

Summary

Our current mechanism for ignoring members is just that - members only. This change extends this allow stubbing of members by type.

namespace X {
  struct Foo {
    int a, b, c;
  };

  struct Bar {
    int x, y, z;
  };

  struct FooBar {
    Foo f;
    Bar b;
  };
} // namespace X

With the above definition to stub out FooBar->Bar you could either stub by member:

[[codegen.ignore]]
type="X::Foo"
member = ["b"]

or you can stub by type:

[[codegen.ignore]]
type="X::Bar"

Note this changes the extant behaviour. Now types MUST be fully qualified for them to match. If they are not specified as fully qualified than stubbing won't work as expected and we'll attempt to capture that member/type .

Test plan

I've altered the ignored integration tests to modify the original test and add 2 more.

facebook-github-bot commented 8 months ago

@tyroguru has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

codecov-commenter commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (f076b34) 62.54% compared to head (8b01715) 62.69%. Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #480 +/- ## ========================================== + Coverage 62.54% 62.69% +0.15% ========================================== Files 123 123 Lines 12086 12087 +1 Branches 1969 1970 +1 ========================================== + Hits 7559 7578 +19 + Misses 3570 3554 -16 + Partials 957 955 -2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.