[DTrace-devel] [PATCH 03/20] Do not print an offset for builtin variables
Kris Van Hees
kris.van.hees at oracle.com
Wed Jun 9 08:46:49 PDT 2021
On Wed, Jun 09, 2021 at 11:27:15AM -0400, Eugene Loh wrote:
> Actually, speaking of testing, how does this patch do with the test
> suite? It seems to me that it causes
> test/unittest/variables/gvar/tst.undecl-offset.sh to FAIL.
Well, no, it wouldn't in its new version (i.e. the version that contains your
reviewed-by and adds a test as you requested, and that also got updated of
course in view of earlier patches being affected by it).
I just can't put it on the -dev tree yet because I am still waiting for your
review of "[02/20] Fix alignment of global and local variables".
> On 6/2/21 1:38 PM, Eugene Loh wrote:
> > Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
> > though it would be nice to have tests accompany patches.
> >
> > On 6/2/21 1:47 AM, Kris Van Hees wrote:
> >> Builtin variables are global variables but their value is not stored
> >> in the gvars BPF map. Therefore, their offset is always -1 which is
> >> displayed as ffffffff. That value is too wide for the OFFSET field
> >> in the variable list in the disassembly listing. Since the offset
> >> value is not meaningful in this case, it is no longer printed.
> >>
> >> Offsets are now also printed in decimal rather than hexadecimal to be
> >> consistent with other offset values in disassembly listings.
> >>
> >> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> >> ---
> >> libdtrace/dt_dis.c | 10 +++++++---
> >> 1 file changed, 7 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/libdtrace/dt_dis.c b/libdtrace/dt_dis.c
> >> index a8c4e1ca..fdd10dc3 100644
> >> --- a/libdtrace/dt_dis.c
> >> +++ b/libdtrace/dt_dis.c
> >> @@ -716,7 +716,11 @@ dt_dis_difo(const dtrace_difo_t *dp, FILE *fp,
> >> const dt_ident_t *idp,
> >> for (i = 0; i < dp->dtdo_varlen; i++) {
> >> dtrace_difv_t *v = &dp->dtdo_vartab[i];
> >> - char kind[4], scope[4], range[12], flags[16] = { 0 };
> >> + char offset[11] = { 0 }, flags[16] = { 0 };
> >> + char kind[4], scope[4], range[12];
> >> +
> >> + if (v->dtdv_offset != -1)
> >> + snprintf(offset, sizeof(offset), "%u", v->dtdv_offset);
> >> switch (v->dtdv_kind) {
> >> case DIFV_KIND_AGGREGATE:
> >> @@ -759,9 +763,9 @@ dt_dis_difo(const dtrace_difo_t *dp, FILE *fp,
> >> const dt_ident_t *idp,
> >> if (v->dtdv_flags & DIFV_F_MOD)
> >> strcat(flags, "/w");
> >> - fprintf(fp, "%-16s %-4x %-6x %-3s %-3s %-11s %-4s %s\n",
> >> + fprintf(fp, "%-16s %-4x %-6s %-3s %-3s %-11s %-4s %s\n",
> >> &dp->dtdo_strtab[v->dtdv_name], v->dtdv_id,
> >> - v->dtdv_offset, kind, scope, range, flags + 1,
> >> + offset, kind, scope, range, flags + 1,
> >> dt_dis_typestr(&v->dtdv_type, type, sizeof(type)));
> >> }
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
More information about the DTrace-devel
mailing list