[DTrace-devel] [PATCH] Add support for array/struct/union to trace()
Kris Van Hees
kris.van.hees at oracle.com
Fri Jan 28 07:30:42 UTC 2022
On Thu, Jan 27, 2022 at 11:01:56PM -0500, Kris Van Hees via DTrace-devel wrote:
> On Thu, Jan 27, 2022 at 05:11:18PM -0500, Eugene Loh via DTrace-devel wrote:
> > On 1/26/22 11:26 AM, Kris Van Hees via DTrace-devel wrote:
> > > + if (kind == DTRACEACT_DIFEXPR && (arg & DT_NF_REF)) {
> > > + off = dt_rec_add(dtp, dt_cg_fill_gap, kind,
> > > + size, size, pfp, arg);
> >
> > For dt_rec_add(), why is the alignment "size" rather than 1?
>
> Good catch. Cut'n'paste error. I am not certain that 1 will be the best
> alignment here because we may want a struct, union, or array at its proper
> alignment based on the conte type(s), but for now I will go with it. We
> can revisit this if/when we might consider providing annotated output.
Looking into this a bit more, the trouble with setting alignment to be 1 is
that it makes it impossible to distinguish between string data and non-string
data. The trace processing in the consumer uses the alignment, so I need to
either have the alignment be >= 2 and <= 8 (since more than 8 is pointless)
or somehow ensure that the trace processing can know what type of data it is
looking at. I don't want to add more fields to the recdata so I'll see if I
can use dtrd_arg for this, or I'll ust an alignment of 2, 4, or 8 depending on
the data size.
Stay tuned...
More information about the DTrace-devel
mailing list