[DTrace-devel] [PATCH 04/20] Increase the instruction counter to 4 digits for BPF programs

Kris Van Hees kris.van.hees at oracle.com
Wed Jun 2 11:37:28 PDT 2021


On Wed, Jun 02, 2021 at 02:11:07PM -0400, Eugene Loh wrote:
> Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
> 
> though:
> 
> *)  We should show offsets in the variable and relocation listings in 
> the same format as in the instruction listings.  That is, if offsets in 
> the instruction listings look like 00024 and so on, then the offsets in 
> the variable and relocation listings should as well.  Adding the leading 
> zeroes will also align the offsets in the variable and relocation listings.

Why?  They are different things.  If anything, if we want to make such a
change I would be more in favour of dropping the leading zeros in the
disassembly listing.  That would be a deviation from the legacy version, as
far as I can see, but I'd be OK with that.  That was not the purpose of this
patch though.  But if we agree, we can make changes like that.

> *)  And instruction numbers need to have the same format in branch/jump 
> targets -- that is, in dt_dis_branch* and dt_dis_jump.

I can see why we might want that to be consistent, though, again, then I think
I'd rather make a change to drop leading zeros.  Aligning at the right is the
way to go then as well though I think.

Thoughts?  Opinions?

> On 6/2/21 1:47 AM, Kris Van Hees wrote:
> > BPF programs are becoming longer as more features are implemented, and
> > we are now routinely encountering progrmas that are 1000 or more
> > instructions.  The disassembler listings were limited to 3 digits for
> > the instruction counter and 4 for the offset.  This is now increased
> > to 4 digits for the counter and 5 for the offset.
> >
> > Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> > ---
> >   libdtrace/dt_dis.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/libdtrace/dt_dis.c b/libdtrace/dt_dis.c
> > index fdd10dc3..8094e40d 100644
> > --- a/libdtrace/dt_dis.c
> > +++ b/libdtrace/dt_dis.c
> > @@ -30,7 +30,7 @@ static const char * const helper_fn[] = {
> >   static void
> >   dt_dis_prefix(uint_t i, const struct bpf_insn *instr, FILE *fp)
> >   {
> > -	fprintf(fp, "%03u %04u: %02hhx %01hhx %01hhx %04hx %08x    ",
> > +	fprintf(fp, "%04u %05u: %02hhx %01hhx %01hhx %04hx %08x    ",
> >   		i, i*8, instr->code, instr->dst_reg, instr->src_reg,
> >   		instr->off, instr->imm);
> >   }
> > @@ -669,7 +669,7 @@ dt_dis_difo(const dtrace_difo_t *dp, FILE *fp, const dt_ident_t *idp,
> >   	else
> >   		fprintf(fp, "\nDisassembly of %s:\n", ltype);
> >   
> > -	fprintf(fp, "%-3s %-5s %-20s    %s\n",
> > +	fprintf(fp, "%-4s %-5s  %-20s    %s\n",
> >   	    "INS", "OFF", "OPCODE", "INSTRUCTION");
> >   
> >   	for (i = 0; i < dp->dtdo_len; i++) {
> 
> _______________________________________________
> 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