[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 12:19:21 PDT 2021


On 6/2/21 2:37 PM, Kris Van Hees wrote:

> 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?

For me, the safe decision is consistency.  Use the same format for a 
piece of information regardless of where in the output the info is 
appearing.

Regarding leading zeros, I'm less sure.  They're certainly a nuisance 
sometimes, but they do provide visual reminders of what one is looking 
at.  Is it an instruction count or an offset?  Well, 0024 and 00392 
include a visual hint (the field width);  28... not so much.  Jump 
target?  Does "-> 24" mean pc+24 or instruction 0024?  These are not 
rock-clad arguments.  I can well imagine people disagreeing on these 
subjective questions.  And such "visual hints" are not necessary, 
especially in my jump-target example.  But, again, for me, the leading 
zeros -- and different widths for instruction counts and offsets -- have 
advantages.

That's my $0.02.

>> 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.



More information about the DTrace-devel mailing list