iovisor / bcc

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

The perf_submit output data after 0,0 is discarded #4787

Open revercc opened 1 year ago

revercc commented 1 year ago

企业微信截图_1698673874585

I empty the fourth byte in the output data, and as a result, the data after the fourth byte in the application layer is not printed

MapleLCG commented 8 months ago

实际上这不是BCC的问题。BCC使用了ctypes库来进行数据交换,char数组(c_char)会被映射为bytes类。在这一过程中,ctypes做了一些操作,将空字符之后的内容抛弃了。你用c_ubyte 或者是 c_byte,也就是unsigned char,将数组映射为int类型就能完整的获取数据。