kfl / ebpf-tools

Experiments with eBPF bytecode
MIT License
10 stars 4 forks source link

Generate valid eBPF assembly for loads and stores in Instruction Display instance #11

Closed spaarmann closed 10 months ago

spaarmann commented 10 months ago

Load and Store instructions seem to have slightly broken results when displayed. For example, assembling and disassembling this code:

ldxb r4, [r1]
stxb [r1], r4

results in this output:

ldxb r14, r1 +0
stxbr1 +0 r4

Notice the missing space before r1 and the missing comma after +0 in the store, and the missing square brackets for both instructions.

This PR changes the output to

ldxb r4, [r1 +0]
stxb [r1 +0], r4
kfl commented 10 months ago

Thanks for the fix!