MCPcopy Create free account
hub / github.com/iovisor/bcc / format_instr

Method format_instr

tests/python/test_disassembler.py:129–137  ·  view source on GitHub ↗
(cls, instr, fmt)

Source from the content-addressed store, hash-verified

127
128 @classmethod
129 def format_instr(cls, instr, fmt):
130 uimm = ct.c_uint32(instr.imm).value
131 return (fmt.replace("%dst", "r%d" % (instr.dst))
132 .replace("%src", "r%d" % (instr.src))
133 .replace("%imm", "%d" % (instr.imm))
134 .replace("%ibw", "0x%x" % (uimm))
135 .replace("%sim", "%+d" % (instr.imm))
136 .replace("%off", "%+d" % (instr.offset))
137 .replace("%jmp", "%d" % (instr.offset + 1)))
138
139 def test_func(self):
140 b = BPF(text=b"""

Callers 1

test_bpf_isaMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected