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

Kris Van Hees kris.van.hees at oracle.com
Tue Jun 1 22:47:45 PDT 2021


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




More information about the DTrace-devel mailing list