iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.56k stars 3.88k forks source link

64-bits BPF intruction #1400

Closed gom3sa closed 6 years ago

gom3sa commented 7 years ago

Is it possible to obtain the entire BPF instruction while compiling a C program to eBPF using BCC? I'm able to get the opcode using BPF(src_file="my_prog.c", debug=2). This is 8-bits long. However, I would like to the the final 64-bits long instruction.

drzaeus77 commented 7 years ago

See def dump_func(self, func_name) in bcc/__init__.py, it returns the program as a string.

yonghong-song commented 7 years ago

If you are using latest llvm trunk, you can use debug=8, it will print out the insn with source embedded. The insn includes both encoding and asm syntax.