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
160 stars 13 forks source link

TypeGraphv2: correctly handle bitfields in code generation #495

Closed tyroguru closed 4 months ago

tyroguru commented 4 months ago

Summary

Currently in TypeGraph when generating inst::Field objects in the generated source we use the sizeof operator to construct the static and exclusive size. As you can't use sizeof() on a bitfield this generates invalid code. This fix special cases bit fields and sets the static and exclusive size to 0 as there size will be rolled up in the parent object.

Test plan

A 'make test` has no new failures. This fix was tested against an object in a Meta source base.