You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ctf: explicitly specify the sizes of structures and unions
Before now, we have allowed libdtrace-ctf to decide what size a
structure or union is, given the alignment and packing requirements of
the members. However, this is flawed: the alignment and packing
requirements are platform-dependent, and libdtrace-ctf has no idea what
those requirements are: and for packed structures they are certain to be
wrong anyway.
The DWARF already encodes precisely how large all these things are: we
even collect and use this information to disambiguate otherwise-
identical structures (e.g. those modified by #ifdefs that vary by
translation unit). So refactor this code out into a new
private_dwarf_size() function and use it both from the old place in
type_id() and from assemble_ctf_struct_union(). If no size is
specified, or if the compiler has elected to use a form that we cannot
handle (like, say, an exprloc, which we are *not* interpreting), let
libdtrace-ctf figure it out, but otherwise -- in the vast majority of
cases -- explicitly specify it.
Explicit specification of sizes requires libdtrace-ctf 1.1, which this
commit thus requires.
(This also adds some suitable structures to the dt_test module so that
the DTrace testsuite can verify that this change does not regress.)
Signed-off-by: Nick Alcock <[email protected]>
Reviewed-by: Kris Van Hees <[email protected]>
Orabug: 29054989
0 commit comments