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

Eugene Loh eugene.loh at oracle.com
Wed Jun 2 11:11:07 PDT 2021


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.

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

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++) {



More information about the DTrace-devel mailing list